2024-08-04 02:17 PM
I need som help about constructing a FlashLayout file for CubeProgrammer. I have a template of a FlashLayout for the STM32MP1 processor.
#opt Id Name Type Device Offset Binary
- 0x01 fsbl-boot Binary none 0x00000000 tf-a-usb.stm32
- 0x03 fip-boot FIP none 0x00000000 fip.bin
P 0x04 fsbl1 Binary mmc0 0x00004400 tf-a-sdcard.stm32
P 0x05 fsbl2 Binary mmc0 0x00044400 tf-a-sdcard.stm32
P 0x06 metadata1 FWU_MDATA mmc0 0x00084400 metadata.bin
P 0x07 metadata2 FWU_MDATA mmc0 0x000C4400 metadata.bin
P 0x08 fip-a FIP mmc0 0x00104400 fip.bin
PED 0x09 fip-b FIP mmc0 0x00504400 none
PED 0x09 u-boot-env ENV mmc0 0x00904400 none
P 0x10 bootfs System mmc0 0x00984400 bootfs.ext4
P 0x11 vendorfs FileSystem mmc0 0x04984400 vendorfs.ext4
P 0x12 rootfs FileSystem mmc0 0x05984400 rootfs.ext4
P 0x13 userfs FileSystem mmc0 0x33984400 userfs.ext4
I have installed the SDK and Sources inside CubeIDE. I have two questions in this thread:
1. If I want to flash my eMMC, which is connected to SDEMMC2 in CubeIDE. Should I then rename mmc0 to mmc2 inside the FlashLayout? I don't have a SD slot soldered to my custom board. My goal is just flashing the eMMC directly via USB and then boot from eMMC (BOOT pins = [0 1 0])
2. If I want to the create tf-a-usb.stm32 file. Is this the correct way to build it with.
make -f $PWD/../Makefile.sdk TF_A_DEVICETREE=stm32mpX-<project name>-mx TF_A_CONFIG=usb FIP_CONFIG=optee-emmc stm32
I'm reading the "HOW TO.txt" file: https://github.com/STMicroelectronics/meta-st-stm32mp/blob/mickledore/recipes-bsp/trusted-firmware-a/tf-a-stm32mp/README.HOW_TO.txt about building the tf-a. But it does not explain which command/parameter I should use to achieve a specific output file. Also, both u-boot and tf-a can produce a .bin file with the same name. So there are a lot of confusions here.
I my case, I don't have a SD-card slot and I want to boot from eMMC and flashing the eMMC with the USB.
Yes, I have read the Wiki(STM32MPU Developer Package - stm32mpu) many times. The good news that I can now build tf-a, linux, op-tee, u-boot in CubeIDE without errors.
2024-08-04 11:47 PM
Hi @DMårt
the eMMC flashlayout example if here https://wiki.st.com/stm32mpu/wiki/STM32CubeProgrammer_flashlayout#e-E2-80-A2MMC
it is almost the same we are using in Starter Package for STM32MP157F-EV1 board (FlashLayout_emmc_stm32mp157f-ev1-optee.tsv)
Notice that numbering of peripheral with Linux is not always aligned with physical numbering of IPs (e.g. in most cases, mmc0 is SDMMC1 and mmc1 is SDMMC2). This is because Linux assign automatically the instance numbers. starting from 0.
Regards.
2024-08-05 03:30 AM
@PatrickFThank you for your reply.
The build commands for STM32MP157F-EV1 board. Can I just use the same build commands as for my processor when I build?
I can see that both U-boot and tf-a can build fip.bin files. So which one should I use?
Is there any specific order how I run the build artifacts?
2024-08-05 09:47 AM
Hi @PatrickF
Here is an example where I'm trying to build with "optee-emmc" instead of "optee-sdcard". You can see that there is no rule for "optee-emmc", even if "optee-emmc" is written inside the Make.sdk file.
So why does this occurs?
18:45:07 **** Build of configuration Default for project STM32-Computer-Firmware_CA7_tf-a-2.8.15-r2 ****
make -f ../Makefile.sdk.ide TF_A_DEVICETREE=stm32mp151a-stm32-computer-firmware-mx TF_A_CONFIG=optee-emmc stm32 metadata
Wrapper for /opt/st/stm32cubeide_1.16.0/plugins/com.st.stm32cube.ide.mpu.linux.toolchain_2.1.0.202305092038/tools/bin/make
FIP_DEPLOYDIR_ROOT: /home/lubuntu/Dokument/GitHub/STM32-Computer/Firmware/STM32-Computer-Firmware/CA7/tf-a-2.8.15-r2/tf-a-stm32mp-v2.8.15-stm32mp-r2/../../FIP_artifacts
+ case "$command" in
+ exec make -f ../Makefile.sdk.ide TF_A_DEVICETREE=stm32mp151a-stm32-computer-firmware-mx TF_A_CONFIG=optee-emmc stm32 metadata
make[1]: Nothing to be done for 'all'.
make[1]: Entering directory '/home/lubuntu/Dokument/GitHub/STM32-Computer/Firmware/STM32-Computer-Firmware/CA7/tf-a-2.8.15-r2/tf-a-stm32mp-v2.8.15-stm32mp-r2'
Including bl32/optee/optee.mk
Trusted Firmware-A built for OP-TEE payload support
PSA_FWU_SUPPORT is an experimental feature
make[1]: *** No rule to make target '/home/lubuntu/Dokument/GitHub/STM32-Computer/Firmware/STM32-Computer-Firmware/CA7/tf-a-2.8.15-r2/tf-a-stm32mp-v2.8.15-stm32mp-r2/../build/optee-emmc-stm32mp15-stm32mp151a-stm32-computer-firmware-mx/fdts/stm32mp151a-stm32-computer-firmware-mx-bl2.pre.dts', needed by '/home/lubuntu/Dokument/GitHub/STM32-Computer/Firmware/STM32-Computer-Firmware/CA7/tf-a-2.8.15-r2/tf-a-stm32mp-v2.8.15-stm32mp-r2/../build/optee-emmc-stm32mp15-stm32mp151a-stm32-computer-firmware-mx/fdts/stm32mp151a-stm32-computer-firmware-mx-bl2.dtb'. Stop.
make[1]: Leaving directory '/home/lubuntu/Dokument/GitHub/STM32-Computer/Firmware/STM32-Computer-Firmware/CA7/tf-a-2.8.15-r2/tf-a-stm32mp-v2.8.15-stm32mp-r2'
make: *** [../Makefile.sdk:232: tf-optee-emmc-stm32mp15] Error 1
"make -f ../Makefile.sdk.ide TF_A_DEVICETREE=stm32mp151a-stm32-computer-firmware-mx TF_A_CONFIG=optee-emmc stm32 metadata" terminated with exit code 2. Build might be incomplete.
18:45:11 Build Failed. 2 errors, 0 warnings. (took 3s.637ms)
2024-08-07 10:37 PM
hi @PatrickF
Actually i try to flash optee file into EMMC using cubeprogrammer. but it give the error the EMMC device 0 not found.
please help me out this.
2024-08-08 03:38 AM
eMMC is on SDMMC2. So you need to change that inside the Device Tree .dts files. They can be automatic generated in STM32CubeIDE.