Last edited 7 months ago

How to load and start STM32CubeMP13 applications via SNOR flash

Applicable for STM32MP13x lines


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

1. SNOR external loader firmware utility[edit source]

1.1. Introduction[edit source]

SNOR external loader firmware utility is used to load and start STM32CubeMP13 applications programmed into external SNOR flash.

  • It allows programming of embedded software applications on external SNOR flash for an internal ST Board, aka STM32MP13XX_CUSTOM_HW, customized to validate some features. It can be reuse for customer boards after binaries adaptations.
  • This package contains all the binaries necessary to program SNOR flash through serial interface and boot from SNOR.
  • This package version :
    • Supports UART and USB DFU serial protocol.
    • OTP Programming is not supported.
Warning DB.png Important
This utility has been tested on internal ST boards and uses MX25L51245G SNOR flash but it can be easily tailored to any other available SNOR flashes in the market.
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]

SNOR External Loader utility contains below binaries, readme and .tsv file. Details about each is described below.

├── Projects
    ├── STM32MP13XX_CUSTOM_HW
       ├── External_Loader
          ├── SNOR_Ext_Loader
          │    ├── [FlashLayout_OpenBL_ExtLoaderSNOR_SerialBoot.tsv]
          │    ├── [FSBLA_SNOR_A7_Signed.bin]
          │    ├── [MP13_BSP_TemplatesA7_CUSTOM_HW_Signed.bin]
          │    ├── [MX25L51245G_STM32MP135C-CUSTOM_HW_A7.bin]
          │    ├── [readme.txt]
          │    ├── [STM32PRGFW_UTIL_MP13xx_CP_Serial_Boot.stm32]
  • FlashLayout_OpenBL_ExtLoaderSNOR_SerialBoot.tsv
This file defines flash memory partitions, binaries and corresponding partition ID. Refer to STM32CubeProgrammer_flashlayout article for more details.
  • FSBLA_SNOR_A7_Signed.bin
This binary is the First Stage Boot Loader (FSBLA) programmed via STM32PRGFW_UTIL_MP13xx_CP_Serial_Boot.stm32 in SNOR flash and is used to load test application from SNOR to DDR.
  • MP13_BSP_TemplatesA7_CUSTOM_HW_Signed.bin
This binary is the test application, programmed in SNOR flash via STM32PRGFW_UTIL_MP13xx_CP_Serial_Boot.stm32.On reset, when boot from SNOR, it is loaded into DDR for execution by FSBLA.
This can be replaced with any customer test application. Application has to built for DDR (Refer build test application for DDR) and then properly signed with STM32CubeProgrammer signing tool (or via Refer to Postbuild steps and scripts). In this test application, blue LED is initialized and after successful execution blue LED is toggled at 200ms.
  • MX25L51245G_STM32MP135C-CUSTOM_HW_A7.bin
This binary provides SNOR flash read, write and erase functionalities. It is used for programming binaries in external SNOR flash.
  • Read the README file carefully
It provides all the information about the example setup and verdict.
  • STM32PRGFW_UTIL_MP13xx_CP_Serial_Boot.stm32
This binary initializes UART or USB DFU interface depending on how you want to program SNOR flash and reads binaries serially in serial boot mode.
MX25L51245G_STM32MP135C-CUSTOM_HW_A7.bin is loaded into RAM. FSBLA_SNOR_A7_Signed.bin and MP13_BSP_TemplatesA7_CUSTOM_HW_Signed.bin are programmed into SNOR flash for subsequent boot in SNOR boot mode.

2. Hardware and software prerequisites[edit source]

  • Customer board with external SNOR flash.
  • Customer board with a ST-Link or UART cable connected between board and PC if programming via UART.
  • Customer board with a Micro-USB cable connected between USB DFU port on board and PC if programming via USB.
  • Power adapter for 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 boot mode.
  • Connect Micro-USB cable between PC and ST-Link connector on the board OR
  • Connect a UART cable between PC and UART connector on the board if programming via UART. In both the case, 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.
  • Connect a Micro-USB cable between PC and USB DFU port on the board if programming via USB. PC should detect USB DFU interface.
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 SNOR flash in serial boot[edit source]

3.2.1. Flash SNOR flash using STM32CubeProgrammer GUI[edit source]

Read STM32CubeProgrammer pages for more details.

3.2.1.1. Program via UART[edit source]
  • Click on UART and then select COM port:
CubeProgrammer GUI Flashing 7.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 8.png


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


  • Select Binaries path with Browse button: Firmware\Projects\STM32MP13XX_CUSTOM_HW\External_Loader\SNOR_Ext_Loader
CubeProgrammer GUI Flashing 10.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 11.png


3.2.1.2. Program via USB DFU[edit source]
  • Click on USB and then select USB port:
CubeProgrammer GUI Flashing 12.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 13.png


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


  • Select Binaries path with Browse button: Firmware\Projects\STM32MP13XX_CUSTOM_HW\External_Loader\SNOR_Ext_Loader
CubeProgrammer GUI Flashing 15.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 16.png


3.2.2. Flash SNOR flash 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 SNOR External Loader binaries via UART interface:
$STM32_Programmer_CLI.exe -c port=COM 
<num> -w 
<YourDirectoryPath>\Projects<STM32device>\External_Loader\SNOR_Ext_Loader\FlashLayout_OpenBL_ExtLoaderSNOR_SerialBoot.tsv

OR

  • Execute below command to load the SNOR External Loader binaries via USB DFU interface:
$STM32_Programmer_CLI.exe -c port=USB 
<num> -w 
<YourDirectoryPath>\Projects<STM32device>\External_Loader\SNOR_Ext_Loader\FlashLayout_OpenBL_ExtLoaderSNOR_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 SNOR flash successfully, set boot pins to b001 (BOOT0 to ON, BOOT1 and BOOT2 to OFF) position to select SNOR boot mode and then reset the board.
  • MP13_BSP_TemplatesA7_CUSTOM_HW_Signed.bin test application toggles blue LED at 200ms, indicating that it has been loaded and executed successfully from DDR.