From 9c390d7655772dc5983624f71c22c17b9f9fa9c1 Mon Sep 17 00:00:00 2001 From: Maureen Helm Date: Tue, 19 Sep 2017 16:35:54 -0500 Subject: [PATCH] scripts: Add support for passing daparg argument to pyocd commands pyocd occasionally throws USB timeout exceptions when running in VirtualBox, and recently added a command-line option to limit the USB packet count as a workaround. Introduce an environment variable PYOCD_DAPARG so Zephyr can pass the argument to pyocd. For example: $ make BOARD=frdm_k64f PYOCD_DAPARG='limit_packets=True' flash This workound comes with a performance penalty when flashing and debugging with pyocd, so it should only be used when running pyocd in VirtualBox. Signed-off-by: Maureen Helm --- scripts/support/pyocd.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/support/pyocd.sh b/scripts/support/pyocd.sh index be9fcc0d63..57b11f206c 100755 --- a/scripts/support/pyocd.sh +++ b/scripts/support/pyocd.sh @@ -14,6 +14,11 @@ if [ -n "${PYOCD_BOARD_ID}" ]; then PYOCD_BOARD_ID_ARG="-b ${PYOCD_BOARD_ID}" fi +PYOCD_DAPARG_ARG="" +if [ -n "${PYOCD_DAPARG}" ]; then + PYOCD_DAPARG_ARG="-da ${PYOCD_DAPARG}" +fi + test_config() { if ! which ${PYOCD_FLASHTOOL} >/dev/null 2>&1; then echo "Error: Unable to locate pyOCD flash tool: ${PYOCD_FLASHTOOL}" @@ -38,7 +43,8 @@ do_flash() { # flash device with specified image echo "Flashing Target Device" - ${PYOCD_FLASHTOOL} -t ${PYOCD_TARGET} ${PYOCD_BOARD_ID_ARG} ${BIN_NAME} + ${PYOCD_FLASHTOOL} ${PYOCD_DAPARG_ARG} -t ${PYOCD_TARGET} \ + ${PYOCD_BOARD_ID_ARG} ${BIN_NAME} } @@ -64,7 +70,8 @@ do_debugserver() { SETSID= fi echo "pyOCD GDB server running on port ${GDB_PORT}" - ${SETSID} ${PYOCD_GDBSERVER} -p ${GDB_PORT} -t ${PYOCD_TARGET} ${PYOCD_BOARD_ID_ARG} + ${SETSID} ${PYOCD_GDBSERVER} ${PYOCD_DAPARG_ARG} -p ${GDB_PORT} \ + -t ${PYOCD_TARGET} ${PYOCD_BOARD_ID_ARG} } CMD="$1"