2024-06-14 12:28 AM
I have been working with the Secure boot and OPTEE integration in my Custom board. All the repositories are maintained in kirkstone and I don't want to switch them to scarthgap yet. OPTEE works fine with non-secure system when trusted boot is disabled; everything works fine.
But when Trusted boot is enabled the size of BL2 increases by 20KB in the sysram and due to this reason the BL32 (OPTEE) when loaded in the sysram Panics the system because it doesn't find enough room to reside itself in the sysram.
Here are the error logs.
INFO: Memory size = 0x40000000 (1024 MB) INFO: DFU USB START... INFO: phase ID :3, Manifestation 3 at c717a63b INFO: Send detach request INFO: Receive DFU Detach INFO: DFU USB STOP... INFO: BL2: Loading image id 1 INFO: Loading image id=1 at address 0x2ffff000 INFO: Image id=1 loaded: 0x2ffff000 - 0x2ffff1fa INFO: FCONF: Reading FW_CONFIG firmware configuration file from: 0x2ffff000 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 0x2ffc0000 INFO: Image id=4 loaded: 0x2ffc0000 - 0x2ffc002c INFO: OPTEE ep=0x2ffc0000 INFO: OPTEE header info: INFO: magic=0x4554504f INFO: version=0x2 INFO: arch=0x0 INFO: flags=0x0 INFO: nb_images=0x2 WARNING: The load address in optee header 0x2ffc0000 - 0x2ffdf720 is not in reserved area: 0x2ffc0000 - 0x2ffdd000. ERROR: OPTEE header parse error. PANIC at PC : 0x2ffec935 Exception mode=0x00000016 at: 0x2ffec935
I have investigated the issue and have found the following findings related to the sizes of bootloader and BL32 and have created the following table.
****** Secure System ***** 0x2ffc0000 ----> BL32_DTB_BASE 0x5000 --------> BL32_DTB_SIZE 0x2ffc5000 ----> BL32_BASE 0x1c000 -------> BL32_SIZE 0x2ffdd000 ----> BL2_DTB_BASE 0x7000 --------> BL2_DTB_SIZE 0x2ffe4000 ----> BL2_BASE 0x1b000 -------> BL2_SIZE 0x2ffc5000 + 0x1c000 = 0x2ffe1000 (0x4000 into the BL2 BL2_DTB_BASE area.) ******** Non-Secure System ******** 0x2ffc0000 ----> BL32_DTB_BASE 0x5000 --------> BL32_DTB_SIZE 0x2ffc5000 ----> BL32_BASE 0x1c000 -------> BL32_SIZE 0x2ffe2000 ----> BL2_DTB_BASE 0x7000 --------> BL2_DTB_SIZE 0x2ffe9000 ----> BL2_BASE 0x16000 -------> BL2_SIZE 0x2ffc5000 + 0x1c000 = 0x2ffe1000 (Doesn't overlap the BL2_DTB_BASE.)
Can you please guide me to a solution here?