1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-27 15:31:17 +01:00

tools/openocd: add debugr action

In case of STM32MP157c-dk2 board, there is no flash available. Thus,
the elf binary has to be flashed directly to SRAM before debugging.
To do so, the DBG_FLAGS variable has to be overrided to load the binary
using 'load' gdb command.
The START_ADDR variable is the entrypoint extracted from the elf binary
using objdump tool.
The do_debug function can now be used as usual.

Signed-off-by: Gilles DOFFE <gilles.doffe@savoirfairelinux.com>
This commit is contained in:
Gilles DOFFE 2020-08-02 22:24:03 +02:00
parent 4c9ee5d075
commit e7b344983d

View File

@ -51,6 +51,10 @@
# DBG: debugger client command, default: 'gdb -q'
# TUI: if TUI!=null, the -tui option will be used
#
# debugr: debug <elfile>
# debug given file on the target but flash it first directly
# in RAM.
#
# debug-server: starts OpenOCD as GDB server, but does not connect to
# to it with any frontend. This might be useful when using
# IDEs.
@ -391,6 +395,14 @@ case "${ACTION}" in
echo "### Flashing Target ###"
do_flash "$@"
;;
debugr)
START_ADDR=$(objdump -f $1 | sed '/^$/d' | tail -1 | grep -o "0x[0-9a-fA-F].*")
echo "Start address: $START_ADDR"
DBG_FLAGS="$DBG_FLAGS \
-ex 'load $1' \
"
do_debug "$@"
;;
debug)
echo "### Starting Debugging ###"
do_debug "$@"