Skip to content

csnol/STM32-OTA

Repository files navigation

STM32-OTA on Arduino IDE (for MacOS and Linux)


With a ESP8266, It can upload sketch to STM32 series MCU on Arduino IDE without any wires.

TESTED: STM32F03xF/K/C/,F103C8/B, (Blue Pill and Black Pill), F103VCT, F107RCT.

If use ESP8266 Pin STM32 MCU if use NodeMCU Pin
RXD PA9 RXD
TXD PA10 TXD
Pin4 BOOT0 D2
Pin5 RST D1
Vcc 3.3 3.3V
GND GND GND
En -> 3.3V

Boards

--- ---


Schematic

1. Use ESP-12E

2. Use NODEMCU


SETUP

1st step -> Flash ESP8266

  1. Download source-codes from HERE
  2. Setup your WiFi and ESP8266 IPAddress to yours

3. upload to ESP8266. Don't know how to Flash ESP8266? [HELP](https://github.com/esp8266/Arduino)

2nd step -> Arduino IDE setup

-> For Arduino_STM32 Repo link

  1. Copy "stm32-ota" to "~/Document/Arduino/hardware/Arduino_STM32/tools/macosx" or linux or linux64, and change it to become executable.
    ~$ sudo chmod +x stm32-ota

  2. Find the file 'platform.txt'. and add below lines to the end of '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"

  1. Please add below lines to the end of your Arduino_STM32 $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

  1. Restart Arduino IDE, you will find STM OTA upload method has been added.

-> For STM32GENERIC Repo link

  1. See upside Arduino_STM32 method.

  2. See upside Arduino_STM32 method.

  3. Please add below lines to the end of your STM32GENERIC $path/STM32/boards.txt

    #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
BluePill.menu.upload_method.httpMethod=STM32 OTA
BluePill.menu.upload_method.httpMethod.upload.protocol=stm32_ota
BluePill.menu.upload_method.httpMethod.upload.tool=stm32_ota
BluePill.menu.upload_method.httpMethod.upload.IPAddress=http://192.168.0.66
# Change to your ESP8266 board's IPAddress

  1. Restart Arduino IDE, you will find STM OTA upload method has been added.

-> For stm32duino Repo link

  • Sameway to setup. but I haven't the ST official board. so can't test it.

-> Now, you can OTA upload to STM32 MCU without any wires!


STM32-OTA on Arduino IDE (for Windows)

THANKS for LEVKOVIGOR


BTW

  • If you just wanna OTA upload a bin file to STM32, please see HERE
  • If you want to keep STM32-bootloader, please change the STM32STADDR in "stm32ota.h"

#define STM32STADDR 0x8000000 // STM32 codes start address, you can change to other address if use custom bootloader: like 0x8002000


TODO:

  1. OTA upload all STM32 series MCU in Arduino IDE.
  2. Make a video upload to Youtube.

LICENSE

Copyright (C) 2017 by CS.NOL . This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, but you have to keep below webserver code in your sketch for sharing.

Version 1.0 by <a style="color:white" href="https://github.com/csnol/STM32-OTA\">CSNOL