Simple Modbus RTU bootloader for STM32F103 (blue pill).
The code is somewhat messy but good enough for POC.
Inspired by this series of articles by SLR:
- Bootloader Basics – Part 1
- Simple STM32F103 Bootloader Implementation – Bootloader Development Tutorial Part 2
- STM32F1 Firmware Update using Custom Bootloader – Bootloader Development Tutorial Part 3
- stm32f103-bootloader -- bootloader
- stm32f103-app -- example application (blink LED)
You can use it with mbloader. There's an explanation of the protocol.
- FreeMODBUS -- BSD-3-Clause
- STM32 LL -- BSD-3-Clause
- CMSIS -- Apache-2.0
STM32CubeIDE -> File -> Import -> Existing Projects into Workspace -> Select root directory
- After reset, the MCU waits 5 seconds for the command to start programming. This is indicated by a rapidly blinking LED.
- If the MCU received the command, programming sequence will be executed.
- If the MCU didn't receive the command, it will jump to the app.
You can use it with the mbloader.
There's an example app. Check the linker file and the system_stm32f1xx.c file (USER_VECT_TAB_ADDRESS and VECT_TAB_OFFSET).
Bootloader occupies the first 16 KB of flash.