Skip to main content
JKim.2
Associate III
August 10, 2023
Question

OPTEE header parse error on STM32MP135F-DK

  • August 10, 2023
  • 15 replies
  • 15987 views

Hello,

 

I'm changing the DDR3 size from 512MB to 1GB on the STM32MP135F-DK board. The modifications were done as below. After that, I met the OPTEE header parse error. Compilation and updating software on board was conducted according to the ST wiki. ( https://wiki.st.com/stm32mpu/wiki/How_to_cross-compile_with_the_Developer_Package ) Please help me to solve this problem.

change from 0x20000000 to 0x40000000

  • stm32mp135f-dk.dts in Linux Kernel, U-Boot, TF-A, and OP-TEE
  • stm32mp135f-dk-fw-config.dts in TF-A
  • stm32mp13-ddr3-1x8Gb-1066-binF.dtsi in TF-A (DDR_ADDRMAP6 0x0F070707 ==> 0x07070707)
  • conf.mk in OP-TEE

Thanks.


NOTICE: CPU: STM32MP135F Rev.Y
NOTICE: Model: STMicroelectronics STM32MP135F-DK Discovery Board
NOTICE: Board: MB1635 Var1.0 Rev.E-02
INFO: PMIC version = 0x21
INFO: Reset reason (0x35):
INFO: TF-A simple example hello
INFO: Power-on Reset (rst_por)
INFO: FCONF: Reading TB_FW firmware configuration file from: 0x2ffe0000
INFO: FCONF: Reading firmware configuration information for: stm32mp_io
INFO: Using SDMMC
INFO: Instance 1
INFO: Boot used partition fsbl1
NOTICE: BL2: v2.6-stm32mp1-r2.0(debug):()
NOTICE: BL2: Built : 07:56:58, Jul 28 2023
INFO: BL2: Doing platform setup
INFO: RAM: DDR3-1066 bin F 1x8Gb 533MHz v1.53
INFO: Memory size = 0x40000000 (1024 MB)
INFO: BL2: Loading image id 1
INFO: Loading image id=1 at address 0x30006000
INFO: Image id=1 loaded: 0x30006000 - 0x30006246
INFO: FCONF: Reading FW_CONFIG firmware configuration file from: 0x30006000
INFO: FCONF: Reading firmware configuration information for: mce_config
INFO: FCONF: Reading firmware configuration information for: dyn_cfg
INFO: FCONF: Reading firmware configuration information for: stm32mp1_firewall
INFO: BL2: Loading image id 4
INFO: Loading image id=4 at address 0xde200000
INFO: Image id=4 loaded: 0xde200000 - 0xde20001c
INFO: OPTEE ep=0xde200000
INFO: OPTEE header info:
INFO: magic=0x4554504f
INFO: version=0x2
INFO: arch=0x0
INFO: flags=0x0
INFO: nb_images=0x1
WARNING: The load address in optee header 0xfe200000 - 0xfe2792e8 is not in reserved area: 0xde200000 - 0xe0000000.
ERROR: OPTEE header parse error.
PANIC at PC : 0x2ffe82b9

Exception mode=0x00000016 at: 0x2ffe82b9

 

This topic has been closed for replies.

15 replies

debugging
Lead
September 28, 2023

The tos_fw in dtb is 0xFE200000 but TF-A fw in the error messages expects 0xDE00000. I think that's is very weird. With this do you still get the same error. P.S: It seems you run OP-TEE in DDR, not with paging. since there is no BL-32 Extra 2 entry in the header file. and also use use fdtdump <fw-config.dtb> insteado grep, the output wlll be easier to read.

Here are my dumps using OPTEE is SYSRAM, when you do not use SRAM for OPTEE in should load  ID#8 (BL32 extra 1) in 0xDE000000 (in my example) and skip ID#9.

Just my two cents. Hope ST can  give you a hand as well. (as well with my troubles...)

