This article gives details about updating the bootloader objects of SD card memory, located onto STM32MP157x-EV1 (e.g.), using STM32CubeIDE.
1. Overview[edit source]
The different steps to update SD card with customized trusted image are the following ones:
- Initialize the SD card with Starter Package image thanks to STM32CubeProgrammer
- Within STM32CubeIDE:
- customize the trusted image, thanks to embedded STM32CubeMX generating device trees
- compile corresponding Linux® device tree & bootloader images
- update them on running STM32MP15 board
- Check the new customization is correctly set up
All those steps are explained in chapters below.
2. Initialize SD card with Starter Package[edit source]
Initialize the NAND with Starter Package image thanks to STM32CubeProgrammer. For that select the Starter package corresponding to the targeted STM32MP1 board and jump to chapter Downloading the image and flashing it on the board (eg here for STM32MP15 Evaluation board)
Before executing the next step, check the bootloader version, visible in boot messages:
TF-A BL2 version, booting from SD card memory
- TF-A BL2 version, booting from SD card memory
- U-boot version & extlinux.conf file used, booting from SD card memory
- extlinux.conf content before update
3. Customize bootloader images and update them on running STM32MP15 board[edit source]
3.1. Build the trusted image inside STM32CubeIDE with the new expected device trees[edit source]
After customization within embedded STM32CubeMX, new device trees for Linux® and for bootloader are generated.
Next step is to build this new trusted image; this is covered by STM32CubeIDE as explained in How to manage OpenSTLinux projects in STM32CubeIDE#Bootloader_projects. It allows to easily build customized bootloader images and Linux® device tree.
Note that for Linux®, only device tree has to be updated as described hereafter.
3.2. STM32MP1 board update with new Linux® device tree[edit source]
In this step, STM32MP15 board is up and running with network access: target status is green. After having compiled device tree generated by STM32CubeMX , you need to :
- update MP15 target bootfs with new .dtb under /boot
- and adjust /boot/mmc0_extlinux/extlinux.conf in order to declare new device tree and set it as default.
For that, follow steps explained below:
- select the Cortex-A Linux® Deployment shortcut configuration available from Linux® project Run As... menu.
- Validate your choice and use Run button. You get in a dedicated Linux® Deployment console a message like this:
- Check extlinux.conf content after SD card Linux® device tree update (DEFAULT and LABEL have changed)
After compiling device tree generated by STM32CubeMX we need to :
- update MP15 target bootfs with new .dtb under /boot
- and adjust /boot/mmc0_extlinux/extlinux.conf in order to declare new device tree and set it as default.
This is done thanks to Cortex-A Linux® Deployment shortcut configuration available from Linux® project Run As... menu.
- Linux® deployment configuration
- SD card Linux® deployment message
- SD card Linux® device tree update
Then, select Cortex-A project and right click to get Cortex-A Bootloader Deployment shortcut.
Connection is automatically set and you need to scan MP15 target storage. This storage list depends on the board and on boot storage used. Then select :
- the storage to update, SD-Card here;
- TF-A BL2 & FIP image to update.
- SD card bootloader deployment configuration
- SD card bootloader deployment configuration
4. Bootloader version after customization wit STM32CubeIDE[edit source]
After the update, TF-A BL2 and U-Boot versions are modified and Linux® uses the generated Device Tree. Here are the boot messages now:
- TF-A BL2 updated version, booting from SD card memory
- U-Boot updated version & Linux® device tree, booting from SD card memory