Last edited 7 months ago

STM32CubeMP13 package - boot architecture

Applicable for STM32MP13x lines

1. Article purpose[edit source]

This article explains the boot chain of the STM32CubeMP13 package running on Arm® Cortex®-A7 core.

2. Overview[edit source]

STM32CubeMP13 package boot chain uses FSBLA_Sdmmc1 as the First stage bootloader to load STM32CubeMP13 example present in external flash microSDTM card to DDR memory on STM32MP135x-DK board.

FSBLA_SNOR is provided as an example for STM32MP13XX_CUSTOM_HW and can be a starting point for adaptation to your board for using QSPI-SNOR as a boot device.

The FSBLA_Sdmmc1 application source code is delivered in package and is available in directory Firmware/Projects/STM32MP135C-DK/Applications/FSBLA/FSBLA_Sdmmc1.
Also, its binary, FSBLA_Sdmmc1_A7_Signed.bin, is delivered as a part of external loader package available in directory Firmware/Projects/STM32MP135C-DK/External_Loader/SD_Ext_Loader.

This binary is programmed in microSDTM card via STM32PRGFW_UTIL_MP13xx_CP_Serial_Boot.stm32 in serial boot mode.
On next boot from microSDTM card, it is used to load STM32CubeMP13 example or any test application from microSDTM card to DDR. Refer to How to load and start STM32CubeMP13 applications via microSD card for more explanations.

STM32MP13 boot chain

3. Boot chain components[edit source]

3.1. ROM code[edit source]

The ROM code is a piece of software that takes its name from the read only memory (ROM) where it is stored. It fits in a few tens of Kbytes and maps its data in embedded RAM. It is the first code executed by the processor, and it embeds all the logic needed to select the boot device (serial link or flash) from which the first-stage bootloader (FSBL) is loaded to the embedded RAM.

Most products require to trust the application that is running on the device and the ROM code is the first link in the chain of trust that must be established across all started components: this trust is established by authenticating the FSBL before starting it. In turn, the FSBL and each following component authenticates the next one, up to a level defined by the product manufacturer.

In summary, The ROM code starts the processor in secure mode. It supports the FSBL authentication and decryption.

3.2. First stage bootloader for Arm Cortex-A (FSBLA)[edit source]

The FSBLA is executed from the SYSRAM. This bootloader initializes (part of) the clock tree and the DDR controller. It sets SYSRAM and SDMMC in non-secure.

Info white.png Information
  • FSBLA has to be signed. Otherwise, ROM code is not able to load it into SYSRAM. Refer to signing the application for creating FSBLA signed binary.
  • Each binary image loaded by the ROM code needs to include a specific STM32 header added on top of the binary data.

Finally, the FSBLA reads from boot interface (after re-initializing boot interface SDMMC1.First initialization being done by ROM) and loads STM32CubeMP13 example into the DDR external RAM and jumps to it.

Info white.png Information
  • By default,STM32CubeMP13 example is read from SDMMC @640 logical block address. This can be modified in FSBLA and during programming of example into SD.
Info white.png Information
  • By default,STM32CubeMP13 example is loaded at the beginning of DDR @0xC0000000 address. This can be modified in FSBLA and during STM32CubeMP13 example creation.

3.3. STM32CubeMP13 example[edit source]

The STM32CubeMP13 example is executed from the DDR external RAM. Any STM32CubeMP13 example can be loaded into DDR external RAM if it is properly linked into DDR memory. Refer to build example for DDR and signing the example for more explanations.

4. MicroSDTM card flashlayout constraint[edit source]

To boot a STM32CubeMP13 example from microSDTM card, the card needs to contain these two binaries:

  • FSBLA_Sdmmc1: the first stage bootloader @128 logical block address (LBA). This block address is fixed address from where ROM code brings in the FSBLA.
  • STM32CubeMP13 example: any example linked in DDR. By default, It is @640 logical block address(LBA) and can be modified in FSBLA_SDMMC code.

Both, FSBLA_Sdmmc1 and STM32CubeMP13 example binaries are signed (binaries with image header). Refer to STM32CubeProgrammer signing tool or How to add STM32 header

STM32MP13 microSDTM card layout