cancel
Showing results for 
Search instead for 
Did you mean: 

STM32MP1 ECO 5.0.0 TF-A, Optee. U-boot Build sequence

debugging
Lead

These are the steps in chronological order to be able to build the files for a custom board. This seems very convoluted and easily confusing. I this process correct  ? The issues normally are not found with the STM board because all the pre-build files are already in the fip  and other source folders, but for a custom board they are not, hence the issues.

Build sequence:
=================
* Install the SDK
* SDK source set to the arm toolchain
* Extracted all the sources and applied the patches
* Copied the device tree files from CubeMX to the respective folders.
* Updated the makefiles.sdk with the the new board name.
* Added the device tree file name to the makefiles in fdts and dts sub-folders (TF-A / u-boot)
* Set the $FIP_DEPLOYDIR_FIP' and $FIP_DEPLOYDIR_ROOT
* Deleted all the custom board files under $FIP_DEPLOYDIR_ROOT that were built before during trial (& error)

Steps and issues encountered in chronological order:

1. Build u-boot
make -f $PWD/../Makefile.sdk all UBOOT_CONFIG=optee UBOOT_DEFCONFIG=stm32mp15_trusted_defconfig UBOOT_BINARY=u-boot.dtb DEVICETREE="stm32mp157a-custom-board"
Missing stm32mp157a-custom-board-fw-config-optee.dtb file in folder: $FIP_DEPLOYDIR_FWCONF or '$FIP_DEPLOYDIR_ROOT/arm-trusted-firmware/fwconfig'

2. Build TF-A
make -f $PWD/../Makefile.sdk all
Missing u-boot-stm32mp157a-custom-board.dtb file in folder: '$FIP_DEPLOYDIR_UBOOT' or '$FIP_DEPLOYDIR_ROOT/u-boot'
copy u-boot-stm32mp157a-custom-board.dtb generated by u-boot to $FIP_DEPLOYDIR_ROOT/u-boot

3. Build TF-A
make -f $PWD/../Makefile.sdk all
Missing tee-header_v2-stm32mp157a-custom-board.bin file in folder: '$FIP_DEPLOYDIR_OPTEE' or '$FIP_DEPLOYDIR_ROOT/optee'
Missing tee-pager_v2-stm32mp157a-custom-board.bin file in folder: '$FIP_DEPLOYDIR_OPTEE' or '$FIP_DEPLOYDIR_ROOT/optee'
Missing tee-pageable_v2-stm32mp157a-custom-board.bin file in folder: '$FIP_DEPLOYDIR_OPTEE' or '$FIP_DEPLOYDIR_ROOT/optee'

4. Build Optee
make -f $PWD/../Makefile.sdk all
Missing stm32mp157a-custom-board-fw-config-optee.dtb file in folder: $FIP_DEPLOYDIR_FWCONF or '$FIP_DEPLOYDIR_ROOT/arm-trusted-firmware/fwconfig'
copy stm32mp157a-custom-board-fw-config-optee.dtb generated by TF-A to $FIP_DEPLOYDIR_ROOT/arm-trusted-firmware/fwconfig

5. Build Optee
make -f $PWD/../Makefile.sdk all
Optee succeeds

6. Build U-boot
make -f $PWD/../Makefile.sdk all UBOOT_CONFIG=optee UBOOT_DEFCONFIG=stm32mp15_trusted_defconfig UBOOT_BINARY=u-boot.dtb DEVICETREE="stm32mp157a-custom-board"
Missing tee-header_v2-stm32mp157a-custom-board.bin file in folder: '$FIP_DEPLOYDIR_OPTEE' or '$FIP_DEPLOYDIR_ROOT/optee'

7. Build TF-A
make -f $PWD/../Makefile.sdk all
Missing tee-header_v2-stm32mp157a-custom-board.bin file in folder: '$FIP_DEPLOYDIR_OPTEE' or '$FIP_DEPLOYDIR_ROOT/optee'
copy tee-header_v2-stm32mp157a-<board>.bin from optee/deploy to $FIP_DEPLOYDIR_ROOT/optee
copy tee-pager_v2-stm32mp157a-<board>.bin from optee/deploy to $FIP_DEPLOYDIR_ROOT/optee
copy tee-pageable_v2-stm32mp157a-custom-board.bin from optee/deploy to $FIP_DEPLOYDIR_ROOT/optee

8. Build TF-A
make -f $PWD/../Makefile.sdk all
TF-A succeeds but does not place the optee.bin in the /fip folder
Though, the generated fip file can be found in the fip folder under the u-boot sources.

9. Build u-boot
make -f $PWD/../Makefile.sdk all UBOOT_CONFIG=optee UBOOT_DEFCONFIG=stm32mp15_trusted_defconfig UBOOT_BINARY=u-boot.dtb DEVICETREE="stm32mp157a-custom-board"
u-boot succeeds

Reduced process to prevent errors
==========================================

1. Build u-boot
Fails because of missing stm32mp157a-<board>-fw-config-optee.dtb file in folder: $FIP_DEPLOYDIR_FWCONF or '$FIP_DEPLOYDIR_ROOT/arm-trusted-firmware/fwconfig'
But it generates the .dtb files needed for TF-A
copy u-boot-stm32mp157a-<board>.dtb from deploy to FIP_artifacts/u-boot

2. Build Optee
Fails because it cannot find fw-config-optee.dtb (From TF-A) but the tee-header and tee-pager file are which TF-A needs but it generates the following files needed for TF-A
copy tee-header_v2-stm32mp157a-<board>.bin from deploy to $FIP_DEPLOYDIR_ROOT/optee
copy tee-pager_v2-stm32mp157a-<board>.bin from deploy to $FIP_DEPLOYDIR_ROOT/optee
copy tee-pageable_v2-stm32mp157a-custom-board.bin from deploy to $FIP_DEPLOYDIR_ROOT/optee

