dist/tools/pyocd: add PYOCD_ADAPTER_INIT

- Pass parameters before flash, debug, reset
This commit is contained in:
Francisco Molina 2019-09-10 16:26:45 +02:00 committed by Alexandre Abadie
parent 8911c514fd
commit f718cc581a
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405

View File

@ -52,6 +52,8 @@
: ${PYOCD_CMD:=pyocd} : ${PYOCD_CMD:=pyocd}
: ${PYOCD_FLASH:=${PYOCD_CMD} flash} : ${PYOCD_FLASH:=${PYOCD_CMD} flash}
: ${PYOCD_GDBSERVER:=${PYOCD_CMD} gdbserver} : ${PYOCD_GDBSERVER:=${PYOCD_CMD} gdbserver}
# Debugger interface initialization commands to pass to PyOCD
: ${PYOCD_ADAPTER_INIT:=}
# The setsid command is needed so that Ctrl+C in GDB doesn't kill PyOCD. # The setsid command is needed so that Ctrl+C in GDB doesn't kill PyOCD.
: ${SETSID:=setsid} : ${SETSID:=setsid}
# GDB command, usually a separate command for each platform (e.g. # GDB command, usually a separate command for each platform (e.g.
@ -124,7 +126,7 @@ do_flash() {
fi fi
# flash device # flash device
sh -c "${PYOCD_FLASH} ${FLASH_TARGET_TYPE} -a ${IMAGE_OFFSET} \"${HEX_FILE}\"" && sh -c "${PYOCD_FLASH} ${FLASH_TARGET_TYPE} ${PYOCD_ADAPTER_INIT} -a ${IMAGE_OFFSET} \"${HEX_FILE}\"" &&
echo 'Done flashing' echo 'Done flashing'
} }
@ -147,6 +149,7 @@ do_debug() {
# start PyOCD as GDB server # start PyOCD as GDB server
${SETSID} sh -c "${PYOCD_GDBSERVER} \ ${SETSID} sh -c "${PYOCD_GDBSERVER} \
${FLASH_TARGET_TYPE} \ ${FLASH_TARGET_TYPE} \
${PYOCD_ADAPTER_INIT} \
-p ${GDB_PORT} \ -p ${GDB_PORT} \
-T ${TELNET_PORT} & \ -T ${TELNET_PORT} & \
echo \$! > $OCD_PIDFILE" & echo \$! > $OCD_PIDFILE" &
@ -164,13 +167,14 @@ do_debugserver() {
# start PyOCD as GDB server # start PyOCD as GDB server
sh -c "${PYOCD_GDBSERVER} \ sh -c "${PYOCD_GDBSERVER} \
${FLASH_TARGET_TYPE} \ ${FLASH_TARGET_TYPE} \
${PYOCD_ADAPTER_INIT} \
-p ${GDB_PORT} \ -p ${GDB_PORT} \
-T ${TELNET_PORT}" -T ${TELNET_PORT}"
} }
do_reset() { do_reset() {
# start PyOCD and invoke board reset # start PyOCD and invoke board reset
sh -c "${PYOCD_CMD} cmd -c reset ${FLASH_TARGET_TYPE}" sh -c "${PYOCD_CMD} cmd -c reset ${FLASH_TARGET_TYPE} ${PYOCD_ADAPTER_INIT}"
} }
# #