How to flash a HEX file over UART using a custom bootloader without STM32CubeProgrammer, ST-LINK, or IDE?
Hi everyone,
I am learning STM32 bootloader development and I would appreciate some guidance.
Hardware
-
STM32 Nucleo-G431RB
-
Windows PC
-
USB-to-TTL UART converter
-
UART communication
Requirement
I already have an application HEX file.
My goal is to update the firmware through UART using a custom bootloader.
I do not want to use:
-
STM32CubeIDE
-
ST-LINK
-
STM32CubeProgrammer
-
Any IDE during firmware update
The complete firmware update should happen only through UART.
What I want to achieve
PC
↓
Application (my own program)
↓
UART (TTL)
↓
Custom Bootloader
↓
STM32 Flash Memory
↓
Jump to Application
Questions
-
What should be my first step to implement this?
-
Should my PC application send the HEX file directly, or should it first convert it into BIN?
-
Should the bootloader parse Intel HEX records, or is it better to send binary data?
-
What communication protocol is commonly used for custom UART bootloaders?
-
Packet format
-
Start byte
-
Length
-
CRC
-
ACK/NACK
-
-
What is the recommended flash memory layout for:
-
Bootloader
-
Application
-
-
How should the bootloader erase and program flash safely?
-
How should the bootloader verify that the application is valid before jumping?
-
Is there any official ST example implementing a custom UART bootloader?
-
Are there any recommended application notes or example projects for this implementation?
My objective is to understand the entire firmware update process from scratch rather than simply using STM32CubeProgrammer.
Any architecture diagrams, sample projects, or best practices would be greatly appreciated.
Thank you.
