Add stm32 serial upload method which includes bootloader (#180)

This commit is contained in:
Ben Lye
2018-08-10 20:11:32 +01:00
committed by GitHub
parent 2f5252ab88
commit 1647d3d841
14 changed files with 158 additions and 25 deletions

View File

@@ -18,6 +18,9 @@ case "$MULTI_BOARD" in
MULTI_STM32_NO_BOOT)
MULTI_TYPE=stm
;;
MULTI_STM32_WITH_BOOT)
MULTI_TYPE=stm
;;
MULTI_STM32_FLASH_FROM_TX)
MULTI_TYPE=stm
;;

View File

@@ -0,0 +1,20 @@
#!/bin/bash
set -e
port=$1
addr=$2
fwfile=$3
bootloaderfile=$4
uname -m | grep "x86_64" 2>&1 1>/dev/null
if [ $? -eq 0 ]; then
# Do 64-bit stuff
$(dirname $0)/../linux64/stm32flash/stm32flash -o -b 57600 /dev/"$port"
$(dirname $0)/../linux64/stm32flash/stm32flash -v -g 0x8000000 -b 57600 -w "$bootloaderfile" /dev/"$port"
$(dirname $0)/../linux64/stm32flash/stm32flash -v -s 8 -e 0 -g 0x8002000 -b 57600 -w "$fwfile" /dev/"$port"
else
# Do 32-bit stuff
$(dirname $0)/stm32flash/stm32flash -o -b 57600 /dev/"$port"
$(dirname $0)/stm32flash/stm32flash -v -g 0x8000000 -b 57600 -w "$bootloaderfile" /dev/"$port"
$(dirname $0)/stm32flash/stm32flash -v -s 8 -e 0 -g 0x8002000 -b 57600 -w "$fwfile" /dev/"$port"
fi

View File

@@ -18,6 +18,9 @@ case "$MULTI_BOARD" in
MULTI_STM32_NO_BOOT)
MULTI_TYPE=stm
;;
MULTI_STM32_WITH_BOOT)
MULTI_TYPE=stm
;;
MULTI_STM32_FLASH_FROM_TX)
MULTI_TYPE=stm
;;

View File

@@ -0,0 +1,20 @@
#!/bin/bash
set -e
port=$1
addr=$2
fwfile=$3
bootloaderfile=$4
uname -m | grep "x86_64" 2>&1 1>/dev/null
if [ $? -eq 0 ]; then
# Do 64-bit stuff
$(dirname $0)/../linux64/stm32flash/stm32flash -o -b 57600 /dev/"$port"
$(dirname $0)/../linux64/stm32flash/stm32flash -v -g 0x8000000 -b 57600 -w "$bootloaderfile" /dev/"$port"
$(dirname $0)/../linux64/stm32flash/stm32flash -v -s 8 -e 0 -g 0x8002000 -b 57600 -w "$fwfile" /dev/"$port"
else
# Do 32-bit stuff
$(dirname $0)/stm32flash/stm32flash -o -b 57600 /dev/"$port"
$(dirname $0)/stm32flash/stm32flash -v -g 0x8000000 -b 57600 -w "$bootloaderfile" /dev/"$port"
$(dirname $0)/stm32flash/stm32flash -v -s 8 -e 0 -g 0x8002000 -b 57600 -w "$fwfile" /dev/"$port"
fi

View File

@@ -18,6 +18,9 @@ case "$MULTI_BOARD" in
MULTI_STM32_NO_BOOT)
MULTI_TYPE=stm
;;
MULTI_STM32_WITH_BOOT)
MULTI_TYPE=stm
;;
MULTI_STM32_FLASH_FROM_TX)
MULTI_TYPE=stm
;;

View File

@@ -0,0 +1,11 @@
#!/bin/bash
set -e
port=$1
addr=$2
fwfile=$3
bootloaderfile=$4
$(dirname $0)/stm32flash/stm32flash -o -b 57600 /dev/"$port"
$(dirname $0)/stm32flash/stm32flash -v -g 0x8000000 -b 57600 -w "$bootloaderfile" /dev/"$port"
$(dirname $0)/stm32flash/stm32flash -v -s 8 -e 0 -g 0x8002000 -b 57600 -w "$fwfile" /dev/"$port"

