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

dist/tools/openocd: Replace OPENOCD_EXTRA_INIT with command line arguments

OPENOCD_EXTRA_INIT did not work for quoted arguments or openocd commands which require arguments.
This commit is contained in:
Joakim Gebart 2015-02-23 10:31:07 +01:00
parent 258083323a
commit f10c1f94d8

View File

@ -6,12 +6,14 @@
# as it depends on certain environment variables. An OpenOCD # as it depends on certain environment variables. An OpenOCD
# configuration file must be present in a the boards dist folder. # configuration file must be present in a the boards dist folder.
# #
# Any extra command line arguments after the command name are passed on the
# openocd command line after the configuration file name but before any other
# initialization commands.
#
# Global environment variables used: # Global environment variables used:
# OPENOCD: OpenOCD command name, default: "openocd" # OPENOCD: OpenOCD command name, default: "openocd"
# OPENOCD_CONFIG: OpenOCD configuration file name, # OPENOCD_CONFIG: OpenOCD configuration file name,
# default: "${RIOTBOARD}/${BOARD}/dist/openocd.cfg" # default: "${RIOTBOARD}/${BOARD}/dist/openocd.cfg"
# OPENOCD_EXTRA_INIT: extra parameters to pass on the OpenOCD command line
# before any initialization commands, default: (empty)
# #
# The script supports the following actions: # The script supports the following actions:
# #
@ -117,7 +119,7 @@ do_flash() {
test_hexfile test_hexfile
# flash device # flash device
${OPENOCD} -f "${OPENOCD_CONFIG}" \ ${OPENOCD} -f "${OPENOCD_CONFIG}" \
${OPENOCD_EXTRA_INIT} \ "$@" \
-c "tcl_port 0" \ -c "tcl_port 0" \
-c "telnet_port 0" \ -c "telnet_port 0" \
-c "gdb_port 0" \ -c "gdb_port 0" \
@ -135,7 +137,7 @@ do_debug() {
test_tui test_tui
# start OpenOCD as GDB server # start OpenOCD as GDB server
${OPENOCD} -f "${OPENOCD_CONFIG}" \ ${OPENOCD} -f "${OPENOCD_CONFIG}" \
${OPENOCD_EXTRA_INIT} \ "$@" \
-c "tcl_port ${TCL_PORT}" \ -c "tcl_port ${TCL_PORT}" \
-c "telnet_port ${TELNET_PORT}" \ -c "telnet_port ${TELNET_PORT}" \
-c "gdb_port ${GDB_PORT}" \ -c "gdb_port ${GDB_PORT}" \
@ -156,7 +158,7 @@ do_debugserver() {
test_ports test_ports
# start OpenOCD as GDB server # start OpenOCD as GDB server
${OPENOCD} -f "${OPENOCD_CONFIG}" \ ${OPENOCD} -f "${OPENOCD_CONFIG}" \
${OPENOCD_EXTRA_INIT} \ "$@" \
-c "tcl_port ${TCL_PORT}" \ -c "tcl_port ${TCL_PORT}" \
-c "telnet_port ${TELNET_PORT}" \ -c "telnet_port ${TELNET_PORT}" \
-c "gdb_port ${GDB_PORT}" \ -c "gdb_port ${GDB_PORT}" \
@ -169,7 +171,7 @@ do_reset() {
test_config test_config
# start OpenOCD and invoke board reset # start OpenOCD and invoke board reset
${OPENOCD} -f "${OPENOCD_CONFIG}" \ ${OPENOCD} -f "${OPENOCD_CONFIG}" \
${OPENOCD_EXTRA_INIT} \ "$@" \
-c "tcl_port 0" \ -c "tcl_port 0" \
-c "telnet_port 0" \ -c "telnet_port 0" \
-c "gdb_port 0" \ -c "gdb_port 0" \
@ -181,24 +183,27 @@ do_reset() {
# #
# parameter dispatching # parameter dispatching
# #
case "$1" in ACTION="$1"
shift # pop $1 from $@
case "${ACTION}" in
flash) flash)
echo "### Flashing Target ###" echo "### Flashing Target ###"
do_flash do_flash "$@"
;; ;;
debug) debug)
echo "### Starting Debugging ###" echo "### Starting Debugging ###"
do_debug do_debug "$@"
;; ;;
debug-server) debug-server)
echo "### Starting GDB Server ###" echo "### Starting GDB Server ###"
do_debugserver do_debugserver "$@"
;; ;;
reset) reset)
echo "### Resetting Target ###" echo "### Resetting Target ###"
do_reset do_reset "$@"
;; ;;
*) *)
echo "Usage: $0 {flash|debug|debug-server|reset}" echo "Usage: $0 {flash|debug|debug-server|reset} [extra OpenOCD initialization arguments]"
;; ;;
esac esac