1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

tools/openocd: Allow specifying a custom halt command

Typically, OpenOCD is already performing a reset on connect. A
`reset halt` to bring the target to a `halt` state for flashing will
result in the device going through a second reset cycle. This can be
problematic with some device, such as the CC26xx MCUs. For these
devices, an `OPENOCD_CMD_RESET_HALT := -c 'halt'` will avoid the second
reset that is causing the issues.
This commit is contained in:
Marian Buschsieweke 2022-12-21 23:17:13 +01:00
parent 5c163180ad
commit 3e1dcf31cb
No known key found for this signature in database
GPG Key ID: CB8E3238CE715A94
2 changed files with 9 additions and 2 deletions

View File

@ -113,6 +113,8 @@
: ${OPENOCD_DBG_EXTRA_CMD:=}
# command used to reset the board
: ${OPENOCD_CMD_RESET_RUN:="-c 'reset run'"}
# command used to halt the board
: ${OPENOCD_CMD_RESET_HALT:="-c 'reset halt'"}
# Select core on multi-core processors.
: ${OPENOCD_CORE:=}
# Set to any value to skip verifying after flashing.
@ -241,7 +243,7 @@ _flash_list_raw() {
${OPENOCD_EXTRA_RESET_INIT} \
-c 'init' \
-c 'targets' \
-c 'reset halt' \
${OPENOCD_CMD_RESET_HALT} \
-c 'flash probe 0' \
-c 'flash list' \
-c 'shutdown'" 2>&1 && return
@ -366,7 +368,7 @@ do_flash() {
-c 'gdb_port 0' \
-c 'init' \
-c 'targets' \
-c 'reset halt' \
${OPENOCD_CMD_RESET_HALT} \
${OPENOCD_PRE_FLASH_CMDS} \
-c 'flash write_image erase \"${IMAGE_FILE}\" ${IMAGE_OFFSET} ${IMAGE_TYPE}' \
${OPENOCD_PRE_VERIFY_CMDS} \

View File

@ -38,6 +38,11 @@ ifneq (,$(OPENOCD_CMD_RESET_RUN))
$(call target-export-variables,reset,OPENOCD_CMD_RESET_RUN)
endif
ifneq (,$(OPENOCD_CMD_RESET_HALT))
# Export OPENOCD_CMD_RESET_HALT only to the flash targets
$(call target-export-variables,flash%,OPENOCD_CMD_RESET_HALT)
endif
OPENOCD_DEBUG_TARGETS = debug debugr debug-server
ifneq (,$(OPENOCD_DBG_EXTRA_CMD))