From c5940fa6735acdf08bca3c46384d69ff47ebed91 Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Thu, 15 Jun 2017 08:59:13 -0500 Subject: [PATCH] scripts: pyocd.sh: Add support for passing board_id to pyocd commands If we have more than one board of a given type we need to be able to specify the board_id to select which specific board that the pyocd command should target. Introduce an environment variable PYOCD_BOARD_ID to we can set that will get passed to the pyocd command that needs it. Here's an example: $ make -C samples/hello_world/ BOARD=frdm_k64f flash PYOCD_BOARD_ID=1234 Signed-off-by: Kumar Gala --- scripts/support/pyocd.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/support/pyocd.sh b/scripts/support/pyocd.sh index 11f4fdc1203..be9fcc0d638 100755 --- a/scripts/support/pyocd.sh +++ b/scripts/support/pyocd.sh @@ -9,6 +9,11 @@ BIN_NAME=${O}/${KERNEL_BIN_NAME} ELF_NAME=${O}/${KERNEL_ELF_NAME} GDB_PORT=${GDB_PORT:-3333} +PYOCD_BOARD_ID_ARG="" +if [ -n "${PYOCD_BOARD_ID}" ]; then + PYOCD_BOARD_ID_ARG="-b ${PYOCD_BOARD_ID}" +fi + test_config() { if ! which ${PYOCD_FLASHTOOL} >/dev/null 2>&1; then echo "Error: Unable to locate pyOCD flash tool: ${PYOCD_FLASHTOOL}" @@ -33,7 +38,7 @@ do_flash() { # flash device with specified image echo "Flashing Target Device" - ${PYOCD_FLASHTOOL} -t ${PYOCD_TARGET} ${BIN_NAME} + ${PYOCD_FLASHTOOL} -t ${PYOCD_TARGET} ${PYOCD_BOARD_ID_ARG} ${BIN_NAME} } @@ -59,7 +64,7 @@ do_debugserver() { SETSID= fi echo "pyOCD GDB server running on port ${GDB_PORT}" - ${SETSID} ${PYOCD_GDBSERVER} -p ${GDB_PORT} -t ${PYOCD_TARGET} + ${SETSID} ${PYOCD_GDBSERVER} -p ${GDB_PORT} -t ${PYOCD_TARGET} ${PYOCD_BOARD_ID_ARG} } CMD="$1"