3. Build TF-A
Now succeeds
copy stm32mp157a-custom-board-fw-config-optee from deploy to $FIP_DEPLOYDIR_ROOT/arm-trusted-firmware/fwconfig for Optee
get the fip-stm32mp157a-custom-board-optee.bin from the u-boot/deploy/fip folder for the flashing.

4. Build Optee
Now succeeds

5. Build u-boot
Now succeeds

Key issue:
==================

It seems there are circular dependencies where  partial build outputs from one repo provides outputs to complete the other,  then with those partial outputs returning the original repo to complete build: as follows:

[a]  TF-A depends on the output of u-boot and outputs from OPTEE

[b]  OPTEE depends on the outputs from TF-A

[c] UBOOT depends on the outputs of OPTEE and TF-A. 

Can't really believe this should be normal. what is wrong in the above process ?

 

Issues and solutions
================

TF-A does not copy the metadata.bin and tfa-stm32mp157a-custom-board-<usb/scard/emmc/nand/nor/uart>.stm32 files to the $FIP_DEPLOYDIR_ROOTFIP/arm-trusted-firmware folder
Manually copy TF-A/deploy/metadata.bin to $FIP_DEPLOYDIR_ROOTFIP/arm-trusted-firmware
Manually copy TF-A/deploy/*.stm32 files to $FIP_DEPLOYDIR_ROOTFIP/arm-trusted-firmware
TF-A did not place the stm32mp157a-custom-board-fw-config-optee.dtb in $FIP_DEPLOYDIR_ROOT/arm-trusted-firmware/fwconfig
manually copy from tf-a/deploy/stm32mp157a-custom-board-fw-config-optee.dtb to $FIP_DEPLOYDIR_ROOT/arm-trusted-firmware/fwconfig
TF-A did not place the fip-stm32mp157a-custom-board-optee.bin in the $FIP_DEPLOYDIR_ROOT or $FIP_DEPLOYDIR_FIP folder
manually copy from u-boot/deploy/fip/fip-stm32mp157a-custom-board-optee.bin to $FIP_DEPLOYDIR_ROOT/fip

U-boot did not place the u-boot-stm32mp157a-custom-board.dtb in it's local deploy in the $FIP_DEPLOYDIR_ROOT/u-boot folder
manually copy the u-boot/deploy/u-boot-stm32mp157a-custom-board.dtb to $FIP_DEPLOYDIR_ROOT/u-boot
u-boot did not place the fip-stm32mp157a-custom-board-optee.bin in $FIP_DEPLOYDIR_ROOT/fip
manually copy trom u-boot/deployfip-stm32mp157a-custom-board-optee.bin to $FIP_DEPLOYDIR_ROOT/fip

Optee did not place the bin files in the $FIP_DEPLOYDIR_ROOTs/optee folder
manually copy optee/deploy/tee-header_v2-stm32mp157a-custom-board.bin to $FIP_DEPLOYDIR_ROOT/optee
manually copy optee/deploy/tee-pager_v2-stm32mp157a-custom-board.bin to $FIP_DEPLOYDIR_ROOT/optee
manually copy opte//deploy/tee-pageable_v2-stm32mp157a-custom-board.binto $FIP_DEPLOYDIR_ROOT/optee

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
debugging
Lead

Now not using any of the ST board data anymore (except for "defconfig") and avoiding the makefile.sdk that keeps bumping into "missing files" ,which  kept occurring after restarting from a clean SDK and source files. Now compilation is easy to understand what it does. I have to disagree that is was my bad use of the SDK.

View solution in original post

3 REPLIES 3
Olivier GALLIEN
ST Employee

Hi @debugging ,

Sorry, this post and all other one where you encounter issues with FIP seems to highlight a lake of guidance from our side. 

All troubles you encounter came from a bad usage of Developer Package and the fact you want to build all your BSP from scratch after doing : 

* Deleted all the custom board files under $FIP_DEPLOYDIR_ROOT that were built before during trial (& error)

As stated in Which STM32MPU Embedded Software Package better suits your needs - stm32mpu

Developper Package is made to modify or tune piece of code one by one starting from an already existing set of binary which are Starter Package. 

So you might compile each BSP element one by one letting the Starter Package binary present in FIP_artefact folder. 

Alternative for your need to generate complete BSP from CubeMX DTS coud be to use Distribution package either playing component by component with devtool 

How to cross-compile with the Distribution Package - stm32mpu

or generating complete image with a new machine with CubeMX DTS : 

How to create your own machine - stm32mpu

We will work to improve visibily on this guidance. 

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.

This is valuable information, but wish this was mentioned in the wiki. A separate WIki (not just one post) how to bring up a custom (board from a 3rd party or not or with a MPU socketed piggy back) step by step would be very useful. Now I used CubeMX to start from scratch as a clean sheet instead of trying to adopt from the dev package which only seem to work for ST boards and also build all the packages and FIP one by one manually instead of using the .sdk files. After manual changes of the DT''s and clock settings something is starting to work but probably there is still a long way ahead before I will see the Linux console due to the huge changes in ECO 5.0

debugging
Lead

Now not using any of the ST board data anymore (except for "defconfig") and avoiding the makefile.sdk that keeps bumping into "missing files" ,which  kept occurring after restarting from a clean SDK and source files. Now compilation is easy to understand what it does. I have to disagree that is was my bad use of the SDK.