diff options
author | Antonio Borneo <borneo.antonio@gmail.com> | 2022-05-30 15:32:24 +0200 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2022-08-15 13:22:18 +0000 |
commit | e282d208321ed1661efa894b583cf8922d67ba3f (patch) | |
tree | c81b6a25e8702af45d3c32610563f3495a6cf08c | |
parent | 0d56f379b55b24959c88e705a83e1fbb826b75e7 (diff) | |
download | riscv-openocd-e282d208321ed1661efa894b583cf8922d67ba3f.zip riscv-openocd-e282d208321ed1661efa894b583cf8922d67ba3f.tar.gz riscv-openocd-e282d208321ed1661efa894b583cf8922d67ba3f.tar.bz2 |
openocd: prevent target polling during 'init'
The command 'init' causes the execution of few lower level
commands, e.g. 'target init', and switches from command mode
COMMAND_CONFIG to COMMAND_EXEC, with an intermediate switch back
to mode COMMAND_CONFIG.
A timed target polling can occur during the execution of 'init'
and the target's status can trigger the execution of some events.
E.g. if a target has been left halted by a previous execution of
OpenOCD, the first poll will find the target halted, calling the
corresponding 'halted' event.
The event handler can use commands that can only be executed in
mode COMMAND_EXEC. If the poll happens while OpenOCD is in mode
COMMAND_CONFIG, the triggered handler will fail.
Prevent the target polling to operate during the execution of the
'init' command.
Change-Id: Ia435a5d2039be9b247e2336616dab53ed5d983ac
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7007
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
-rw-r--r-- | src/openocd.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/openocd.c b/src/openocd.c index 43c8523..b65d471 100644 --- a/src/openocd.c +++ b/src/openocd.c @@ -119,6 +119,8 @@ COMMAND_HANDLER(handle_init_command) initialized = 1; + bool save_poll_mask = jtag_poll_mask(); + retval = command_run_line(CMD_CTX, "target init"); if (retval != ERROR_OK) return ERROR_FAIL; @@ -166,6 +168,8 @@ COMMAND_HANDLER(handle_init_command) if (command_run_line(CMD_CTX, "tpiu init") != ERROR_OK) return ERROR_FAIL; + jtag_poll_unmask(save_poll_mask); + /* initialize telnet subsystem */ gdb_target_add_all(all_targets); |