From e5835698417d65a3ff642feb8ef8b280689a52be Mon Sep 17 00:00:00 2001 From: dhineshkumarmcci Date: Tue, 19 Oct 2021 16:04:55 +0530 Subject: [PATCH 1/2] fix #180: missed substitution for VIDPID --- tools/linux/stm32l0-upload | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/linux/stm32l0-upload b/tools/linux/stm32l0-upload index 551254c1d5..24ebde91de 100755 --- a/tools/linux/stm32l0-upload +++ b/tools/linux/stm32l0-upload @@ -27,6 +27,7 @@ function _usage { TOOLDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd) +# VIDPID is either empty or has a trailing comma. VIDPID= if [[ "$1" != "-" ]]; then if [[ "$2" != "-" ]]; then @@ -78,6 +79,7 @@ fi if [[ $VERBOSE -ne 0 ]]; then echo "Program file: $FILE" + # VIDPID is either empty or has a trailing comma. Strip the trailing comma for display echo "Board VID:PID: ${VIDPID%,}" echo "Base address: $BASEADDR" if [[ "$BOOTLOADER" != "-" ]]; then @@ -113,13 +115,15 @@ fi # upload if [[ "$BOOTLOADER" != "-" ]]; then # upload the bootloader, and leave in upload mode. - if ! "$TOOLDIR"/dfu-util -d "VIDPID"0x0483:0xdf11 -a 0 -s 0x08000000 -D "$BOOTLOADER"; then + # VIDPID is either empty or has a trailing comma. + if ! "$TOOLDIR"/dfu-util -d "$VIDPID"0x0483:0xdf11 -a 0 -s 0x08000000 -D "$BOOTLOADER"; then echo "bootloader upload failed" exit 1 fi fi -if ! "$TOOLDIR"/dfu-util -d "VIDPID"0x0483:0xdf11 -a 0 -s "$BASEADDR:leave" -D "$FILE" ; then +# do the main upload. Again, VIDPID is eitehr empty or has a trailing comma. +if ! "$TOOLDIR"/dfu-util -d "$VIDPID"0x0483:0xdf11 -a 0 -s "$BASEADDR:leave" -D "$FILE" ; then echo "main upload failed" exit 1 fi From 03a05ab8d5d0b79241fc2cef242934f48b6b9069 Mon Sep 17 00:00:00 2001 From: dhineshkumarmcci Date: Tue, 19 Oct 2021 16:27:19 +0530 Subject: [PATCH 2/2] fix typo in error message --- tools/linux/stm32l0-upload | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/linux/stm32l0-upload b/tools/linux/stm32l0-upload index 24ebde91de..9f724379ea 100755 --- a/tools/linux/stm32l0-upload +++ b/tools/linux/stm32l0-upload @@ -36,7 +36,7 @@ if [[ "$1" != "-" ]]; then _usage "First two args are vid/pid; both must be '-' if either is" fi elif [[ "$2" != "-" ]]; then - _usage "First two args are vid/pid; bost must be '-' if either is" + _usage "First two args are vid/pid; both must be '-' if either is" fi FILE="$3"