Skip to main content
Visitor II
May 27, 2021
Question

tf-a and u-boot custom compile fails

  • May 27, 2021
  • 1 reply
  • 6082 views

Hi, Everybody!

Referring to this issue:

https://community.st.com/s/question/0D53W00000oVNtqSAG/qaudspi-spinand-flash-device-tree-for-tfa-and-uboot

PatrickF suggested to manually configure U-BOOT for my board. I have downloaded tf-a sources patched it, of course installed and configured SDK and trying to do all according to it's README.HOW_TO.txt file.

As I have my specific DT I need to specify it in makefile parameters:

README.HOW_TO.txt has this example:

make -f $PWD/../Makefile.sdk TFA_DEVICETREE=stm32mp157c-ev1 TF_A_CONFIG=trusted ELF_DEBUG_ENABLE='1' all

But in fact TFA_DEVICETREE var-name should be TF_A_DEVICETREE. Is this correct?

Then, file format. We have .stm32, also .fip file format avaialble

I can compile both .stm32 tf-a and u-boot, but u-boot fail to start with following error:

NOTICE: CPU: STM32MP157DAB Rev.Z

NOTICE: Model: STMicroelectronics STM32MP157A-DK1 STM32CubeMX board

INFO:  Reset reason (0x14):

INFO:   Pad Reset from NRST

INFO:  PMIC version = 0x21

INFO:  FCONF: Reading TB_FW firmware configuration file from: 0x2ffe3000

INFO:  FCONF: Reading firmware configuration information for: stm32mp_io

INFO:  Using USB

INFO:   Instance 2

INFO:  Boot used partition fsbl1

NOTICE: BL2: v2.4-r1.0(debug):

NOTICE: BL2: Built : 11:12:52, May 27 2021

INFO:  BL2: Doing platform setup

INFO:  RAM: DDR3-DDR3L 16bits 533000Khz

WARNING: Couldn't find property st,phy-cal in dtb

INFO:  Memory size = 0x20000000 (512 MB)

INFO:  DFU USB START...

INFO:  phase ID :0, Manifestation 0 at c00001d9

INFO:  phase ID :3, Manifestation 3 at c80e1fa2

ERROR:  FIP Header check failed for phase 3

ERROR:  usb_core_ctl_error : Send an ERROR

INFO:  handle USB : Suspend int

INFO:  USB Suspend mode

Then I'm trying to compile tf-a with fip option, but it fails with following error:

 make -f ../Makefile.sdk TF_A_CONFIG=trusted TF_A_DEVICETREE=stm32mp157a-stm32mp151-dk1-mx fip

fiptool-stm32mp config:

 optee:

  bl32 config value: optee

 trusted:

  bl32 config value: tfa

 FIP_DEVICETREE: stm32mp157a-stm32mp151-dk1-mx

 FIP_DEPLOYDIR_FIP  : /home/screep/Distribution-Package/stm32mp1-openstlinux-5.10-dunfell-mp1-21-03-31/sources/arm-ostl-linux-gnueabi/FIP_artifacts//fip

 FIP_DEPLOYDIR_TFA  : /home/screep/Distribution-Package/stm32mp1-openstlinux-5.10-dunfell-mp1-21-03-31/sources/arm-ostl-linux-gnueabi/tf-a-stm32mp-2.4.r1-r0/tf-a-sources/../deploy/bl32

 FIP_DEPLOYDIR_FWCONF: /home/screep/Distribution-Package/stm32mp1-openstlinux-5.10-dunfell-mp1-21-03-31/sources/arm-ostl-linux-gnueabi/tf-a-stm32mp-2.4.r1-r0/tf-a-sources/../deploy/fwconfig

 FIP_DEPLOYDIR_OPTEE : /home/screep/Distribution-Package/stm32mp1-openstlinux-5.10-dunfell-mp1-21-03-31/sources/arm-ostl-linux-gnueabi/FIP_artifacts//optee

 FIP_DEPLOYDIR_UBOOT : /home/screep/Distribution-Package/stm32mp1-openstlinux-5.10-dunfell-mp1-21-03-31/sources/arm-ostl-linux-gnueabi/FIP_artifacts//u-boot

Missing stm32mp157a-stm32mp151-dk1-mx-fw-config-optee.dtb file in folder: $FIP_DEPLOYDIR_FWCONF or '$FIP_DEPLOYDIR_ROOT/arm-trusted-firmware/fwconfig'

Why optee? I don;t need optee.

Can anybody help me with correct sequence compiling tf-a and u-boot starting from source download and finishing with success kernel load...

Thank you in advance

