mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
openocd: support target debug-client
This commit is contained in:
parent
4e1ac37400
commit
c76a192eb8
35
dist/tools/openocd/openocd.sh
vendored
35
dist/tools/openocd/openocd.sh
vendored
@ -50,6 +50,11 @@
|
|||||||
# TELNET_PORT: port opened for telnet connections
|
# TELNET_PORT: port opened for telnet connections
|
||||||
# DBG: debugger client command, default: 'gdb -q'
|
# DBG: debugger client command, default: 'gdb -q'
|
||||||
# TUI: if TUI!=null, the -tui option will be used
|
# TUI: if TUI!=null, the -tui option will be used
|
||||||
|
# debug-client: debug-client <elffile>
|
||||||
|
# connects to a running debug-server
|
||||||
|
# GDB_PORT: port opened for GDB connections
|
||||||
|
# DBG: debugger client command, default: 'gdb -q'
|
||||||
|
# TUI: if TUI!=null, the -tui option will be used
|
||||||
#
|
#
|
||||||
# debugr: debug <elfile>
|
# debugr: debug <elfile>
|
||||||
# debug given file on the target but flash it first directly
|
# debug given file on the target but flash it first directly
|
||||||
@ -344,6 +349,21 @@ do_flash() {
|
|||||||
echo 'Done flashing'
|
echo 'Done flashing'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
do_debugclient() {
|
||||||
|
ELFFILE=$1
|
||||||
|
test_elffile
|
||||||
|
# Export to be able to access these from the sh -c command lines, may be
|
||||||
|
# useful when using a frontend for GDB
|
||||||
|
export ELFFILE
|
||||||
|
export GDB
|
||||||
|
export GDB_PORT
|
||||||
|
export DBG_FLAGS
|
||||||
|
export DBG_DEFAULT_FLAGS
|
||||||
|
export DBG_EXTRA_FLAGS
|
||||||
|
# Start the debugger and connect to the GDB server
|
||||||
|
sh -c "${DBG} ${DBG_FLAGS} ${ELFFILE}"
|
||||||
|
}
|
||||||
|
|
||||||
do_debug() {
|
do_debug() {
|
||||||
ELFFILE=$1
|
ELFFILE=$1
|
||||||
test_config
|
test_config
|
||||||
@ -375,16 +395,7 @@ do_debug() {
|
|||||||
${OPENOCD_DBG_START_CMD} \
|
${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
|
do_debugclient ${ELFFILE}
|
||||||
# useful when using a frontend for GDB
|
|
||||||
export ELFFILE
|
|
||||||
export GDB
|
|
||||||
export GDB_PORT
|
|
||||||
export DBG_FLAGS
|
|
||||||
export DBG_DEFAULT_FLAGS
|
|
||||||
export DBG_EXTRA_FLAGS
|
|
||||||
# Start the debugger and connect to the GDB server
|
|
||||||
sh -c "${DBG} ${DBG_FLAGS} ${ELFFILE}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
do_debugserver() {
|
do_debugserver() {
|
||||||
@ -485,6 +496,10 @@ case "${ACTION}" in
|
|||||||
echo "### Starting Debugging ###"
|
echo "### Starting Debugging ###"
|
||||||
do_debug "$@"
|
do_debug "$@"
|
||||||
;;
|
;;
|
||||||
|
debug-client)
|
||||||
|
echo "### Attaching to GDB Server ###"
|
||||||
|
do_debugclient "$@"
|
||||||
|
;;
|
||||||
debug-server)
|
debug-server)
|
||||||
echo "### Starting GDB Server ###"
|
echo "### Starting GDB Server ###"
|
||||||
do_debugserver
|
do_debugserver
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
FLASHER ?= $(RIOTTOOLS)/openocd/openocd.sh
|
FLASHER ?= $(RIOTTOOLS)/openocd/openocd.sh
|
||||||
DEBUGGER ?= $(RIOTTOOLS)/openocd/openocd.sh
|
DEBUGGER ?= $(RIOTTOOLS)/openocd/openocd.sh
|
||||||
DEBUGSERVER ?= $(RIOTTOOLS)/openocd/openocd.sh
|
DEBUGSERVER ?= $(RIOTTOOLS)/openocd/openocd.sh
|
||||||
|
DEBUGCLIENT ?= $(RIOTTOOLS)/openocd/openocd.sh
|
||||||
RESET ?= $(RIOTTOOLS)/openocd/openocd.sh
|
RESET ?= $(RIOTTOOLS)/openocd/openocd.sh
|
||||||
|
|
||||||
FLASHFILE ?= $(ELFFILE)
|
FLASHFILE ?= $(ELFFILE)
|
||||||
FFLAGS ?= flash $(FLASHFILE)
|
FFLAGS ?= flash $(FLASHFILE)
|
||||||
DEBUGGER_FLAGS ?= debug $(DEBUG_ELFFILE)
|
DEBUGGER_FLAGS ?= debug $(DEBUG_ELFFILE)
|
||||||
DEBUGSERVER_FLAGS ?= debug-server
|
DEBUGSERVER_FLAGS ?= debug-server
|
||||||
|
DEBUGCLIENT_FLAGS ?= debug-client $(DEBUG_ELFFILE)
|
||||||
RESET_FLAGS ?= reset
|
RESET_FLAGS ?= reset
|
||||||
|
|
||||||
ifneq (,$(OPENOCD_DEBUG_ADAPTER))
|
ifneq (,$(OPENOCD_DEBUG_ADAPTER))
|
||||||
@ -44,7 +46,7 @@ ifneq (,$(OPENOCD_CMD_RESET_HALT))
|
|||||||
$(call target-export-variables,flash-only,OPENOCD_CMD_RESET_HALT)
|
$(call target-export-variables,flash-only,OPENOCD_CMD_RESET_HALT)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
OPENOCD_DEBUG_TARGETS = debug debugr debug-server
|
OPENOCD_DEBUG_TARGETS = debug debugr debug-server debug-client
|
||||||
|
|
||||||
ifneq (,$(OPENOCD_DBG_EXTRA_CMD))
|
ifneq (,$(OPENOCD_DBG_EXTRA_CMD))
|
||||||
# Export OPENOCD_DBG_EXTRA_CMD only to the flash/flash-only target
|
# Export OPENOCD_DBG_EXTRA_CMD only to the flash/flash-only target
|
||||||
|
Loading…
Reference in New Issue
Block a user