View File

@@ -17,6 +17,7 @@ SET SKETCH_PATH=%SKETCH_PATH:"=%
IF %MULTI_BOARD%==MULTI_NO_BOOT SET MULTI_TYPE=avr
IF %MULTI_BOARD%==MULTI_FLASH_FROM_TX SET MULTI_TYPE=avr
IF %MULTI_BOARD%==MULTI_STM32_NO_BOOT SET MULTI_TYPE=stm
IF %MULTI_BOARD%==MULTI_STM32_WITH_BOOT SET MULTI_TYPE=stm
IF %MULTI_BOARD%==MULTI_STM32_FLASH_FROM_TX SET MULTI_TYPE=stm
IF %MULTI_BOARD%==MULTI_ORANGERX SET MULTI_TYPE=orx

View File

@@ -1,27 +1,16 @@
@echo off
rem: Note %~dp0 get path of this batch file
rem: Need to change drive if My Documents is on a drive other than C:
rem Note %~dp0 get path of this batch file
rem Need to change drive if My Documents is on a drive other than C:
set driverLetter=%~dp0
set driverLetter=%driverLetter:~0,2%
%driverLetter%
cd %~dp0
rem: the two line below are needed to fix path issues with incorrect slashes before the bin file name
set str=%3
set str=%str:/=\%
echo stm32flash -v -g %2 -b 57600 -w %str% %1
rem The lines below are needed to fix path issues with incorrect slashes before the bin file name
set fwpath=%3
set fwpath=%fwpath:/=\%
echo stm32flash -v -g %2 -b 57600 -w %fwpath% %1
echo.
stm32flash -v -g %2 -b 57600 -w %str% %1
rem: C:\Python27\python.exe stm32loader.py -e -w -p %1 -g -b 115200 %str%
rem: ------------- use STM's own uploader
rem: ---- Need to remove the COM bit from the comm port as the STM prog just wants the number
set commport=%1
set commportnum=%commport:COM=%
rem: --- The maple board may nee the -i setting to be -i STM32_Med-density_128K or STM32_Med-density_64K
rem: ---- 64 bit version
rem: "%ProgramFiles(x86)%\STMicroelectronics\Software\Flash Loader Demonstrator\STMFlashLoader.exe" -c --pn %commportnum% --br 230400 -i STM32_High-density_256K -e --all -d --fn %str% --a 0x8000000 -r --a 0x8000000
rem: -- 32 bit version
rem: "%ProgramFiles%\STMicroelectronics\Software\Flash Loader Demonstrator\STMFlashLoader.exe" -c --pn %commportnum% --br 230400 -i STM32_Med-density_64K -e --all -d --fn %str% --a 0x8000000 -r --a 0x8000000
stm32flash -v -g %2 -b 57600 -w %fwpath% %1

View File

@@ -0,0 +1,31 @@
@echo off
rem Note %~dp0 get path of this batch file
rem Need to change drive if My Documents is on a drive other than C:
set driverLetter=%~dp0
set driverLetter=%driverLetter:~0,2%
%driverLetter%
cd %~dp0
rem The lines below are needed to fix path issues with incorrect slashes before the bin file name
set fwpath=%3
set fwpath=%fwpath:/=\%
set blpath=%4
set blpath=%blpath:/=\%
rem Erase the flash
echo stm32flash -o -b 57600 %1
stm32flash -o -b 57600 %1
if %errorlevel% neq 0 exit /b %errorlevel%
rem Write the Multi bootloader
echo stm32flash.exe -v -g 0x8000000 -b 57600 -w %blpath% %1
stm32flash.exe -v -g 0x8000000 -b 57600 -w %blpath% %1
if %errorlevel% neq 0 exit /b %errorlevel%
rem Write the Multi firmware
echo stm32flash -v -s 8 -e 0 -g 0x8002000 -b 57600 -w %fwpath% %1
stm32flash -v -s 8 -e 0 -g 0x8002000 -b 57600 -w %fwpath% %1
if %errorlevel% neq 0 exit /b %errorlevel%
echo.