From ac06dd9dada2de0513d6d0b93246116e9763496e Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Wed, 31 Jan 2018 22:41:38 +0100 Subject: [PATCH] Update scripts to be aligned with Arduino_STM32 tools Serial_upload: speed change to 115200 https://github.com/LightningStalker/Arduino_STM32/pull/1 Maple rules: https://github.com/rogerclarkmelbourne/Arduino_STM32/commit/ed82be4c6e4fbd1e6b393fdd598e36f62cd9d22d Maple_upload: https://github.com/rogerclarkmelbourne/Arduino_STM32/commit/437834a91fafc15bac2f24b9e889ddd259e86a72#diff-a0a50ec8cd3ccc8618dcd0dbf108becc https://github.com/rogerclarkmelbourne/Arduino_STM32/commit/9b03f0841d35bdb848701f684c8a85a92dec24e5 Signed-off-by: Frederic.Pillon --- linux/45-maple.rules | 4 ++-- linux/maple_upload | 9 +++++++++ linux/serial_upload | 2 +- linux64/maple_upload | 9 +++++++++ linux64/serial_upload | 2 +- linux64/stlink_upload | 2 -- macosx/maple_upload | 9 +++++++++ macosx/serial_upload | 2 +- win/maple_upload.bat | 10 ++++++++++ win/serial_upload.bat | 2 +- 10 files changed, 43 insertions(+), 8 deletions(-) diff --git a/linux/45-maple.rules b/linux/45-maple.rules index d1bda5fb..e53d9690 100644 --- a/linux/45-maple.rules +++ b/linux/45-maple.rules @@ -1,5 +1,5 @@ ATTRS{idProduct}=="1001", ATTRS{idVendor}=="0110", MODE="664", GROUP="plugdev" ATTRS{idProduct}=="1002", ATTRS{idVendor}=="0110", MODE="664", GROUP="plugdev" -ATTRS{idProduct}=="0003", ATTRS{idVendor}=="1eaf", MODE="664", GROUP="plugdev" SYMLINK+="maple" -ATTRS{idProduct}=="0004", ATTRS{idVendor}=="1eaf", MODE="664", GROUP="plugdev" SYMLINK+="maple" +ATTRS{idProduct}=="0003", ATTRS{idVendor}=="1eaf", MODE="664", GROUP="plugdev" SYMLINK+="maple", ENV{ID_MM_DEVICE_IGNORE}="1" +ATTRS{idProduct}=="0004", ATTRS{idVendor}=="1eaf", MODE="664", GROUP="plugdev" SYMLINK+="maple", ENV{ID_MM_DEVICE_IGNORE}="1" diff --git a/linux/maple_upload b/linux/maple_upload index e799f3a9..50d2ae55 100755 --- a/linux/maple_upload +++ b/linux/maple_upload @@ -38,3 +38,12 @@ if [ ! -x "${DFU_UTIL}" ]; then fi "${DFU_UTIL}" -d ${usbID} -a ${altID} -D ${binfile} ${dfuse_addr} -R + +echo -n Waiting for ${dummy_port_fullpath} serial... + +COUNTER=0 +while [ ! -r ${dummy_port_fullpath} ] && ((COUNTER++ < 40)); do + sleep 0.1 +done + +echo Done diff --git a/linux/serial_upload b/linux/serial_upload index 05d17c6e..4d0a386c 100755 --- a/linux/serial_upload +++ b/linux/serial_upload @@ -1,2 +1,2 @@ #!/bin/bash -$(dirname $0)/stm32flash/stm32flash -g 0x8000000 -b 230400 -w "$4" /dev/"$1" +$(dirname $0)/stm32flash/stm32flash -g 0x8000000 -b 115200 -w "$4" /dev/"$1" diff --git a/linux64/maple_upload b/linux64/maple_upload index e799f3a9..27e006c2 100755 --- a/linux64/maple_upload +++ b/linux64/maple_upload @@ -38,3 +38,12 @@ if [ ! -x "${DFU_UTIL}" ]; then fi "${DFU_UTIL}" -d ${usbID} -a ${altID} -D ${binfile} ${dfuse_addr} -R + +echo -n Waiting for ${dummy_port_fullpath} serial... + +COUNTER=0 +while [ ! -c ${dummy_port_fullpath} ] && ((COUNTER++ < 40)); do + sleep 0.1 +done + +echo Done \ No newline at end of file diff --git a/linux64/serial_upload b/linux64/serial_upload index 05d17c6e..4d0a386c 100755 --- a/linux64/serial_upload +++ b/linux64/serial_upload @@ -1,2 +1,2 @@ #!/bin/bash -$(dirname $0)/stm32flash/stm32flash -g 0x8000000 -b 230400 -w "$4" /dev/"$1" +$(dirname $0)/stm32flash/stm32flash -g 0x8000000 -b 115200 -w "$4" /dev/"$1" diff --git a/linux64/stlink_upload b/linux64/stlink_upload index 77574101..49d4ddae 100755 --- a/linux64/stlink_upload +++ b/linux64/stlink_upload @@ -3,8 +3,6 @@ LD_LIBRARY_PATH=$(dirname $0)/stlink/lib $(dirname $0)/stlink/st-flash write "$4" 0x8000000 exit 0 -## Remove the lines 2 and 3 (above) if you want this script to wait until the Serial device has been enumerated and loaded before the script exits - # Check for leaf device. function leaf_status() { diff --git a/macosx/maple_upload b/macosx/maple_upload index 8d15eff8..3521aa1e 100755 --- a/macosx/maple_upload +++ b/macosx/maple_upload @@ -51,3 +51,12 @@ if [ ! -x ${DFU_UTIL} ]; then fi ${DFU_UTIL} -d ${usbID} -a ${altID} -D ${binfile} -R ${dfuse_addr} -R + +echo -n Waiting for ${dummy_port_fullpath} serial... + +COUNTER=0 +while [ ! -c ${dummy_port_fullpath} ] && ((COUNTER++ < 40)); do + sleep 0.1 +done + +echo Done diff --git a/macosx/serial_upload b/macosx/serial_upload index 05d17c6e..4d0a386c 100755 --- a/macosx/serial_upload +++ b/macosx/serial_upload @@ -1,2 +1,2 @@ #!/bin/bash -$(dirname $0)/stm32flash/stm32flash -g 0x8000000 -b 230400 -w "$4" /dev/"$1" +$(dirname $0)/stm32flash/stm32flash -g 0x8000000 -b 115200 -w "$4" /dev/"$1" diff --git a/win/maple_upload.bat b/win/maple_upload.bat index 678969c5..7d59bf53 100644 --- a/win/maple_upload.bat +++ b/win/maple_upload.bat @@ -6,3 +6,13 @@ set driverLetter=%driverLetter:~0,2% %driverLetter% cd %~dp0 java -jar maple_loader.jar %1 %2 %3 %4 %5 %6 %7 %8 %9 + +for /l %%x in (1, 1, 40) do ( + ping -w 50 -n 1 192.0.2.1 > nul + mode %1 > nul + if ERRORLEVEL 0 goto comPortFound +) + +echo timeout waiting for %1 serial + +:comPortFound diff --git a/win/serial_upload.bat b/win/serial_upload.bat index d733be74..7252d835 100644 --- a/win/serial_upload.bat +++ b/win/serial_upload.bat @@ -8,7 +8,7 @@ cd %~dp0 rem: the two line below are needed to fix path issues with incorrect slashes before the bin file name set str=%4 set str=%str:/=\% -stm32flash -g 0x8000000 -b 230400 -w %str% %1 +stm32flash -g 0x8000000 -b 115200 -w %str% %1 rem: C:\Python27\python.exe stm32loader.py -e -w -p %1 -g -b 115200 %str% rem: ------------- use STM's own uploader