Skip to content
Snippets Groups Projects
Unverified Commit 4e872e61 authored by Francisco Acosta's avatar Francisco Acosta Committed by GitHub
Browse files

Merge pull request #8856 from aabadie/pr/openocd_debug_reset

dist/tools/openocd: add the possibility to do a reset before halt in openocd debug command
parents 22aa6b9c ea255f51
No related branches found
No related tags found
No related merge requests found
...@@ -12,5 +12,8 @@ include $(RIOTMAKE)/tools/serial.inc.mk ...@@ -12,5 +12,8 @@ include $(RIOTMAKE)/tools/serial.inc.mk
export DEBUG_ADAPTER ?= stlink export DEBUG_ADAPTER ?= stlink
export STLINK_VERSION ?= 2-1 export STLINK_VERSION ?= 2-1
# call a 'reset halt' command before starting the debugger
export OPENOCD_DBG_START_CMD = -c 'reset halt'
# this board uses openocd # this board uses openocd
include $(RIOTMAKE)/tools/openocd.inc.mk include $(RIOTMAKE)/tools/openocd.inc.mk
...@@ -83,6 +83,10 @@ ...@@ -83,6 +83,10 @@
# Debugger flags, will be passed to sh -c, remember to escape any quotation signs. # Debugger flags, will be passed to sh -c, remember to escape any quotation signs.
# Use ${DBG_DEFAULT_FLAGS} to insert the default flags anywhere in the string # Use ${DBG_DEFAULT_FLAGS} to insert the default flags anywhere in the string
: ${DBG_FLAGS:=${DBG_DEFAULT_FLAGS} ${DBG_EXTRA_FLAGS}} : ${DBG_FLAGS:=${DBG_DEFAULT_FLAGS} ${DBG_EXTRA_FLAGS}}
# Initial target state when using debug, by default a 'halt' request is sent to
# 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'}
# This is an optional offset to the base address that can be used to flash an # This is an optional offset to the base address that can be used to flash an
# image in a different location than it is linked at. This feature can be useful # image in a different location than it is linked at. This feature can be useful
# when flashing images for firmware swapping/remapping boot loaders. # when flashing images for firmware swapping/remapping boot loaders.
...@@ -201,7 +205,7 @@ do_debug() { ...@@ -201,7 +205,7 @@ do_debug() {
-c 'gdb_port ${GDB_PORT}' \ -c 'gdb_port ${GDB_PORT}' \
-c 'init' \ -c 'init' \
-c 'targets' \ -c 'targets' \
-c 'halt' \ ${OPENOCD_DBG_START_CMD} \
-l /dev/null & \ -l /dev/null & \
echo \$! > $OCD_PIDFILE" & echo \$! > $OCD_PIDFILE" &
# Export to be able to access these from the sh -c command lines, may be # Export to be able to access these from the sh -c command lines, may be
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment