Skip to content

Commit

Permalink
STM32-OTA ver1.0
Browse files Browse the repository at this point in the history
Use ESP8266, to OTA flash STM32 MCU on Arduino IDE
  • Loading branch information
csnol committed Dec 20, 2017
1 parent 02bf818 commit 3797997
Show file tree
Hide file tree
Showing 32 changed files with 1,006 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Please add below lines to the end of your $path/STM32F1/boards.txt
# you can change 'BluePill' to you wanted for flash others STM32 serial MCUs
# STM32 OTA uploader ---- added by CSNOL
Nucleo_32.menu.upload_method.stm32_ota=STM32 OTA
Nucleo_32.menu.upload_method.stm32_ota.upload.protocol=stm32_ota
Nucleo_32.menu.upload_method.stm32_ota.upload.tool=stm32_ota
Nucleo_32.menu.upload_method.stm32_ota.upload.IPAddress=http://192.168.0.66 # Change to your ESP8266 board's IPAddress
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Please add below lines to the end of your platform.txt
# Upload using STM32 OTA over HTTPServer added by CSNOL
tools.stm32_ota.cmd=stm32_ota
tools.stm32_ota.path.macosx={runtime.hardware.path}/tools/macosx
tools.stm32_ota.path.linux={runtime.hardware.path}/tools/linux
tools.stm32_ota.path.linux64={runtime.hardware.path}/tools/linux64
tools.stm32_ota.upload.params.verbose=-d
tools.stm32_ota.upload.params.quiet=
tools.stm32_ota.upload.pattern="{path}/{cmd}" {upload.IPAddress} "{build.path}/{build.project_name}.bin"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Please add below lines to the end of your $path/STM32F1/boards.txt
# you can change 'BluePill' to you wanted for flash others STM32 serial MCUs
# STM32 OTA uploader ---- added by CSNOL
Nucleo_32.menu.upload_method.stm32_ota=STM32 OTA
Nucleo_32.menu.upload_method.stm32_ota.upload.protocol=stm32_ota
Nucleo_32.menu.upload_method.stm32_ota.upload.tool=stm32_ota
Nucleo_32.menu.upload_method.stm32_ota.upload.IPAddress=http://192.168.0.66 # Change to your ESP8266 board's IPAddress
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Please add below lines to the end of your platform.txt
# Upload using STM32 OTA over HTTPServer added by CSNOL
tools.stm32_ota.cmd=stm32_ota
tools.stm32_ota.path.macosx={runtime.hardware.path}/tools/macosx
tools.stm32_ota.path.linux={runtime.hardware.path}/tools/linux
tools.stm32_ota.path.linux64={runtime.hardware.path}/tools/linux64
tools.stm32_ota.upload.params.verbose=-d
tools.stm32_ota.upload.params.quiet=
tools.stm32_ota.upload.pattern="{path}/{cmd}" {upload.IPAddress} "{build.path}/{build.project_name}.bin"
35 changes: 35 additions & 0 deletions Arduino15/packages/STM32/tools/linux/stm32_ota
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

set -e

