A universal BOOT compatible with the entire STM32 series using a single BIN file
This article is contributed by flyboy
Written in Zig, this is a universal BootLoader that adapts a single BIN file for all STM32 series!!
Code repository:
● GitHub: https://github.com/puppy-rtos/stm32-zboot
● Gitee: https://gitee.com/puppy-rtos/stm32-zboot
Feature Highlights:
● Automatic detection of chip architecture and on-chip flash capacity
● Supports configuration of UART and SPI pin information
● Supports firmware verification via CRC and hash checks
● Uses FastLZ compression for firmware by default
● Supports SPI Flash with automatic detection of model and capacity
● Comes with a configuration tool: supports generating boot images, packaging update bundles, and creating test applications
● Very small firmware size, only 14.6KB
Leveraging Zig’s powerful performance and cross-platform build capabilities, zboot strikes a good balance between functionality and firmware size!
Usage Instructions:
Below is an example of how to use zboot with the Xinghuo-1 development board (main control: STM32F407).
1. Download zboot tool
https://gitee.com/puppy-rtos/stm32-zboot/releases/tag/v0.0.6
Currently, binary packages are provided for Linux and Windows. MAC users can compile from source.
2. Generate stm32-zboot.bin
Use the zboot tool to generate the corresponding stm32-zboot.bin and config.json configuration file. Simply run the command `zboot boot`, and these two files will be generated automatically, as shown below:
● stm32-zboot.bin: A universal boot image for the entire STM32 series, which needs to be downloaded to the chip’s start address.
● config.json: The STM32 boot configuration file used to set parameters for the boot file. The meaning of specific parameters can be seen in the image 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 in stm32-zboot.bin.
Here is my modified configuration file.
Burn the configured stm32-zboot.bin to the development board, and you will be able to see the startup information through the configured UART pins.
3. Testing Boot Functionality
Use the command `zboot app` to generate a test application firmware.
The default generated `app.bin` has a load address of 0x08008000. If you need to generate a test application for a different address, you must modify the project source code and recompile.
Burn the test firmware to the address 0x08008000, then restart the hardware to test whether the jump is functioning correctly.
zboot natively integrates SFUD functionality, which will automatically detect external Flash. If the hardware includes an external SPI Flash, you can also modify the pin configurations in the configuration file and enable the external Flash. RT-Spark:aliexpress.com/item/1005008704008478.html