Last edited 5 months ago

How to load and start STM32CubeMP13 applications via microSD card

Applicable for STM32MP13x lines

This article aims to explain how to load and start STM32CubeMP13 applications via microSD card using the "SD external loader firmware utility" provided into the STM32CubeMP13 package. This use case is useful in production mode.

1 SD external loader firmware utility[edit source]

1.1 Introduction[edit source]

SD external loader firmware utility is used to load and start STM32CubeMP13 applications programmed into microSDTM card.

  • It allows programming of embedded software applications on external microSDTM card for STM32MP135x-DK Discovery kit More info green.png.
  • This package contains all the binaries necessary to program the microSDTM card through serial interface and boot from microSDTM card.
  • This package version :
    • Supports UART serial protocol.
    • It does not support USB DFU serial protocol in this release.
    • OTP Programming is not supported.
Info white.png Information
The utility source code can be provided as example, on demand, via ST support teams, and easily adapted for customer boards.

1.2 Contents[edit source]

SD External Loader utility contain below binaries, readme and .tsv files. Details about each is described below.

├── Projects
    ├── STM32MP135C-DK
       ├── External_Loader
          ├── SD_Ext_Loader
          │    ├── [FlashLayout_OpenBL_ExtLoaderSDMMC_SerialBoot.tsv]
          │    ├── [FSBLA_Sdmmc1_A7_Signed.bin]
          │    ├── [MP13_BSP_TemplatesA7_DISCO_Signed.bin]
          │    ├── [readme.txt]
          │    ├── [SD_Ext_Loader.bin]
          │    ├── [STM32PRGFW_UTIL_MP13xx_CP_Serial_Boot.stm32]
  • FlashLayout_OpenBL_ExtLoaderSDMMC_SerialBoot.tsv
This file defines flash memory partitions, binaries and corresponding partition ID. Refer to STM32CubeProgrammer_flashlayout article for more details.
  • FSBLA_Sdmmc1_A7_Signed.bin
This binary is the First Stage Boot Loader (FSBLA) programmed via STM32PRGFW_UTIL_MP13xx_CP_Serial_Boot.stm32 in microSDTM card and is used to load the test application from microSD card to DDR.
  • MP13_BSP_TemplatesA7_DISCO_Signed.bin
This binary is the test application, programmed in microSD card via STM32PRGFW_UTIL_MP13xx_CP_Serial_Boot.stm32. On reset, when boot from microSD card, it is loaded into DDR for execution by FSBLA.
This can be replaced with any customer test application. Application has to be built for DDR (Refer build test application for DDR) and then properly signed with STM32CubeProgrammer signing tool (or via Postbuild steps and scripts)). In this test application, blue LED is initialized and after successful execution blue LED is toggled at 200ms and below logs are printed on serial console -:
TestApp Execution 1.png


  • Read the README file carefully
It provides all the information about the example setup and verdict.
  • SD_Ext_Loader.bin
This binary provides microSD card read, write and erase functionalities. It is used for programming binaries in microSD card.
  • STM32PRGFW_UTIL_MP13xx_CP_Serial_Boot.stm32
This binary initializes UART interface and reads binaries serially in serial boot mode.

SD_Ext_Loader.bin is loaded into RAM. FSBLA_Sdmmc1_A7_Signed.bin and MP13_BSP_TemplatesA7_DISCO_Signed.bin are programmed into microSD card for subsequent boot in SD mode. Refer to Set boot switches.

2 Hardware and software prerequisites[edit source]

  • STM32MP135x-DK Discovery kit More info green.png with a micro-USB cable connected at ST-Link port.
  • USB Type-C cable for power to the board.
  • A microSDTM card plugged at microSD card slot in the board.
  • STM32CubeProgrammer PC tool installed (v2.14.0 minimum).

3 How to run utility[edit source]

3.1 Set boot mode to serial[edit source]

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

3.2 Flash microSD card in serial boot[edit source]

3.2.1 Flash microSD card using STM32CubeProgrammer GUI[edit source]

Read STM32CubeProgrammer pages for more details.

  • Click on UART and then select COM port:
CubeProgrammer GUI Flashing 1.png


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


  • Click on Open file by clicking on + icon and then select TSV file : FlashLayout_OpenBL_ExtLoaderSDMMC_SerialBoot.tsv
CubeProgrammer GUI Flashing 3.png


  • Select Binaries path with Browse button: Firmware\Projects\STM32MP135C_DK\External_Loader\SD_Ext_Loader
CubeProgrammer GUI Flashing 5.png


  • Click on Download button :
STM32CubeProgrammer now starts downloading the binaries. Once all the binaries are successfully downloaded, there is a pop-up message indicating - Flashing service completed successfully
CubeProgrammer GUI Flashing 6.png

3.2.2 Flash microSD card using STM32CubeProgrammer CLI[edit source]

  • Browse the installed STM32CubeProgrammer binary directory i.e. STM32CubeProgrammer\bin
  • Open command prompt from this directory.
  • Execute below command to load the SD external loader binaries:
$STM32_Programmer_CLI.exe -c port=COM 
<num> -w 
<YourDirectoryPath>\Projects<STM32device>\External_Loader\SD_Ext_Loader\FlashLayout_OpenBL_ExtLoaderSDMMC_SerialBoot.tsv
  • DO NOT reset the board till the command has completed.
  • STM32CubeProgrammer now starts downloading all the binaries listed in TSV file. Once all the binaries are successfully downloaded, there is a message indicating : Flashing service completed successfully.

3.3 Run test application[edit source]

  • Once binaries are programmed into microSD card successfully, set boot pins to b101 (BOOT0 and BOOT2 to ON and BOOT1 to OFF) position to select to select SD mode. Refer to Set boot switches.
  • MP13_BSP_TemplatesA7_DISCO_Signed.bin test application toggles blue LED at 200ms, indicating that it has been loaded and executed successfully from DDR. It also prints below logs on serial console -:
TestApp Execution 1.png