How do I build and boot ATF and OP-TEE?
Hi! It's my understanding that ST are moving a lot of work for power management and clocking out of ATF and to OP-TEE. In preparation for this shift my co-developer and I have started out trying to build and run the following software on the STM32MP157F-DK2:
- linux v5.15-stm32mp-r1
- u-boot v2021.10-stm32mp-r1
- arm-trusted-firmware v2.6-stm32mp-r1
- optee_os 3.16.0-stm32mp-r1
Unfortunately the only serial output we get is:
NOTICE: CPU: STM32MP157FAC Rev.Z
NOTICE: Model: STMicroelectronics STM32MP157F-DK2 Discovery Board
NOTICE: Board: MB1272 Var4.0 Rev.C-02
NOTICE: BL2: v2.6-stm32mp1-r1.0(release):v2.6-stm32mp-r1
NOTICE: BL2: Built : 19:38:48, Jun 23 2022
NOTICE: BL2: Booting BL32Build commands are:
build optee:
make ARCH=arm CROSS_COMPILE=/opt/armv7-eabihf--glibc--bleeding-edge-2021.11-1/bin/arm-linux- CFG_EMBED_DTB_SOURCE_FILE=stm32mp157f-dk2.dts PLATFORM=stm32mp1 -j16
build ATF:
make CROSS_COMPILE=/opt/armv7-eabihf--glibc--bleeding-edge-2021.11-1/bin/arm-linux- PLAT=stm32mp1 ARCH=aarch32 ARM_ARCH_MAJOR=7 DTB_FILE_NAME=stm32mp157f-dk2.dtb STM32MP_SDMMC=1 -j16
build fip:
make CROSS_COMPILE=/opt/armv7-eabihf--glibc--bleeding-edge-2021.11-1/bin/arm-linux- PLAT=stm32mp1 ARCH=aarch32 ARM_ARCH_MAJOR=7 AARCH32_SP=optee DTB_FILE_NAME=stm32mp157f-dk2.dtb BL33=../u-boot/u-boot-nodtb.bin BL33_CFG=../u-boot/u-boot.dtb BL32=../optee_os/out/arm-plat-stm32mp1/core/tee-header_v2.bin BL32_EXTRA1=../optee_os/out/arm-plat-stm32mp1/core/tee-pager_v2.bin BL32_EXTRA2=../optee_os/out/arm-plat-stm32mp1/core/tee-pageable_v2.bin fip -j16This is using the latest Bootlin toolchain.
Trying with ATF v2.4 produces an error about hashing:
NOTICE: CPU: STM32MP157FAC Rev.Z
NOTICE: Model: STMicroelectronics STM32MP157F-DK2 Discovery Board
NOTICE: Board: MB1272 Var4.0 Rev.C-02
NOTICE: BL2: v2.4-r2.0(release):v2.4-stm32mp-r2
NOTICE: BL2: Built : 19:45:55, Jun 23 2022
NOTICE: BL2: Booting BL32
E/TC:0 0 init_runtime:476 Hash failed for page 3 at 0x29803000: res 0xffff000f
E/TC:0 0 PanicATF v2.6 with an older OP-TEE v3.12 produces a different hashing error:
NOTICE: CPU: STM32MP157FAC Rev.Z
NOTICE: Model: STMicroelectronics STM32MP157F-DK2 Discovery Board
NOTICE: Board: MB1272 Var4.0 Rev.C-02
NOTICE: BL2: v2.6-stm32mp1-r1.0(release):v2.6-stm32mp-r1
NOTICE: BL2: Built : 19:29:05, Jun 23 2022
NOTICE: BL2: Booting BL32
I/TC: Early console on UART#4
I/TC:
I/TC: Pager is enabled. Hashes: 2080 bytes
E/TC:0 0 init_runtime:464 Hash failed for page 0 at 0x29600000: res 0xffff000f
E/TC:0 0 PanicFinally, building with both older versions ATF v2.4 and OP-TEE v2.13 gives this:
NOTICE: CPU: STM32MP157FAC Rev.Z
NOTICE: Model: STMicroelectronics STM32MP157F-DK2 Discovery Board
NOTICE: Board: MB1272 Var4.0 Rev.C-02
NOTICE: BL2: v2.4-r2.0(release):v2.4-stm32mp-r2
NOTICE: BL2: Built : 19:04:12, Jun 23 2022
NOTICE: BL2: Booting BL32
I/TC: Early console on UART#4
I/TC:
I/TC: Pager is enabled. Hashes: 2080 bytes
I/TC: Pager pool size: 100kB
I/TC: Non-secure external DT found
I/TC: Embedded DTB found
I/TC: OP-TEE version: 3.12.0-stm32mp-r2 (gcc version 11.2.0 (Buildroot toolchains.bootlin.com-2021.11-1)) #1 Thu Jun 23 17:00:17 UTC 2022 arm
I/TC: Primary CPU initializing
I/TC: Platform stm32mp1: flavor PLATFORM_FLAVOR - DT stm32mp157f-dk2.dts
I/TC: DT clock tree configurations were ignored
I/TC: DTB enables console (non-secure)
I/TC: Primary CPU switching to normal world boot
E/LD: init_elf:437 sys_open_ta_bin(a8cfe406-d4f5-4a2e-9f8d-a25dc754c099)
E/TC:? 0 ldelf_init_with_ldelf:126 ldelf failed with res: 0xffff0009
E/LD: init_elf:437 sys_open_ta_bin(a8cfe406-d4f5-4a2e-9f8d-a25dc754c099)
E/TC:? 0 ldelf_init_with_ldelf:126 ldelf failed with res: 0xffff0009
E/LD: init_elf:437 sys_open_ta_bin(a8cfe406-d4f5-4a2e-9f8d-a25dc754c099)
E/TC:? 0 ldelf_init_with_ldelf:126 ldelf failed with res: 0xffff000cThe ldelf errors seem to be expected- but U-Boot serial output isn't shown either even though it seems to be trying to communicate via SCMI.
These same results are produced when building using buildroot and bumping package versions.