Looking forward for your reply

    This topic has been closed for replies.

    1 reply

    Technical Moderator
    May 28, 2021
    ASkri.1Author
    Visitor II
    May 31, 2021
    Hi, Patrick!
    Thank you very much for your reply. Finally I've got tf-a and u-boot assembled and FIP image generated.
    (using this wiki page: https://wiki.st.com/stm32mpu/wiki/How_to_compile_the_device_tree_with_the_Developer_Package#U-boot_-_unpack_and_patch_sources
    )
    But u-boot load fails with following log:
    NOTICE: CPU: STM32MP157DAB Rev.Z
    NOTICE: Model: STMicroelectronics STM32MP157A-DK1 STM32CubeMX board
    INFO: Reset reason (0x14):
    INFO: Pad Reset from NRST
    INFO: PMIC version = 0x21
    INFO: FCONF: Reading TB_FW firmware configuration file from: 0x2ffe3000
    INFO: FCONF: Reading firmware configuration information for: stm32mp_io
    INFO: Using USB
    INFO: Instance 2
    INFO: Boot used partition fsbl1
    NOTICE: BL2: v2.4-r1.0(debug):
    NOTICE: BL2: Built : 13:48:10, May 31 2021
    INFO: BL2: Doing platform setup
    INFO: RAM: DDR3-DDR3L 16bits 533000Khz
    WARNING: Couldn't find property st,phy-cal in dtb
    INFO: Memory size = 0x20000000 (512 MB)
    INFO: DFU USB START...
    INFO: phase ID :0, Manifestation 0 at c0000141
    INFO: phase ID :3, Manifestation 3 at c80feba4
    INFO: Send detach request
    INFO: Receive DFU Detach
    INFO: DFU USB STOP...
    INFO: BL2: Loading image id 31
    INFO: Loading image id=31 at address 0x2ffff000
    WARNING: Image id=31 size out of bounds
    ERROR: BL2: Failed to load image id 31 (-27)
    Here is flash-layout file:
    #Opt Id Name Type IP Offset Binary
    - 0x01 fsbl-boot Binary none 0x0
    ./tf-a-stm32mp157a-stm32mp151-dk1-mx-usb.stm32
    - 0x03 fip-boot Binary none 0x0
    ./fip-stm32mp157a-stm32mp151-dk1-mx-trusted.bin
    #P 0x04 fsbl1 Binary mmc0 boot1
    ../../arm-trusted-firmware/tf-a-stm32mp157a-stm32mp151-dk1-mx-trusted.stm32
    #P 0x05 fsbl2 Binary mmc0 boot2
    ../../arm-trusted-firmware/tf-a-stm32mp157a-stm32mp151-dk1-mx-trusted.stm32
    #P 0x06 ssbl Binary mmc0 0x00080000
    ../../bootloader/u-boot-stm32mp157a-stm32mp151-dk1-mx-trusted.stm32
    #P 0x21 boot System mmc0 0x00280000
    ../../st-image-bootfs-openstlinux-weston-stm32mp1-disco-mx.ext4
    #P 0x22 vendorfs FileSystem mmc0 0x04280000
    ../../st-image-vendorfs-openstlinux-weston-stm32mp1-disco-mx.ext4
    #P 0x23 rootfs FileSystem mmc0 0x05280000
    ../../st-image-weston-openstlinux-weston-stm32mp1-disco-mx.ext4
    #P 0x24 userfs FileSystem mmc0 0x33C80000
    ../../st-image-userfs-openstlinux-weston-stm32mp1-disco-mx.ext4
    Here is CubeMXProgrammer output:
    Technical Moderator
    May 31, 2021

    Hi,

    Btw, your fail is within TF-A.

    I suspect something not well formed in the uBoot FIP image around FW_CONFIG size.

    On Flashing DK2, I see :

    INFO:   Loading image id=31 at address 0x2ffff000

    INFO:   Image id=31 loaded: 0x2ffff000 - 0x2ffff226

    INFO:   FCONF: Reading FW_CONFIG firmware configuration file from: 0x2ffff000

    INFO:   FCONF: Reading firmware configuration information for: dyn_cfg

    INFO:   FCONF: Reading firmware configuration information for: stm32mp1_firewall

    Note that device column = mmc0 mean SD-Card on SDMMC.

    To build a Serial-NAND CubeProgrammer Flashlayout, please have a look to https://wiki.st.com/stm32mpu/wiki/STM32CubeProgrammer_flashlayout#NAND_Flash_memory_with_FIP

    Device column should be spi-nand0 and offset to be carefully selected (see also https://wiki.st.com/stm32mpu/wiki/STM32MP15_Flash_mapping#NAND_memory_mapping)

    Regards