Sitemap

A universal BOOT Bin adapted to the full STM32 series

4 min readSep 16, 2025

This article is contributed by Henson from TQSD.

Written in Zig, a single bin file that adapts to the full STM32 series universal BootLoader!

Press enter or click to view image in full size

Code repository:

github: https://github.com/puppy-rtos/stm32-zboot

gitee: https://gitee.com/puppy-rtos/stm32-zboot

Features

Automatically detects chip architecture and on-chip flash capacitySupports configuration of uart and spi pin information

Supports crc and hash verification of firmware

Uses FastLZ compression for firmware by default

Supports SPI Flash, automatically detects model and capacity

Comes with a configuration tool: supports generating boot, packaging update package, generating test app

Firmware size is very small, only 14.6KB

Relying on Zig’s powerful performance and cross-platform build capability, zboot achieves a good balance between functionality and firmware size!

Usage

1. The following uses the Spark-1 development board (main controller: stm32f407) as an example to demonstrate the use of zboot.Download zboot tool

Press enter or click to view image in full size

Currently, binary packages are provided by default for Linux and Windows, and MAC can be obtained through source code compilation.

2. Generate stm32-zboot.bin

Use the zboot tool to generate the corresponding stm32-zboot.bin and config.json configuration file. Run the zboot boot command to generate these two files, as shown below:

Press enter or click to view image in full size

stm32-zboot.bin: a universal boot image for the STM32 series, which needs to be downloaded to the starting address of the chip.

config.json: STM32 boot configuration file, used to configure the parameters of the boot file. The specific meaning of the parameters can be seen in the picture below. You can modify the configuration file according to your hardware parameters. After modification, run the zboot boot command again to update the parameter configuration of stm32-zboot.bin.

The following is the configuration file I modified.

Burn the configured stm32-zboot.bin to the development board, and you can view the startup information through the configured uart pins.

Press enter or click to view image in full size

3. Test boot function

Use the command zboot app to generate a test application firmware.(The default loading address of the generated app.bin is 0x08008000. If you want to generate a test application at another address, you need to modify the project source code and recompile.)

Press enter or click to view image in full size

Burn the test firmware to the address 0x08008000, then restart the hardware to test the normal jump.

Press enter or click to view image in full size

4. Test OTA function

Use the command zboot rbl to package the app firmware. By default, the fastlz algorithm is used to compress the firmware size.

Then burn stm32-app.bin.rbl to the swap partition corresponding address 0x08040000. Restart the hardware, and zboot will automatically complete the application firmware update.

Press enter or click to view image in full size

zboot integrates SFUD function by default, which will automatically detect external flash. If the hardware has external SPI Flash, you can also modify the pin information in the configuration file and enable the external Flash.

Looking forward to your test feedback!!!

--

--

RT-Thread IoT OS
RT-Thread IoT OS

Written by RT-Thread IoT OS

An Open-Source Community-Powered Real-Time Operating System (RTOS) Project! Let’s develop, DIY, create, share, and explore this new IoT World together!

No responses yet