This is an automated email from the ASF dual-hosted git repository.
kasjer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
The following commit(s) were added to refs/heads/master by this push:
new 4c8a91d90 hw/scripts: Fix probe serial number with extra JTAG commands
4c8a91d90 is described below
commit 4c8a91d902edb87d2be9ed08a7efe57eb5633052
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Thu Oct 15 10:18:15 2026 +0200
hw/scripts: Fix probe serial number with extra JTAG commands
stlink_sn() in stlink.sh and stm32_programmer.sh and jlink_sn() in
jlink.sh prepend the probe serial number to EXTRA_JTAG_CMD with the
closing quote misplaced:
EXTRA_JTAG_CMD="sn=$STLINK_SN " $EXTRA_JTAG_CMD
When EXTRA_JTAG_CMD is empty this is a plain assignment and works by
accident. When it is not empty, the shell executes its content as a
command with EXTRA_JTAG_CMD set only in that command's environment.
The serial number is lost, the extra options are run as a command,
and with several probes connected the wrong one may be used.
Move the closing quote to the end so the serial number option is
prepended to the existing extra options.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Jerzy Kasenberg <[email protected]>
---
hw/scripts/jlink.sh | 4 ++--
hw/scripts/stlink.sh | 8 ++++----
hw/scripts/stm32_programmer.sh | 4 ++--
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/hw/scripts/jlink.sh b/hw/scripts/jlink.sh
index 059aaca8d..4fa39d11c 100755
--- a/hw/scripts/jlink.sh
+++ b/hw/scripts/jlink.sh
@@ -36,9 +36,9 @@ jlink_target_cmd () {
jlink_sn () {
if [ -n "$JLINK_SN" ]; then
- EXTRA_JTAG_CMD="-select usb=$JLINK_SN " $EXTRA_JTAG_CMD
+ EXTRA_JTAG_CMD="-select usb=$JLINK_SN $EXTRA_JTAG_CMD"
elif [ -n "$MYNEWT_VAL_MYNEWT_DEBUGGER_SN" ]; then
- EXTRA_JTAG_CMD="-select usb=$MYNEWT_VAL_MYNEWT_DEBUGGER_SN "
$EXTRA_JTAG_CMD
+ EXTRA_JTAG_CMD="-select usb=$MYNEWT_VAL_MYNEWT_DEBUGGER_SN
$EXTRA_JTAG_CMD"
fi
}
diff --git a/hw/scripts/stlink.sh b/hw/scripts/stlink.sh
index 472aec869..0ebe3b946 100755
--- a/hw/scripts/stlink.sh
+++ b/hw/scripts/stlink.sh
@@ -24,15 +24,15 @@
stlink_sn () {
if [ -n "$STLINK_SN" ]; then
if [ "$STLINK_USE_STM32_PROGRAMMER_CLI" == 1 ] ; then
- EXTRA_JTAG_CMD="sn=$STLINK_SN " $EXTRA_JTAG_CMD
+ EXTRA_JTAG_CMD="sn=$STLINK_SN $EXTRA_JTAG_CMD"
else
- EXTRA_JTAG_CMD="--serial $STLINK_SN " $EXTRA_JTAG_CMD
+ EXTRA_JTAG_CMD="--serial $STLINK_SN $EXTRA_JTAG_CMD"
fi
elif [ -n "$MYNEWT_VAL_MYNEWT_DEBUGGER_SN" ]; then
if [ "$STLINK_USE_STM32_PROGRAMMER_CLI" == 1 ] ; then
- EXTRA_JTAG_CMD="sn=$MYNEWT_VAL_MYNEWT_DEBUGGER_SN " $EXTRA_JTAG_CMD
+ EXTRA_JTAG_CMD="sn=$MYNEWT_VAL_MYNEWT_DEBUGGER_SN $EXTRA_JTAG_CMD"
else
- EXTRA_JTAG_CMD="--serial $MYNEWT_VAL_MYNEWT_DEBUGGER_SN "
$EXTRA_JTAG_CMD
+ EXTRA_JTAG_CMD="--serial $MYNEWT_VAL_MYNEWT_DEBUGGER_SN
$EXTRA_JTAG_CMD"
fi
fi
}
diff --git a/hw/scripts/stm32_programmer.sh b/hw/scripts/stm32_programmer.sh
index d01543ddf..a43f1a89b 100755
--- a/hw/scripts/stm32_programmer.sh
+++ b/hw/scripts/stm32_programmer.sh
@@ -23,9 +23,9 @@
#
stlink_sn () {
if [ -n "$STLINK_SN" ]; then
- EXTRA_JTAG_CMD="sn=$STLINK_SN " $EXTRA_JTAG_CMD
+ EXTRA_JTAG_CMD="sn=$STLINK_SN $EXTRA_JTAG_CMD"
elif [ -n "$MYNEWT_VAL_MYNEWT_DEBUGGER_SN" ]; then
- EXTRA_JTAG_CMD="sn=$MYNEWT_VAL_MYNEWT_DEBUGGER_SN " $EXTRA_JTAG_CMD
+ EXTRA_JTAG_CMD="sn=$MYNEWT_VAL_MYNEWT_DEBUGGER_SN $EXTRA_JTAG_CMD"
fi
}