openocd: Use reset halt when starting debug-server#10479
openocd: Use reset halt when starting debug-server#10479jnohlgard wants to merge 2 commits intoRIOT-OS:masterfrom
Conversation
dist/tools/openocd/openocd.sh
Outdated
| -c 'init' \ | ||
| -c 'targets' \ | ||
| -c 'halt'" | ||
| -c 'reset halt'" |
There was a problem hiding this comment.
Instead of this, maybe we could reuse ${OPENOCD_DBG_START_CMD} like in do_debug. This allows boards requiring this to override start command.
4d65bbd to
761726d
Compare
|
Modified to reuse OPENOCD_DBG_START_CMD for both debug and debug-server. Changed the default command to be |
dist/tools/openocd/openocd.sh
Outdated
| # the target when starting a debug session. 'reset halt' can also be used | ||
| # depending on the type of target. | ||
| : ${OPENOCD_DBG_START_CMD:=-c 'halt'} | ||
| : ${OPENOCD_DBG_START_CMD:=-c \'reset halt\'} |
There was a problem hiding this comment.
This needs to be discussed a bit more. See #8976 where I tried to set this default to boards using st-link.
The problem with this change is that by default one cannot attach to the current state of a running application.
761726d to
731cdcd
Compare
Makes the OpenOCD start up more robust, especially when combined with reset_config connect_assert_srst in the target configuration.
731cdcd to
df08a86
Compare
'reset halt' is now the default value for OpenOCD
|
To move forward on this, I allowed myself to rebase this PR and slightly update it: variable documentation is updated in openocd.sh and the default value used for this variable in a some boards (f1 based + b-l072Z-lrwan1 boards) is removed from the makefile, since now it's using the openocd default value. @cladmi, are you interested in having a look ? |
|
I can try on a few boards indeed. Is this saying we are indeed going toward putting |
|
This means running "make debug" would always reset a board? do we want that? I sometimes realize a board is stuck somewhere, then connect the debugger to see where it got stuck. |
By default yes, but one can still have the non reset behaviour by passing |
|
@kaspar030 currently there are many cases where doing |
Then add the corresponding reset halt to the flash command. I don't understand what that has to do with starting the gdb server. |
|
There is a confusion here. This PR is just about debug. Having reset halt before starting the debug-server fixes gdb connection when |
|
Is this one still relevant? with OPENOCD_RESET_USE_CONNECT_ASSERT_SRST there is no issue when launching |
|
ping @aabadie! |
|
ping! |
|
I agree with @kaspar030 here. I too will use If you want to start debugging in a defined state, how about adding a |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions. |
Contribution description
Makes the debug-server start up more robust, especially when combined with
reset_config connect_assert_srstin the OpenOCD configuration.Testing procedure
With any board with an onboard debugger interface and using OpenOCD:
Verify that the OpenOCD instance can connect to the board and that the application running is halted (e.g. does not respond to UART shell commands anymore, software controlled LEDs stop blinking etc.)
in a different terminal:
(This will attempt to start another instance of openocd, but that will fail since the same UDP port is already used by the running debug-server instance)
See that GDB works as expected:
Verify that the application is running.
Press CTRL+C in GDB, verify that GDB has managed to halt the application.
Issues/PRs references