Last edited 4 months ago

How to load and start STM32CubeMP13 applications via eMMC storage

Applicable for STM32MP13x lines

This article explains how to load and start STM32CubeMP13 applications via eMMC using the "eMMC external loader firmware utility" provided with the STM32CubeMP13 package. This use case is useful in production mode.

1. eMMC external loader firmware utility[edit | edit source]

1.1. Introduction[edit | edit source]

The eMMC external loader firmware utility is used to load and start STM32CubeMP13 applications programmed into external eMMC .

  • It allows programming of embedded software applications on an external eMMC for an internal STMicroelectronics Board, referred to as STM32MP13XX_CUSTOM_HW, customized to validate certain features. It can be reused for customer boards after binary adaptations.
  • This package contains all necessary binaries to program the eMMC through the serial interface and boot from eMMC .
  • This package version:
    • Supports the UART and USB DFU serial protocols.
    • Does not support OTP Programming.
Info white.png Information
The utility source code is available on request from the STMicroelectronics support teams for use as an example, and is easy to adapt for customer boards.

1.2. Contents[edit | edit source]

The eMMC External Loader utility contains the binaries listed below, as well as readme and .tsv files. Details for each can be found below.

├── Projects
    ├── STM32MP13XX_CUSTOM_HW
       ├── External_Loader
          ├── EMMC_Ext_Loader
          │    ├── [FlashLayout_OpenBL_ExtLoaderEMMC_SerialBoot.tsv]
          │    ├── [FSBLA_eMMC_A7_Signed.bin]
          │    ├── [MP13_BSP_TemplatesA7_VALID2_Signed.bin]
          │    ├── [readme.txt]
          │    ├── [MMC_Ext_Loader.bin]
          │    ├── [STM32PRGFW_UTIL_MP13xx_CP_Serial_Boot.stm32]
  • FlashLayout_OpenBL_ExtLoaderEMMC_SerialBoot.tsv
This file defines flash memory partitions, binaries, and the corresponding partition ID. Refer to the STM32CubeProgrammer_flashlayout article for more details.
  • FSBLA_eMMC_A7_Signed.bin
This binary is the first-stage bootloader (FSBLA) programmed via STM32PRGFW_UTIL_MP13xx_CP_Serial_Boot.stm32 in the eMMC and is used to load the test application from eMMC to DDR.
  • MP13_BSP_TemplatesA7_VALID2_Signed.bin
This binary is the test application, programmed in the eMMC via STM32PRGFW_UTIL_MP13xx_CP_Serial_Boot.stm32. On reset, when booting from the eMMC, it is loaded into DDR for execution by FSBLA.
This application can be replaced with any customer test application. The application must be built for DDR (refer to build test application for DDR) and then properly signed with the STM32CubeProgrammer signing tool (or via postbuild steps and scripts)). In this test application, the blue LED is initialized and after successful execution, it is toggled at 200ms and logs are printed on the serial console
  • readme.txt
Read this file carefully; it provides all the information for the example setup and verdict.
  • MMC_Ext_Loader.bin
This binary provides eMMC read, write, and erase functionalities. It is used for programming binaries on an eMMC.
  • STM32PRGFW_UTIL_MP13xx_CP_Serial_Boot.stm32
This binary initializes the UART or USB interface and reads binaries serially in serial boot mode.

MMC_Ext_Loader.bin is loaded into RAM. FSBLA_eMMC_A7_Signed.bin and MP13_BSP_TemplatesA7_VALID2_Signed.bin are programmed into eMMC for subsequent boot in eMMC mode.

2. Hardware and software prerequisites[edit | edit source]

  • Customer board with:
    • An external eMMC.
    • An ST-Link or UART cable connected between the board and the PC, if programming with UART.
    • A micro-USB cable connected between the USB DFU port on the board and the PC, if programming with USB.
    • A power adapter.
  • STM32CubeProgrammer PC tool installed (v2.14.0 minimum).

3. How to run the utility[edit | edit source]

3.1. Set boot mode to serial[edit | edit source]

  • Set the boot pins to b000 (BOOT0/1/2 to OFF) position to select serial boot mode.
  • Connect the micro-USB cable between the PC and ST-Link connector on the board
