cancel
Showing results for 
Search instead for 
Did you mean: 

STM32MP15 ECO 5.0.0 unable to generate FIP bin files due to TF-A / Optee build tool issues

debugging
Lead

After building the TF-A from ECU 5.0.0 download (not the git). found the FIP folder and bin files. Deleted the FIP folder (export FIP_DEPLOYDIR_ROOT=$PWD/../../FIP_artifacts 

After running $ make -f $PWD/../Makefile.sdk all again the FIP folder and files are not generated anymore.Also tried make clean but no resolve.

Deleted the tf-a folder, restarted everything again (untar the tar etc...and followed all from the readme again ) but still not FIP folder or  files are generated, even the build does report the files were generate (see below output)

# for some reason this does not create the FIP folder and files  after the 1st time run ! it also delets the FIP_artifacts /arm... folder if run for a 2nd time ! this is the same with optee. Why is this designed this way ? the solution might be never ever run this:

$ make -f $PWD/../Makefile.sdk all

# for some reason this creates the FIP folder and output files but does not create default binaries

$ make -f $PWD/../Makefile.sdk DEPLOYDIR=$FIP_DEPLOYDIR_ROOT/arm-trusted-firmware all

How to regenerate FIP bin files to flash ?????

fiptool-stm32mp config:
optee:
bl32 config value: optee
devicetree config: stm32mp157c-ed1 stm32mp157f-ed1 stm32mp157a-ev1 stm32mp157c-ev1 stm32mp157d-ev1 stm32mp157f-ev1 stm32mp135f-dk stm32mp157a-dk1 stm32mp157d-dk1 stm32mp157c-dk2 stm32mp157f-dk2

Switch configuration:
FIP_BL31_ENABLE :

Output folders:
FIP_DEPLOYDIR_ROOT : /media/user/H3D2P1/Tools/STM32MP1/STM_ECO_5.0.0/Developer-Package/linux/stm32mp1-openstlinux-6.1-yocto-mickledore-mp1-v23.06.21/sources/arm-ostl-linux-gnueabi/tf-a-stm32mp-v2.8.6-stm32mp-r1-r0/tf-a-stm32mp-v2.8.6-stm32mp-r1/../../FIP_artifacts
FIP_DEPLOYDIR_FIP : /media/user/H3D2P1/Tools/STM32MP1/STM_ECO_5.0.0/Developer-Package/linux/stm32mp1-openstlinux-6.1-yocto-mickledore-mp1-v23.06.21/sources/arm-ostl-linux-gnueabi/tf-a-stm32mp-v2.8.6-stm32mp-r1-r0/tf-a-stm32mp-v2.8.6-stm32mp-r1/../../FIP_artifacts/fip
FIP_DEPLOYDIR_TFA : /media/user/H3D2P1/Tools/STM32MP1/STM_ECO_5.0.0/Developer-Package/linux/stm32mp1-openstlinux-6.1-yocto-mickledore-mp1-v23.06.21/sources/arm-ostl-linux-gnueabi/tf-a-stm32mp-v2.8.6-stm32mp-r1-r0/tf-a-stm32mp-v2.8.6-stm32mp-r1/../deploy/bl32
FIP_DEPLOYDIR_BL31 : /media/user/H3D2P1/Tools/STM32MP1/STM_ECO_5.0.0/Developer-Package/linux/stm32mp1-openstlinux-6.1-yocto-mickledore-mp1-v23.06.21/sources/arm-ostl-linux-gnueabi/tf-a-stm32mp-v2.8.6-stm32mp-r1-r0/tf-a-stm32mp-v2.8.6-stm32mp-r1/../deploy/bl31
FIP_DEPLOYDIR_FWCONF: /media/user/H3D2P1/Tools/STM32MP1/STM_ECO_5.0.0/Developer-Package/linux/stm32mp1-openstlinux-6.1-yocto-mickledore-mp1-v23.06.21/sources/arm-ostl-linux-gnueabi/tf-a-stm32mp-v2.8.6-stm32mp-r1-r0/tf-a-stm32mp-v2.8.6-stm32mp-r1/../deploy/fwconfig
FIP_DEPLOYDIR_OPTEE : /media/user/H3D2P1/Tools/STM32MP1/STM_ECO_5.0.0/Developer-Package/linux/stm32mp1-openstlinux-6.1-yocto-mickledore-mp1-v23.06.21/sources/arm-ostl-linux-gnueabi/tf-a-stm32mp-v2.8.6-stm32mp-r1-r0/tf-a-stm32mp-v2.8.6-stm32mp-r1/../../FIP_artifacts/optee
FIP_DEPLOYDIR_UBOOT : /media/user/H3D2P1/Tools/STM32MP1/STM_ECO_5.0.0/Developer-Package/linux/stm32mp1-openstlinux-6.1-yocto-mickledore-mp1-v23.06.21/sources/arm-ostl-linux-gnueabi/tf-a-stm32mp-v2.8.6-stm32mp-r1-r0/tf-a-stm32mp-v2.8.6-stm32mp-r1/../../FIP_artifacts/u-boot

 

24 REPLIES 24
debugging
Lead

I am assuming the script creates u-boot folder and the .dtb file. Correct ?/ If yes, it did not create the u-boot folder and if it needs that to complete the build, logically that does not work.

Are you using the latest tf-a repo from ECIO or git ?

A much  quicker way to build TF-A than going through the whole SDK/ECO download is: (make sure the SDK is set to $ARCH=arm)

$ git clone https://github.com/STMicroelectronics/arm-trusted-firmware.git
$ cd arm-trusted-firmware
$ git checkout -b WORKING v2.8-stm32mp-r12

# Get the Makefile.sdk from the STM ECO 5.0.0 TF-A repository and put it in the root above the source (because .sdk file is missing on git)

$ export FIP_DEPLOYDIR_ROOT=$PWD/../../FIP_artifacts

$ make -f $PWD/../Makefile.sdk all

debugging_0-1693352010898.png

 

debugging
Lead

Did the whole thing again on a different drive, under the home folder. same result, no FIP_artfacts folder. attached is thelog. you can see it builds the dtb with DTC but somehow they are not in the output folders. Are you using the   the latest Developer package image or git repo ?

and BTW on this page the Yocto and SDK links are reversed. https://www.st.com/en/embedded-software/stm32mp1dev.html

debugging_1-1693352638293.png

and BTW the wiki does not mention to first use ggzip -d en.SDK-x86_64-stm32mp1-openstlinux-6.1-yocto-mickledore-mp1-v23.06.21.tar.gz
https://wiki.st.com/stm32mpu/wiki/STM32MP1_Developer_Package#Building_and_deploying_the_TF-A_for_the_first_time

it may be a good thing if someone worked through the wiki and checks if all steps are correct.

 

I guess I understand now what is going on. The ECO system sources tar file contains the FIP artifacts folder already with  u-boot and optee folder with the binaries. The TF-A make won't generate those binaries. that is why when the FIP_artifacts  folder is deleted, the u-boot and optee binary folder and files are not generated.

The generated FIP images are available in <FIP_DEPLOYDIR_ROOT>/fip

debugging_0-1693372981041.png

This is now correct.

TF-A makefile.sdk does not  generates any files in the output folder except for /fip. but it needs the ub-boot and optee files in that folder. So if the FIP_artifacts_u-boot or optee is deleted you need to get them again from the original ECO sources tar file. It means when building TF-A from the repo from github, it is not possible to build all files in FIP_artifacts. That means,  the u-boot and optee files must be taken from the FIP_artifacts folder in the original ECO  sources tar, The github and ECO tar file README should mention this, or at least point where those u-boot and optee binaries can be found for a successful build..(if by accident or other reason the  files are deleted). I placed those FIP_artifact u-boot and optee folders in the ../../FIP_artifacts  folder for building from the git repo and the  fip's are now correctly created. The only one exception us the on failing is for my custom board dts That is due to the .bin file missing in the optee and u-boot  folder.

Now my question are

1. Outside  the ECO sources tar file, where can these FIP_artifacts u-boot and optee binaries be downloaded or how to generate them ?

2. For a custom board, where can the bin files for u-boot and optee be found ? Assume the u-boot and and optee binaries for the board be placed in the FIP_artifacts folder  for the TF-A build ? In other words, the optee and u-boot .bin files should be build BEFORE TF-A ?  I  added the dtb file from a trusted u-boot build of the custom board (renamed from uboot-,dtb to the board name as in the makefile.sdk) in the u-boot folder of FIP_artifacts manually and the build the  custom board .bin files are in the optee and in fip folders. It seems the TF-A script does not use the .dts file in the ftds folder to generate the dtb for the board. CubeMX generates a different .dts file for TF-A and u-boot. and I placed the dts of TF-A in the fdts folder and biuld u-boot.dtb with the u-boot dts file..

3. Did you try to  delete the FIP_artifacts folder as I stated in the OP, and does the make regenerate  the u-boot and optee binary files  ?

 

@debugging ,
You are right, that is why I asked if uboot file was already present in your artifact folder.

I think there was a misunderstanding concerning this folder so I will try to explain a little bit more how does it work, and I hope it will answer all your question in one.

Our BSP is composed by TF-A, UBOOT, OPTEE and Linux Kernel. We will keep the kernel out of this scope because it is not embedded in the FIP.

The Makefile.sdk with the all rule, both compile TF-A (this step is always good from your side) but also create the final FIP that will be deployed on the target.
But here, you are building only TF-A, so the new binaries that you you generate are only relative to TF-A ! It means that to compose your final FIP, you also need the U-Boot and OP-TEE binary files. But as you only compile TF-A, it will be impossible for the Makefile.sdk to invent U-boot and OP-TEE binaries, that is why we provide the FIP_artifacts folder. This is to provide you the other binaries that compose your FIP, and that are not generated by yourself.
If you erase these binaries, your FIP will be incomplete and ends with an error as you could have seen before in your case.

So, in a context of a custom board, how to process ?
In fact, in a custom board, you often have to update each element of the BSP.  So you will compile TF-A, U-boot, OP-TEE, and then create a new FIP (you can see it like a box) where you will put inside each binary needed and waited by the BSP.

If you want to take the default binaries provided by ST, you can find it in the Starter Package we deliver each release (in the Flash tarball (see this article)).

I hope you have now a better view of how the FIP works, and why you faced your issue before.

Kind regards,
Erwan.

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.

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.

Well , I think all this about the relation between these builds and the FIP folder + more should be in an article how to build for a custom board. That is probably what most developers need in the end. I know there is short article, but it's not enough. The information is loosely spread around and the developer needs to figure out out they tie together. BTW, I believe the sequence should be CubeMX => optee =>  u-boot => T-FA =>kernel > distro => flashing  But the developer package wiki puts u-boot, optee and T-FA in a different order and does not make clear how to they tie together.

Then, most confusing, the readme for TF-A should clearly define that it needs the files from u-boot and optee for the build boards stored in the FIP. The script could provide a clearre message when these are missing and that is is an ERROR (there is no word "error" when it goes wrong) . It should tell that the artifacts folder is not just only an output folder but also an input folder for the build).

So this all cost me 3 days of figuring this all out. I documented the whole process in an own file so I can do the whole step by step process in 30 minutes.

Lastly, I posted another message about the problem I have building with SCMI.  https://community.st.com/t5/stm32cubemx-mpu/stm32mp15-eco-5-0-0-cubemx-6-9-0-does-not-generate-scmi-file-for/td-p/585845  I suspect something is wrong with CubeMX and the generated device tree.