diff options
author | Kevin Yang <kangyang@google.com> | 2020-11-04 10:39:29 -0800 |
---|---|---|
committer | Tomas Vanek <vanekt@fbl.cz> | 2020-11-11 21:22:16 +0000 |
commit | 06c7a53f1fff20bcc4be9e63f83ae98664777f34 (patch) | |
tree | 775507b0493ae3489ca0d39e617735433f85fa59 | |
parent | e44539d66c8929679321704768125df9ba7d5f67 (diff) | |
download | riscv-openocd-06c7a53f1fff20bcc4be9e63f83ae98664777f34.zip riscv-openocd-06c7a53f1fff20bcc4be9e63f83ae98664777f34.tar.gz riscv-openocd-06c7a53f1fff20bcc4be9e63f83ae98664777f34.tar.bz2 |
target/cortex_m: Change sleep to running state
When the core is in sleep mode, the core is no longer retiring
instructions. Cortext M remains in "unknown" state. This patch converts
sleep mode to "running" state.
Change-Id: I1e9b6c9be51fd0f1f6ce81af9b1f5f9f1f43c661
Signed-off-by: Kevin Yang <kangyang@google.com>
Reviewed-on: http://openocd.zylin.com/5921
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
-rw-r--r-- | src/target/cortex_m.c | 8 | ||||
-rw-r--r-- | src/target/target.h | 2 |
2 files changed, 3 insertions, 7 deletions
diff --git a/src/target/cortex_m.c b/src/target/cortex_m.c index 08b3661..0c1a99f 100644 --- a/src/target/cortex_m.c +++ b/src/target/cortex_m.c @@ -656,13 +656,9 @@ static int cortex_m_poll(struct target *target) } } - /* REVISIT when S_SLEEP is set, it's in a Sleep or DeepSleep state. - * How best to model low power modes? - */ - if (target->state == TARGET_UNKNOWN) { - /* check if processor is retiring instructions */ - if (cortex_m->dcb_dhcsr & S_RETIRE_ST) { + /* check if processor is retiring instructions or sleeping */ + if (cortex_m->dcb_dhcsr & S_RETIRE_ST || cortex_m->dcb_dhcsr & S_SLEEP) { target->state = TARGET_RUNNING; retval = ERROR_OK; } diff --git a/src/target/target.h b/src/target/target.h index 44463b7..b9ae2f7 100644 --- a/src/target/target.h +++ b/src/target/target.h @@ -47,7 +47,7 @@ struct gdb_fileio_info; /* * TARGET_UNKNOWN = 0: we don't know anything about the target yet - * TARGET_RUNNING = 1: the target is executing user code + * TARGET_RUNNING = 1: the target is executing or ready to execute user code * TARGET_HALTED = 2: the target is not executing code, and ready to talk to the * debugger. on an xscale it means that the debug handler is executing * TARGET_RESET = 3: the target is being held in reset (only a temporary state, |