OR
  • Connect a UART cable between the PC and UART connector on the board, if programming with UART. In both cases, the PC should detect the UART interface.
Warning DB.png Important
ST-Link provides a UART interface via Virtual COM port on the board like STM32MP135x-DK Discovery kit More info green.png.
  • Connect a mcro-USB cable between the PC and USB DFU port on the board, if programming with USB. The PC should detect the USB DFU interface.
Warning white.png Warning
ROM CODE gives preference to USB DFU if the USB cable is connected to other places than the ST-Link USB port.
If you want to use UART, the USB cable should NOT be connected to any other ports on the board than ST-Link USB.

3.2. Program the eMMC in serial boot[edit | edit source]

3.2.1. Program the eMMC using the STM32CubeProgrammer GUI[edit | edit source]

Read the STM32CubeProgrammer pages for more details.

3.2.1.1. Program with UART[edit | edit source]
  • Click on UART and then select COM port:
CubeProgrammer GUI Flashing 1.png


  • Click on the Connect button.
STM32CubeProgrammer is now connected to ROM Code and the logs show the chip ID, bootloader version, and other details:
CubeProgrammer GUI Flashing 2.png


  • Click on the "+" icon, then on Open file and select the TSV file FlashLayout_OpenBL_ExtLoaderEMMC_SerialBoot.tsv
CubeProgrammer GUI Flashing 3.png


  • Select Binaries path with the Browse button: Firmware\Projects\STM32MP13XX_CUSTOM_HW\External_Loader\MMC_Ext_Loader
EMMC File Loading.png


  • Click on the Download button.
STM32CubeProgrammer now starts downloading the binaries. Once they've been successfully downloaded, a pop-up message indicates Flashing service completed successfully.
EMMC Flash Completed.png
3.2.1.2. Program with USB DFU[edit | edit source]
  • Click on USB and then select USB port:
CubeProgrammer GUI Flashing 12.png


  • Click on the Connect button.
STM32CubeProgrammer is now connected to ROM Code and the logs show the chip ID, bootloader version, and other details:
CubeProgrammer GUI Flashing 13.png


  • Click on the + icon, then on Open file select the TSV file FlashLayout_OpenBL_ExtLoaderEMMC_SerialBoot.tsv
CubeProgrammer GUI Flashing 14.png


  • Select Binaries path with the Browse button: Firmware\Projects\STM32MP13XX_CUSTOM_HW\External_Loader\MMC_Ext_Loader
EMMC File Loading USB.png


  • Click on the Download button:
STM32CubeProgrammer now starts downloading the binaries. Once they've been successfully downloaded, a pop-up message indicates Flashing service completed successfully.
EMMC Flash Completed USB.png


3.2.2. Program the eMMC using the STM32CubeProgrammer CLI[edit | edit source]

  • Browse to the installed STM32CubeProgrammer binary directory (STM32CubeProgrammer\bin).
  • Open a command prompt from this directory.
  • Execute the command to load the eMMC external loader binaries via the UART interface:
$STM32_Programmer_CLI.exe -c port=COM 
<num> -w 
<YourDirectoryPath>\Projects<STM32device>\External_Loader\EMMC_Ext_Loader\FlashLayout_OpenBL_ExtLoaderEMMC_SerialBoot.tsv

OR

  • Execute the command to load the eMMC external loader binaries via the USB DFU interface:
$STM32_Programmer_CLI.exe -c port=USB 
<num> -w 
<YourDirectoryPath>\Projects<STM32device>\External_Loader\EMMC_Ext_Loader\FlashLayout_OpenBL_ExtLoaderEMMC_SerialBoot.tsv
  • DO NOT reset the board until the command has been fully completed.
  • STM32CubeProgrammer now starts downloading all binaries listed in the TSV file. When all binaries have been downloaded successfully, a message indicates Flashing service completed successfully.

3.3. Run the test application[edit | edit source]

  • When the binaries have been programmed into the eMMC successfully, set the boot pins to the b010 (BOOT0 and BOOT2 to OFF and BOOT1 to ON) position to select eMMC boot mode, and reset the board.
  • The MP13_BSP_TemplatesA7_VALID2_Signed.bin test application toggles the blue LED at 200ms, indicating that it has been loaded and executed successfully from DDR.