Skip to main content
Associate
June 30, 2026
Question

How to flash a HEX file over UART using a custom bootloader without STM32CubeProgrammer, ST-LINK, or IDE?

  • June 30, 2026
  • 3 replies
  • 15 views

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

  1. What should be my first step to implement this?

  2. Should my PC application send the HEX file directly, or should it first convert it into BIN?

  3. Should the bootloader parse Intel HEX records, or is it better to send binary data?

  4. What communication protocol is commonly used for custom UART bootloaders?

    • Packet format

    • Start byte

    • Length

    • CRC

    • ACK/NACK

  5. What is the recommended flash memory layout for:

    • Bootloader

    • Application

  6. How should the bootloader erase and program flash safely?

  7. How should the bootloader verify that the application is valid before jumping?

  8. Is there any official ST example implementing a custom UART bootloader?

  9. 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.

3 replies

mƎALLEm
ST Technical Moderator
June 30, 2026

Hello,

1- Custom bootloader related questions need to be posted in “STM32 MCUs Embedded software” forum board nothing related to the hardware.

I move this post to the correct forum board.

2- Please refer to this application note: AN4657 “STM32 in-application programming (IAP) using the USART”

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
ST Technical Moderator
June 30, 2026

Hello ​@AnnapoornaMV 

Please refer to the example IAP in STM32CubeF7.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Saket_Om
Andrew Neil
Super User
June 30, 2026

Note that sending an Intel Hex file is generally A Bad Idea - because you then have to code a fully-compliant Intel Hex decoder.

Many similar projects have come unstuck due to a poorly-implemented Intel Hex decoder.

The last thing you want is bugs in your bootloader!

 

Therefore it’s generally better to use a binary file - which is what the examples mentioned by ​@mƎALLEm and ​@Saket_Om do.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.