if [ $# -lt 2 ]; then
echo "Usage: $0 $# <IPAddress> <binfile>" >&2
exit 1
fi
IPAddress=$1; binfile=$2; otaList="$1/list"; otaDelete="$1/delete"; otaUpload="$1/upload"; otaErase="$1/erase"; otaProgramm="$1/programm"; otaRun="$1/run";
otaBin="file=@/tmp/upload.bin"
srBin="/tmp/upload.bin"


curl -o /dev/null ${IPAddress} # 初始化并进入上传状态 STM32 INIT
echo -e "\n STM32 init OK!"
sleep 0.1
curl -o /dev/null ${otaDelete} # 清空缓存bin文件 Clear bin files cache
echo -e "\n Clear cached bin files OK!"
sleep 0.1
cp ${binfile} ${srBin}
curl -o /dev/null -F ${otaBin} ${otaUpload} # 上传Bin文件 Upload bin file to cache
echo -e "\n Upload $2 to $1 cachespace OK!"
sleep 0.1
rm ${srBin}
curl -o /dev/null ${otaErase} # 清除STM32芯片flash Erase STM32 flash
echo -e "\n Erase STM32 flash OK!"
sleep 0.1
curl -o /dev/null ${otaProgramm} # 烧录STM32 Upload bin file STM32 flash
echo -e "\n Write STM32 flash OK!"
sleep 0.1
curl -o /dev/null ${otaRun} # 运行STM32 Run STM32
echo -e "\n STM32 Running!"


echo Done
35 changes: 35 additions & 0 deletions Arduino15/packages/STM32/tools/linux64/stm32_ota
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

set -e

if [ $# -lt 2 ]; then
echo "Usage: $0 $# <IPAddress> <binfile>" >&2
exit 1
fi
IPAddress=$1; binfile=$2; otaList="$1/list"; otaDelete="$1/delete"; otaUpload="$1/upload"; otaErase="$1/erase"; otaProgramm="$1/programm"; otaRun="$1/run";
otaBin="file=@/tmp/upload.bin"
srBin="/tmp/upload.bin"


curl -o /dev/null ${IPAddress} # 初始化并进入上传状态 STM32 INIT
echo -e "\n STM32 init OK!"
sleep 0.1
curl -o /dev/null ${otaDelete} # 清空缓存bin文件 Clear bin files cache
echo -e "\n Clear cached bin files OK!"
sleep 0.1
cp ${binfile} ${srBin}
curl -o /dev/null -F ${otaBin} ${otaUpload} # 上传Bin文件 Upload bin file to cache
echo -e "\n Upload $2 to $1 cachespace OK!"
sleep 0.1
rm ${srBin}
curl -o /dev/null ${otaErase} # 清除STM32芯片flash Erase STM32 flash
echo -e "\n Erase STM32 flash OK!"
sleep 0.1
curl -o /dev/null ${otaProgramm} # 烧录STM32 Upload bin file STM32 flash
echo -e "\n Write STM32 flash OK!"
sleep 0.1
curl -o /dev/null ${otaRun} # 运行STM32 Run STM32
echo -e "\n STM32 Running!"


echo Done
35 changes: 35 additions & 0 deletions Arduino15/packages/STM32/tools/macosx/stm32_ota
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

set -e

if [ $# -lt 2 ]; then
echo "Usage: $0 $# <IPAddress> <binfile>" >&2
exit 1
fi
IPAddress=$1; binfile=$2; otaList="$1/list"; otaDelete="$1/delete"; otaUpload="$1/upload"; otaErase="$1/erase"; otaProgramm="$1/programm"; otaRun="$1/run";
otaBin="file=@/tmp/upload.bin"
srBin="/tmp/upload.bin"


curl -o /dev/null ${IPAddress} # 初始化并进入上传状态 STM32 INIT
echo -e "\n STM32 init OK!"
sleep 0.1
curl -o /dev/null ${otaDelete} # 清空缓存bin文件 Clear bin files cache
echo -e "\n Clear cached bin files OK!"
sleep 0.1
cp ${binfile} ${srBin}
curl -o /dev/null -F ${otaBin} ${otaUpload} # 上传Bin文件 Upload bin file to cache
echo -e "\n Upload $2 to $1 cachespace OK!"
sleep 0.1
rm ${srBin}
curl -o /dev/null ${otaErase} # 清除STM32芯片flash Erase STM32 flash
echo -e "\n Erase STM32 flash OK!"
sleep 0.1
curl -o /dev/null ${otaProgramm} # 烧录STM32 Upload bin file STM32 flash
echo -e "\n Write STM32 flash OK!"
sleep 0.1
curl -o /dev/null ${otaRun} # 运行STM32 Run STM32
echo -e "\n STM32 Running!"


echo Done
7 changes: 7 additions & 0 deletions Arduino_STM32/STM32F1/boards-do-not-copy.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Please add below lines to the end of your $path/STM32F1/boards.txt
# you can change 'genericSTM32F103C' to you want for flash others STM32 serial MCUs
# STM32 OTA uploader ---- added by CSNOL
genericSTM32F103C.menu.upload_method.httpMethod=STM32 OTA
genericSTM32F103C.menu.upload_method.httpMethod.upload.protocol=stm32_ota
genericSTM32F103C.menu.upload_method.httpMethod.upload.tool=stm32_ota
genericSTM32F103C.menu.upload_method.httpMethod.upload.IPAddress=http://192.168.0.66 # Change to your ESP8266 board's IPAddress
9 changes: 9 additions & 0 deletions Arduino_STM32/STM32F1/platform-do-not-copy.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Please add below lines to the end of your platform.txt
# Upload using STM32 OTA over HTTPServer added by CSNOL
tools.stm32_ota.cmd=stm32_ota
tools.stm32_ota.path.macosx={runtime.hardware.path}/tools/macosx
tools.stm32_ota.path.linux={runtime.hardware.path}/tools/linux
tools.stm32_ota.path.linux64={runtime.hardware.path}/tools/linux64
tools.stm32_ota.upload.params.verbose=-d
tools.stm32_ota.upload.params.quiet=
tools.stm32_ota.upload.pattern="{path}/{cmd}" {upload.IPAddress} "{build.path}/{build.project_name}.bin"
35 changes: 35 additions & 0 deletions Arduino_STM32/tools/linux/stm32_ota
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

set -e

if [ $# -lt 2 ]; then
echo "Usage: $0 $# <IPAddress> <binfile>" >&2
exit 1
fi
IPAddress=$1; binfile=$2; otaList="$1/list"; otaDelete="$1/delete"; otaUpload="$1/upload"; otaErase="$1/erase"; otaProgramm="$1/programm"; otaRun="$1/run";
otaBin="file=@/tmp/upload.bin"
srBin="/tmp/upload.bin"


curl -o /dev/null ${IPAddress} # 初始化并进入上传状态 STM32 INIT
echo -e "\n STM32 init OK!"
sleep 0.1
curl -o /dev/null ${otaDelete} # 清空缓存bin文件 Clear bin files cache
echo -e "\n Clear cached bin files OK!"
sleep 0.1
cp ${binfile} ${srBin}
curl -o /dev/null -F ${otaBin} ${otaUpload} # 上传Bin文件 Upload bin file to cache
echo -e "\n Upload $2 to $1 cachespace OK!"
sleep 0.1
rm ${srBin}
curl -o /dev/null ${otaErase} # 清除STM32芯片flash Erase STM32 flash
echo -e "\n Erase STM32 flash OK!"
sleep 0.1
curl -o /dev/null ${otaProgramm} # 烧录STM32 Upload bin file STM32 flash
echo -e "\n Write STM32 flash OK!"
sleep 0.1
curl -o /dev/null ${otaRun} # 运行STM32 Run STM32
echo -e "\n STM32 Running!"


echo Done
35 changes: 35 additions & 0 deletions Arduino_STM32/tools/linux64/stm32_ota
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

set -e

if [ $# -lt 2 ]; then
echo "Usage: $0 $# <IPAddress> <binfile>" >&2
exit 1
fi
IPAddress=$1; binfile=$2; otaList="$1/list"; otaDelete="$1/delete"; otaUpload="$1/upload"; otaErase="$1/erase"; otaProgramm="$1/programm"; otaRun="$1/run";
otaBin="file=@/tmp/upload.bin"
srBin="/tmp/upload.bin"


curl -o /dev/null ${IPAddress} # 初始化并进入上传状态 STM32 INIT
echo -e "\n STM32 init OK!"
sleep 0.1
curl -o /dev/null ${otaDelete} # 清空缓存bin文件 Clear bin files cache
echo -e "\n Clear cached bin files OK!"
sleep 0.1
cp ${binfile} ${srBin}
curl -o /dev/null -F ${otaBin} ${otaUpload} # 上传Bin文件 Upload bin file to cache
echo -e "\n Upload $2 to $1 cachespace OK!"
sleep 0.1
rm ${srBin}
curl -o /dev/null ${otaErase} # 清除STM32芯片flash Erase STM32 flash
echo -e "\n Erase STM32 flash OK!"
sleep 0.1
curl -o /dev/null ${otaProgramm} # 烧录STM32 Upload bin file STM32 flash
echo -e "\n Write STM32 flash OK!"
sleep 0.1
curl -o /dev/null ${otaRun} # 运行STM32 Run STM32
echo -e "\n STM32 Running!"


echo Done
35 changes: 35 additions & 0 deletions Arduino_STM32/tools/macosx/stm32_ota
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

set -e

if [ $# -lt 2 ]; then
echo "Usage: $0 $# <IPAddress> <binfile>" >&2
exit 1
fi
IPAddress=$1; binfile=$2; otaList="$1/list"; otaDelete="$1/delete"; otaUpload="$1/upload"; otaErase="$1/erase"; otaProgramm="$1/programm"; otaRun="$1/run";
otaBin="file=@/tmp/upload.bin"
srBin="/tmp/upload.bin"


curl -o /dev/null ${IPAddress} # 初始化并进入上传状态 STM32 INIT
echo -e "\n STM32 init OK!"
sleep 0.1
curl -o /dev/null ${otaDelete} # 清空缓存bin文件 Clear bin files cache
echo -e "\n Clear cached bin files OK!"
sleep 0.1
cp ${binfile} ${srBin}
curl -o /dev/null -F ${otaBin} ${otaUpload} # 上传Bin文件 Upload bin file to cache
echo -e "\n Upload $2 to $1 cachespace OK!"
sleep 0.1
rm ${srBin}
curl -o /dev/null ${otaErase} # 清除STM32芯片flash Erase STM32 flash
echo -e "\n Erase STM32 flash OK!"
sleep 0.1
curl -o /dev/null ${otaProgramm} # 烧录STM32 Upload bin file STM32 flash
echo -e "\n Write STM32 flash OK!"
sleep 0.1
curl -o /dev/null ${otaRun} # 运行STM32 Run STM32
echo -e "\n STM32 Running!"


echo Done
Loading

0 comments on commit 3797997

Please sign in to comment.