NOTICE: DEBUG: parse optee image #0
NOTICE: DEBUG: header->optee_image_list[num].image_id=0x0
NOTICE: DEBUG: OPTEE_PAGER_IMAGE_ID=0
NOTICE: DEBUG: OPTEE_PAGED_IMAGE_ID=1
NOTICE: DEBUG: init_load_addr=0x2ffc0000
NOTICE: DEBUG: init_size=0x12768
NOTICE: DEBUG: image_info->image_base=0x2ffc0000
NOTICE: DEBUG: image_info->image_max_size=0x22000
NOTICE: DEBUG: parse optee image #1
NOTICE: DEBUG: header->optee_image_list[num].image_id=0x1
NOTICE: DEBUG: OPTEE_PAGER_IMAGE_ID=0
NOTICE: DEBUG: OPTEE_PAGED_IMAGE_ID=1
NOTICE: DEBUG: parse_optee_imageNOTICE: DEBUG: init_load_addr=0xde000000
NOTICE: DEBUG: init_size=0x54000
NOTICE: DEBUG: image_info->image_base=0xde000000
NOTICE: DEBUG: image_info->image_max_size=0x2000000
INFO: BL2: Loading image id 8
INFO: Loading image id=8 at address 0x2ffc0000
INFO: Image id=8 loaded: 0x2ffc0000 - 0x2ffd2768
INFO: BL2: Loading image id 9
INFO: Loading image id=9 at address 0xde000000
INFO: Image id=9 loaded: 0xde000000 - 0xde054000
INFO: BL2: Loading image id 2
INFO: Loading image id=2 at address 0xc0500000
INFO: Image id=2 loaded: 0xc0500000 - 0xc051ecf0
INFO: BL2: Skip loading image id 16
INFO: BL2: Loading image id 5
INFO: Loading image id=5 at address 0xc0100000
INFO: Image id=5 loaded: 0xc0100000 - 0xc01ffa14
NOTICE: BL2: Booting BL32
INFO: Entry point address = 0x2ffc0000
INFO: SPSR = 0x1d3

 

JKim.2
JKim.2Author
Associate III
October 3, 2023

@Bernard PUEL @Olivier GALLIEN Hello, previously I failed with the bigger 1GB. I tried smaller 256MB according to the wiki guidance. (  How to configure a 256MB DDR mapping from STM32 MPU Distribution Package - stm32mpu )

I see the mce_config error as below. Do you have some ideas why the error happens?

Thanks.

Jeff

NOTICE: CPU: STM32MP135F Rev.Y
NOTICE: Model: STMicroelectronics STM32MP135F-DK Discovery Board
NOTICE: Board: MB1635 Var1.0 Rev.E-02
INFO: PMIC version = 0x21
INFO: Reset reason (0x74):
INFO: TF-A simple example hello
INFO: System reset generated by MPU (MPSYSRST)
INFO: FCONF: Reading TB_FW firmware configuration file from: 0x2ffe0000
INFO: FCONF: Reading firmware configuration information for: stm32mp_io
INFO: Using SDMMC
INFO: Instance 1
INFO: Boot used partition fsbl1
NOTICE: BL2: v2.6-stm32mp1-r2.0(debug):()
NOTICE: BL2: Built : 07:56:58, Jul 28 2023
INFO: BL2: Doing platform setup
INFO: RAM: DDR3-1066 bin F 1x2Gb 533MHz v1.53
INFO: Memory size = 0x10000000 (256 MB)
INFO: BL2: Loading image id 1
INFO: Loading image id=1 at address 0x30006000
INFO: Image id=1 loaded: 0x30006000 - 0x30006246
INFO: FCONF: Reading FW_CONFIG firmware configuration file from: 0x30006000
INFO: FCONF: Reading firmware configuration information for: mce_config
ERROR: MCE: start/end address higher than physical end
PANIC at PC : 0x2ffe6f67

Exception mode=0x00000016 at: 0x2ffe6f67

Bernard PUEL
Technical Moderator
October 11, 2023

Hello Jeff, I think it is easier for you to keep 1GB DDR size except if you are targeting for your product to reduce the DDR for the final product.
Let me know if this is the case and I will provide some reference DT for a board with 1GB DDR.

About the error above, it is related to MCE. MCE is the IP that will encrypt the DDR during run time. OPTEE use this capability so I guess you did an error in OPTEE DT or maybe your FIP binary was not updated during your build. 

