1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 14:33:52 +01:00

tools/openocd: select target core

For multi-arch SoC like STM32MP1, the right target core has
to be selected to avoid debugging the wrong default cpu.
This is done using openocd command 'targets ${OPENOCD_CORE}'.
OPENOCD_CORE has to be set in board Makefile.include file.
In case it is not set, the command just display available targets, thus it
has no effect on already existing boards using openocd.

Signed-off-by: Gilles DOFFE <gilles.doffe@savoirfairelinux.com>
This commit is contained in:
Gilles DOFFE 2020-08-02 23:28:10 +02:00
parent e7b344983d
commit 4f3ea5c74c
2 changed files with 6 additions and 1 deletions

View File

@ -104,6 +104,8 @@
: ${OPENOCD_DBG_EXTRA_CMD:=}
# command used to reset the board
: ${OPENOCD_CMD_RESET_RUN:="-c 'reset run'"}
# Select core on multi-core processors.
: ${OPENOCD_CORE:=}
# 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
# when flashing images for firmware swapping/remapping boot loaders.
@ -336,7 +338,7 @@ do_debug() {
-c 'gdb_port ${GDB_PORT}' \
-c 'init' \
${OPENOCD_DBG_EXTRA_CMD} \
-c 'targets' \
-c 'targets ${OPENOCD_CORE}' \
${OPENOCD_DBG_START_CMD} \
-l /dev/null & \
echo \$! > $OCD_PIDFILE" &

View File

@ -20,6 +20,9 @@ OPENOCD_CONFIG ?= $(BOARDDIR)/dist/openocd.cfg
OPENOCD_TARGETS = debug% flash% reset
$(call target-export-variables,$(OPENOCD_TARGETS),OPENOCD_CONFIG)
# Export OPENOCD_CORE to required targets
$(call target-export-variables,$(OPENOCD_TARGETS),OPENOCD_CORE)
# Export OPENOCD_ADAPTER_INIT to required targets
$(call target-export-variables,$(OPENOCD_TARGETS),OPENOCD_ADAPTER_INIT)