Booting directly to kernel from TFA on stm32mp157DAC
- June 23, 2025
- 3 replies
- 1009 views
Hi,
I am working on optimizing the boot process on my STM32MP157DAC board by removing U-Boot and booting the Linux kernel directly. I’ve been following the documented procedure from ST for the STM32MP1 series:
ST Wiki - How to optimize the boot time
TF-A Configuration
I’ve updated the configuration in stm32mp1_def.h as follows:
- #define STM32MP_BL33_BASE (STM32MP_DDR_BASE + U(0x2008000))#define STM32MP_BL33_MAX_SIZE U(0x3FF8000)
SD Card Timeout Modification
Modified the SD card timeout value in <tf-a_sources>/drivers/st/mmc/stm32_sdmmc2.c:
- timeout = timeout_init_us(TIMEOUT_US_1_S * 10);
TF-A Build Process:
I applied the changes as a patch through my custom Yocto layer and rebuilt the tf-a-stm32mp recipe successfully.
Kernel Configuration:
I added the following configuration parameters to my stm32_defconfig:
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="root=PARTUUID=e91c4e10-16e6-4c0e-bd0e-77becf4a3582 rootwait rw earlyprintk earlycon console=ttySTM0,115200"I created and applied a patch for this as well via my custom Yocto layer.
FIP Tool Update:
I updated the FIP image using fiptool:
fiptool update --nt-fw kernel/uImage --hw-config kernel/stm32mp157f-dk2.dtb fip/fip-stm32mp157f-dk2-optee-sdcard.binThe result was the new FIP file: fip-stm32mp157f-dk2-optee-sdcard.bin
Flash Layout Modification:
I modified the TSV file as follows to include the new TF-A and FIP binaries:
#Opt Id Name Type IP Offset Binary - 0x01 fsbl-boot Binary none 0x0 arm-trusted-firmware/tf-a-stm32mp157f-dk2-usb.stm32 - 0x03 fip-boot FIP none 0x0 fip/fip-stm32mp157f-dk2-optee-emmc.bin P 0x04 fsbl1 Binary mmc1 boot1 arm-trusted-firmware/tf-a-stm32mp157f-dk2-optee-emmc.stm32 P 0x05 fsbl2 Binary mmc1 boot2 arm-trusted-firmware/tf-a-stm32mp157f-dk2-optee-emmc.stm32 P 0x06 metadata1 FWU_MDATA mmc1 0x00080000 arm-trusted-firmware/metadata.bin P 0x07 metadata2 FWU_MDATA mmc1 0x00100000 arm-trusted-firmware/metadata.bin P 0x08 fip-a FIP mmc1 0x00180000 fip/fip-stm32mp157f-dk2-optee-emmc.bin PED 0x09 fip-b FIP mmc1 0x02180000 none PED 0x0A u-boot-env ENV mmc1 0x02580000 none P 0x10 bootfs System mmc1 0x02600000 st-image-bootfs-openstlinux-weston-stm32mp15-disco.ext4 P 0x11 vendorfs FileSystem mmc1 0x06600000 st-image-vendorfs-openstlinux-weston-stm32mp15-disco.ext4 P 0x12 rootfs FileSystem mmc1 0x07600000 st-image-qt-openstlinux-weston-stm32mp15-disco.ext4
When attempting to flash the image using STM32CubeProgrammer, I receive a timeout error indicating "unable to reconnect", and the operation fails at partition 0x03.
I’ve also attached the patch with my TF-A and kernel changes. Please let me know if there’s anything I may have missed or need to correct.
For reference, I’ve reviewed a related thread on ST’s community forum:
Direct kernel boot on STM32MP1
Thanks.
