This is an automated email from the ASF dual-hosted git repository. janc pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit ca384dbcd6a10ddc25006f0a6fa3c3ad80a2f393 Author: Jerzy Kasenberg <[email protected]> AuthorDate: Fri Mar 29 10:28:38 2024 +0100 scripts/debug: Update debug scripts for Windows Current mingw or gitbash shells work exactly line Linux counter parts there is no need to use $COMSPEC /C start ... any more So debug code is same for all platforms. Executable names differ for jlink though. Signed-off-by: Jerzy Kasenberg <[email protected]> --- hw/scripts/jlink.sh | 28 +++++++--------------------- hw/scripts/pyocd.sh | 42 ++++++++++++++---------------------------- hw/scripts/stlink.sh | 42 ++++++++++++++---------------------------- 3 files changed, 35 insertions(+), 77 deletions(-) diff --git a/hw/scripts/jlink.sh b/hw/scripts/jlink.sh index aa08b508c..75f29ffc9 100755 --- a/hw/scripts/jlink.sh +++ b/hw/scripts/jlink.sh @@ -163,20 +163,12 @@ jlink_debug() { echo "Debugging" $FILE_NAME if [ -z $JLINK_TARGET_HOST ]; then - if [ $WINDOWS -eq 1 ]; then - # - # Launch jlink server in a separate command interpreter, to make - # sure it doesn't get killed by Ctrl-C signal from bash. - # - $COMSPEC /C "start $COMSPEC /C $JLINK_GDB_SERVER -device $JLINK_DEV -speed 4000 -if SWD -port $PORT -singlerun $EXTRA_JTAG_CMD" - else - # - # Block Ctrl-C from getting passed to jlink server. - # - set -m - $JLINK_GDB_SERVER -device $JLINK_DEV -speed 4000 -if SWD -port $PORT -singlerun $EXTRA_JTAG_CMD > /dev/null & - set +m - fi + # + # Block Ctrl-C from getting passed to jlink server. + # + set -m + $JLINK_GDB_SERVER -device $JLINK_DEV -speed 4000 -if SWD -port $PORT -singlerun $EXTRA_JTAG_CMD > /dev/null & + set +m fi echo "$JLINK_TARGET_CMD" > $GDB_CMD_FILE @@ -187,13 +179,7 @@ jlink_debug() { fi echo "$EXTRA_GDB_CMDS" >> $GDB_CMD_FILE - if [ $WINDOWS -eq 1 ]; then - FILE_NAME=`echo $FILE_NAME | sed 's/\//\\\\/g'` - $COMSPEC /C "start $COMSPEC /C arm-none-eabi-gdb -x $GDB_CMD_FILE $FILE_NAME" - else - $GDB -x $GDB_CMD_FILE $FILE_NAME - rm $GDB_CMD_FILE - fi + $GDB -x $GDB_CMD_FILE $FILE_NAME else $JLINK_GDB_SERVER -device $JLINK_DEV -speed 4000 -if SWD -port $PORT -singlerun $EXTRA_JTAG_CMD fi diff --git a/hw/scripts/pyocd.sh b/hw/scripts/pyocd.sh index 60f1c36ef..07355bd3a 100755 --- a/hw/scripts/pyocd.sh +++ b/hw/scripts/pyocd.sh @@ -92,22 +92,13 @@ pyocd_debug () { exit 1 fi - if [ $WINDOWS -eq 1 ]; then - # - # Launch openocd in a separate command interpreter, to make sure - # it doesn't get killed by Ctrl-C signal from bash. - # - - $COMSPEC /C "start $COMSPEC /C pyocd gdbserver -M $CONNECTION_MODE -t $TARGET -p $PORT" - else - # - # Block Ctrl-C from getting passed to openocd. - # - set -m - pyocd gdbserver -M $CONNECTION_MODE -t $TARGET -p $PORT >pyocd.log 2>&1 & - stpid=$! - set +m - fi + # + # Block Ctrl-C from getting passed to pyocd. + # + set -m + pyocd gdbserver -M $CONNECTION_MODE -t $TARGET -p $PORT >pyocd.log 2>&1 & + stpid=$! + set +m GDB_CMD_FILE=.gdb_cmds @@ -118,18 +109,13 @@ pyocd_debug () { echo "$EXTRA_GDB_CMDS" >> $GDB_CMD_FILE - if [ $WINDOWS -eq 1 ]; then - FILE_NAME=`echo $FILE_NAME | sed 's/\//\\\\/g'` - $COMSPEC /C "start $COMSPEC /C $GDB -x $GDB_CMD_FILE $FILE_NAME" - else - set -m - $GDB -x $GDB_CMD_FILE $FILE_NAME - set +m - rm $GDB_CMD_FILE - sleep 1 - if [ -d /proc/$stpid ] ; then - kill -9 $stpid - fi + set -m + $GDB -x $GDB_CMD_FILE $FILE_NAME + set +m + rm $GDB_CMD_FILE + sleep 1 + if [ -d /proc/$stpid ] ; then + kill -9 $stpid fi else # No GDB, wait for pyocd to exit diff --git a/hw/scripts/stlink.sh b/hw/scripts/stlink.sh index aec5e1d40..d4bf9589b 100755 --- a/hw/scripts/stlink.sh +++ b/hw/scripts/stlink.sh @@ -72,22 +72,13 @@ stlink_debug () { exit 1 fi - if [ $WINDOWS -eq 1 ]; then - # - # Launch openocd in a separate command interpreter, to make sure - # it doesn't get killed by Ctrl-C signal from bash. - # - - $COMSPEC /C "start $COMSPEC /C st-util --no-reset -p $PORT" - else - # - # Block Ctrl-C from getting passed to openocd. - # - set -m - st-util --no-reset -p $PORT >stlink.log 2>&1 & - stpid=$! - set +m - fi + # + # Block Ctrl-C from getting passed to st-util. + # + set -m + st-util --no-reset -p $PORT >stlink.log 2>&1 & + stpid=$! + set +m GDB_CMD_FILE=.gdb_cmds @@ -98,18 +89,13 @@ stlink_debug () { echo "$EXTRA_GDB_CMDS" >> $GDB_CMD_FILE - if [ $WINDOWS -eq 1 ]; then - FILE_NAME=`echo $FILE_NAME | sed 's/\//\\\\/g'` - $COMSPEC /C "start $COMSPEC /C $GDB -x $GDB_CMD_FILE $FILE_NAME" - else - set -m - $GDB -x $GDB_CMD_FILE $FILE_NAME - set +m - rm $GDB_CMD_FILE - sleep 1 - if [ -d /proc/$stpid ] ; then - kill -9 $stpid - fi + set -m + $GDB -x $GDB_CMD_FILE $FILE_NAME + set +m + rm $GDB_CMD_FILE + sleep 1 + if [ -d /proc/$stpid ] ; then + kill -9 $stpid fi else # No GDB, wait for st-util to exit
