embassy/examples/boot/bootloader/stm32-dual-bank
Dario Nieuwenhuis 999a2ad829 Fix all check-cfg errors in the entire repo.
the main ci.sh now passes if running with nightly.
2024-05-31 21:54:42 +02:00
..
src feat: enhance bootloader for multiple flash support 2024-02-06 16:25:45 +01:00
build.rs feat: enhance bootloader for multiple flash support 2024-02-06 16:25:45 +01:00
Cargo.toml Fix all check-cfg errors in the entire repo. 2024-05-31 21:54:42 +02:00
memory.x feat: enhance bootloader for multiple flash support 2024-02-06 16:25:45 +01:00
README.md Fix spelling and white space mistakes 2024-04-11 19:45:38 +00:00

STM32 dual-bank flash Bootloader

Overview

This bootloader leverages embassy-boot to interact with the flash. This example targets STM32 devices with dual-bank flash memory, with a primary focus on the STM32H747XI series. Users must modify the memory.x configuration file to match with the memory layout of their specific STM32 device.

Additionally, this example can be extended to utilize external flash memory, such as QSPI, for storing partitions.

Memory Configuration

In this example's memory.x file, various symbols are defined to assist in effective memory management within the bootloader environment. For dual-bank STM32 devices, it's crucial to assign these symbols correctly to their respective memory banks.

Symbol Definitions

The bootloader's state and active symbols are anchored to the flash origin of bank 1:

  • __bootloader_state_start and __bootloader_state_end
  • __bootloader_active_start and __bootloader_active_end

In contrast, the Device Firmware Upgrade (DFU) symbols are aligned with the DFU flash origin in bank 2:

  • __bootloader_dfu_start and __bootloader_dfu_end
__bootloader_state_start = ORIGIN(BOOTLOADER_STATE) - ORIGIN(**FLASH**);
__bootloader_state_end = ORIGIN(BOOTLOADER_STATE) + LENGTH(BOOTLOADER_STATE) - ORIGIN(**FLASH**);

__bootloader_active_start = ORIGIN(ACTIVE) - ORIGIN(**FLASH**);
__bootloader_active_end = ORIGIN(ACTIVE) + LENGTH(ACTIVE) - ORIGIN(**FLASH**);

__bootloader_dfu_start = ORIGIN(DFU) - ORIGIN(**DFU**);
__bootloader_dfu_end = ORIGIN(DFU) + LENGTH(DFU) - ORIGIN(**DFU**);

Flashing the Bootloader

To flash the bootloader onto your STM32H747XI device, use the following command:

cargo flash --features embassy-stm32/stm32h747xi-cm7 --release --chip STM32H747XIHx