JKim.2
JKim.2Author
Associate III
October 12, 2023

Hello Bernard,

Both 256MB and 1GB are my target to achieve. 1GB was the higher priority to me. If you have a referece files, please let me have them. Thanks.

Bernard PUEL
Technical Moderator
October 13, 2023
Bernard PUEL
Technical Moderator
October 13, 2023

The file above is a tarball + 7zipped of BSP ST internal boards.

Your interest for 1GB reference is:

  • stm32mp135.dtsi + stm32mp13xf.dtsi + stm32mp13-pinctrl.dtsi + stm32mp135f-ede.dts = stm32mp135f-ede board (DDR3 1GB)
  • stm32mp135f-ede.dts + stm32mp15xx-evx.dtsi + stm32mp135f-eve.dts = stm32mp135f-eve board (DDR3 1GB)
Bernard PUEL
Technical Moderator
October 13, 2023

Please also check your DDR settings in CubeMx that will generate the DDR ctrl settings files, Especially these settings: 

#define DDR_MEM_SIZE
#define DDR_ADDRMAP6

 

JKim.2
JKim.2Author
Associate III
October 26, 2023

Hello Bernard,

For 1GB, DDR_MEM_SIZE 0x40000000 and DDR_ADDRMAP6 0x07070707 were used accordingly.

I referred to DT files of stm32mp135f-ede.dts in your compressed file. Previously, I add reserved-memory for optee_framebuffer and optee for every device tree. The referece device tree doesn't have the reserved-memory for TF-A DT. I followed the example but it can't be booted as below.

<<<<<<<<<<< u-boot DT >>>>>>>>>>>>>

reserved-memory {
#address-cells = <1>;
#size-cells = <1>;
ranges;

optee_framebuffer@fd000000 {
reg = <0xfd000000 0x1000000>;
no-map;
};

optee@fe000000 {
reg = <0xfe000000 0x2000000>;
no-map;
};
};

 

<<<<<<<<<< boot log >>>>>>>>>>>>

NOTICE: CPU: STM32MP135F Rev.Y
NOTICE: Model: STMicroelectronics STM32MP135F-DK Discovery Board
NOTICE: Board: MB1635 Var1.0 Rev.E-02
INFO: PMIC version = 0x21
INFO: Reset reason (0x35):
INFO: TF-A simple example hello
INFO: Power-on Reset (rst_por)
INFO: FCONF: Reading TB_FW firmware configuration file from: 0x2ffe0000
INFO: FCONF: Reading firmware configuration information for: stm32mp_io
INFO: Using SDMMC
INFO: Instance 1
INFO: Boot used partition fsbl1
NOTICE: BL2: v2.6-stm32mp1-r2.0(debug):()
NOTICE: BL2: Built : 07:56:58, Jul 28 2023
INFO: BL2: Doing platform setup
INFO: RAM: DDR3-1066 bin F 1x8Gb 533MHz v1.53
INFO: Memory size = 0x40000000 (1024 MB)
INFO: BL2: Loading image id 1
INFO: Loading image id=1 at address 0x30006000
INFO: Image id=1 loaded: 0x30006000 - 0x30006246
INFO: FCONF: Reading FW_CONFIG firmware configuration file from: 0x30006000
INFO: FCONF: Reading firmware configuration information for: mce_config
INFO: FCONF: Reading firmware configuration information for: dyn_cfg
INFO: FCONF: Reading firmware configuration information for: stm32mp1_firewall
INFO: BL2: Loading image id 4
INFO: Loading image id=4 at address 0xde200000
INFO: Image id=4 loaded: 0xde200000 - 0xde20001c
INFO: OPTEE ep=0xde200000
INFO: OPTEE header info:
INFO: magic=0x4554504f
INFO: version=0x2
INFO: arch=0x0
INFO: flags=0x0
INFO: nb_images=0x1
WARNING: The load address in optee header 0xfe200000 - 0xfe2792e8 is not in reserved area: 0xde200000 - 0xe0000000.
ERROR: OPTEE header parse error.
PANIC at PC : 0x2ffe82b9

Exception mode=0x00000016 at: 0x2ffe82b9