cancel
Showing results for 
Search instead for 
Did you mean: 

Arm Trusted Firmware: Optimizing boot time with Yocto

Moises Araya
Associate III

Hi everyone,

I'm trying to optimize the boot time of tf-a with Yocto but don't find much information on the web. Currently tf-a takes about 1s from the point in which it is read from NOR to the point it loads UBoot from same NOR. I optimized the Linux kernel to take about 1.5s to boot (no ethernet) so the tf-a boot time has now an important weight in the whole boot time of the system.

There is this link which explains how to set some compiler flags while compiling tf-a without Yocto but didn't find the equivalent flags in Yocto.

$ make STM32MP1_DEBUG_ENABLE=0    \
            STM32MP1_UART_PROGRAMMER=0 \
            STM32MP1_USB=0             \
            STM32MP1_QSPI_NOR=0        \
            STM32MP1_QSPI_NAND=0       \
            STM32MP_FMC_NAND=1         \
            STM32MP_EMMC=0             \
            STM32MP_SDMMC=0            \
            …

As I'm booting from NOR, I trying setting the following in a bbappend:

TF_A_EXTRACONF_LEGACY=" STM32MP_SDMMC=0 STM32MP_EMMC=0 STM32MP_SPI_NOR=1 STM32MP_RAW_NAND=0 STM32MP_SPI_NAND=0 STM32MP_USE_STM32IMAGE=1"

But neither the size not the boot time of tf-a improved.

The only Yocto flag that proved useful was:

ST_TF_A_DEBUG_LOG_LEVEL = "0"

I would appreciate any help with this.

Bests,

Jose

2 REPLIES 2
Olivier GALLIEN
ST Employee

Hi @Moises Araya​ ,

I'm not Yocto expert but I guess you should have a look to the tfa-recipes in layers/meta-st/meta-st-stm32mp/recipes-bsp/trusted-firmware-a

For exemple in tf-a-stm32mp.inc in notice the section :

# Configure specific build flags
 
EXTRA_OEMAKE += "${@bb.utils.contains('TF_A_SIGN_ENABLE', '1', 'TRUSTED_BOARD_BOOT=1', '', d)}"
 
EXTRA_OEMAKE += "${@bb.utils.contains('TF_A_SIGN_ENABLE', '1', 'MBEDTLS_DIR=${TFA_MBEDTLS_DIR}', '', d)}"
 
EXTRA_OEMAKE += "${@bb.utils.contains('TF_A_ENCRYPTED_ENABLE', '1', 'DECRYPTION_SUPPORT=aes_gcm ENCRYPT_BL32=1', '', d)}"

I understand that adding compile flags for optimization in EXTRA_OEMAKE variable might works.

Hope it help

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
Moises Araya
Associate III

Hi @Community member​,

Thank you very much for your help. I tried setting different EXTRA_OEMAKE flags following 2 approaches:

  1. Using the TF-A Makefile Flags as described in my commit of the repo
  2. Using the flags that STM suggests

But the only 2 EXTRA_OEMAKE flags that helped reducing a bit the size of trusted tf-a are: DEBUG=0 LOG_LEVEL=0 but other than that, there is no noticeable change. The current size is 197kB and its boot time continues to be about 1s.

My question at this point is:

Is 1s a realistic optimized boot time for tf-a after setting the flags correctly (optimally) or I am still missing something here?

Thanks again!

Bests,

Moises