Last edited one year ago

STM32 MPU Flash mapping

1 Supported Flash memory technologies[edit source]

The STM32MP15 boards support different kind of Flash memories:

  • SD card on SDMMC interface that is present on EVAL and DISCO boards.
  • eMMC on SDMMC interface that is present on EVAL board only.
  • Serial NOR Flash on Dual QSPI interface, that is present on EVAL board only.
  • NAND Flash on FMC interface, that is present on EVAL board only.

The next section lists all partitions used on STM32MP15 boards (size, name, content) and the following sections shows how they are mapped on the different types of Flash memories.

2 Flash partitions[edit source]

The tables below list the partitions defined for STMP32MP15 boards.

2.1 Minimal[edit source]

Size Component Comment
Remaining area userfs The user file system contains user data and examples
768 MB rootfs Linux root file system contains all user space binaries (executable, libraries, …) and kernel modules
16 MB vendorfs This partition is preferred to the rootfs to put third parties proprietary binaries and ensure that they are not contaminated by any open source licence, such as GPL v3
64 MB bootfs The boot file system contains:
  • (option) the init ram file system, that can be copied to the external RAM and used by Linux before mounting a fatter rootfs
  • Linux kernel device tree (can be in a Flattened Image Tree - FIT)
  • Linux kernel U-Boot image (can be in a Flattened Image Tree - FIT)
  • For all flashes but the NOR: the boot loader splash screen image, displayed by U-Boot
  • U-Boot distro config file extlinux.conf (can be in a Flattened Image Tree – FIT)
2 MB ssbl The second stage boot loader (SSBL) is U-Boot, with its device tree blob (dtb) appended at the end
256 KB to 512 KB (*) fsbl The first stage boot loader is Arm Trusted Firmware (TF-A) or U-Boot Secondary Program Loader (SPL), with its device tree blob (dtb) appended at the end. At least two copies are embedded.

Note: due to ROM code RAM needs, FSBL payload is limited to 247 KB.

(*): the partition size depends on the flash technology, to be aligned on block erase size of the flash present on the board: NOR (256 KB) / NAND (512 KB)

Info white.png Information
Some boards can be equiped with multiple flash devices, like the EVAL board, and all those flashes can be programmed with STM32CubeProgrammer. But caution must be taken for the serial NOR/NAND and SLC NAND because a static bootable MTD partitionning is defined in U-Boot include/configs/stm32mp1.h (look for STM32MP_MTDPARTS), with the consequence that up to 6 MB of space is lost at the beginning of such devices, even if they are not bootable.

2.2 Optional[edit source]

Size Component Comment
256 KB (*) env This partition is used to store U-Boot environment while booting on NOR flash. For all other flashes, U-Boot environment is stored whether in an EXT4 bootfs partition (eMMC, SD card) or UBI volumes (NAND).
256 KB to 512 KB (*) teeh OP-TEE header
256 KB to 512 KB (*) teed OP-TEE pageable code and data
256 KB to 512 KB (*) teex OP-TEE pager

(*): the partition size depends on the Flash technology as it should be aligned on the block erase size of the flash present on the board (256 KB for NOR and 512 KB for NAND).

3 SD card memory mapping[edit source]

The SD card has to be partitioned with GPT format to be recognized by STM32MP15. The easiest way to achieve this is to use STM32CubeProgrammer.
The ROM code looks for the GPT entries whose the name begins with "fsbl": fsbl1 and fsbl2 for example.
Note: the SD card can be unplugged from the board and inserted into a Linux host computer for direct partitionning with Linux utilities and access to the bootfs, rootfs and userfs partitions. The file system is Linux EXT4.

SD card mapping.png

4 eMMC memory mapping[edit source]

The eMMC embeds four physical partitions:

  • Boot area partition 1: one copy of the FSBL.
  • Boot area partition 2: one copy of the FSBL.
  • User data area: formatted with GPT partitioning and used to store all remaining partitions.
  • Replay Protected Memory Block (RPMB): not shown in the figure below, since not involved in the current boot chain.

STM32CubeProgrammer has to be used to prepare the eMMC with the layout shown below and to populate each partition.

Info white.png Information
The boot area partition used by the eMMC boot sequence is selected via the EXT_CSD[179] register that is inside the eMMC. The STM32CubeProgrammer execution is concluded with the selection of the last written partition from the flashlayout file, so the partition 2, typically. The other copy is never used as long as the user does not explicitely change the eMMC EXT_CSD[179] register to select it.
EMMC mapping.png

5 NOR memory mapping[edit source]

NOR Flash being expensive, their size is usually limited to the minimum, allowing to store only the bootloaders. The system files (bootfs, rootfs and userfs) are usually stored in another Flash memory: like the SD card in OpenSTLinux distribution.
STM32CubeProgrammer has to be used to prepare the NOR Flash and the SD card with the layout shown below and to populate each partition.

It is possible to use an eMMC card or NAND rather than a SD card as second level Flash memory. It requires to change:

  • the Flash memory layout, using STM32CubeProgrammer in order to write the rootfs and userfs to the targeted Flash memory
  • the Linux kernel parameters, using U-Boot, in order to indicate where the rootfs and userfs have to be mounted
NOR mapping.png

6 NAND memory mapping[edit source]

STM32CubeProgrammer has to be used to prepare the NAND Flash with the layout shown below, and to populate each partition.

NAND mapping.png