OPTEE on iMX8QXP with fspi boot

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

OPTEE on iMX8QXP with fspi boot

Jump to solution
602 Views
mod42
Contributor III

Currently I try to get an OPTEE enabled image to work on our custom iMX8QXP board with 1GB of RAM. I followed AN13275 as closely as possible (building ATF, SCFW, OP-TEE OS) and creating the final image with 

 

make SOC=iMX8QX REV=C0 flash_spl_flexspi

 

The resulting binary is around 2MB in size which makes sense to me. Flashing this image to our board results in the following U-Boot output

 

U-Boot SPL 2022.04-dirty (Sep 26 2023 - 12:00:52 +0000)
Normal Boot
Trying to boot from SPI
Primary set selected
Load image from QSPI 0x52800
UU

 

and the following output from SCFW

 

Hello from SCU (Build 5624, Commit 6638c032, Nov 02 2022 07:45:49)

GS on SCU UART (G444) (build on Nov  9 2023 14:55:45)

board_get_ram_size() is 16
SCFW:   DDR frequency = 1200000000
board_system_config(0, 0)
Start PMIC init
Finished  PMIC init

board_set_power_mode(A35, 0, 0, 3)
  ROM boot time = 57522 usec
      Boot time = 55883 usec
         Banner = 15054 usec
           Init = 9169 usec
         Config = 2838 usec
            DDR = 12619 usec
        SConfig = 2836 usec
           Prep = 10727 usec

*** Debug Monitor ***

>$ NOTICE:  Memreg 1 0x0 -- 0x1bffffff
NOTICE:  Memreg 2 0x34000000 -- 0x37ffffff
NOTICE:  Memreg 3 0x70000000 -- 0x7fffffff
NOTICE:  Memreg 4 0x80000000 -- 0xffffffff
NOTICE:  Memreg 5 0x400000000 -- 0x43fffffff
NOTICE:  Non-secure Partitioning Succeeded
NOTICE:  BL31: v2.6(release):OS026S00B12.OSQ-119-gbcc0f45ed7-dirty
NOTICE:  BL31: Built : 14:55:42, Nov  9 2023

 

Afterwards I don't see any additional output. If I build ATF without optee support U-Boot SPL is successfully starting U-Boot. Can you give me any hints on how to debug this further?

0 Kudos
1 Solution
514 Views
mod42
Contributor III

Hi

I got it working now. There where two remaining problems

  1. Setting BL32_BASE when building ATF

 

make PLAT=imx8qx SPD=opteed BL32_BASE=0xbe000000 bl31​

 

  • The tee.bin which is created in core/tee.bin when building optee-os is not the correct file to be used when creating the image. It must be created from tee.elf using

 

${CROSS_COMPILE}objcopy -O binary core/tee.elf tee.bin​

I got this information from this description here.

 

I have now /dev/tee0 available when booting into linux.

 

View solution in original post

0 Kudos
4 Replies
515 Views
mod42
Contributor III

Hi

I got it working now. There where two remaining problems

  1. Setting BL32_BASE when building ATF

 

make PLAT=imx8qx SPD=opteed BL32_BASE=0xbe000000 bl31​

 

  • The tee.bin which is created in core/tee.bin when building optee-os is not the correct file to be used when creating the image. It must be created from tee.elf using

 

${CROSS_COMPILE}objcopy -O binary core/tee.elf tee.bin​

I got this information from this description here.

 

I have now /dev/tee0 available when booting into linux.

 

0 Kudos
503 Views
mod42
Contributor III

Just to note an additional finding:

Using tee-raw.bin from optee-os build works also but results in much smaller flash image. This also is in sync with optee-os-fslc.inc copying tee-raw.bin to DEPLOYDIR

 

0 Kudos
570 Views
Harvey021
NXP TechSupport
NXP TechSupport

Have you checked the <3. Allocate memory region for non-secure world.>?

If OP-TEE is implemented, the memory region 0xFE000000 – 0xFFFFFFFF is used by OP-TEE by default, in
case that the DRMA size is equal to or greater than 2 GB. This is set in arm-trusted-firmware/ plat/imx/imx8qx/
platform.mk with BL32_BASE and BL32_SIZE.

But if the new board’s DRAM size is less then 2 GB, then BL32_BASE need to be modified to highest memory address – BL32_SIZE. For example, if DRAM size is 1 GB, BL32_BASE is 0xBE000000.

 

Best regards

Harvey

0 Kudos
567 Views
mod42
Contributor III

Yes, I adapted ATF using the following patch.

 

diff --git a/plat/imx/imx8qx/platform.mk b/plat/imx/imx8qx/platform.mk
index c4028a8a9..fbf5366a4 100644
--- a/plat/imx/imx8qx/platform.mk
+++ b/plat/imx/imx8qx/platform.mk
@@ -49,7 +49,7 @@ $(eval $(call add_define,ENABLE_L2_DYNAMIC_RETENTION))
 ifeq (${PLAT},imx8dx)
 BL32_BASE		?=	0x96000000
 else
-BL32_BASE		?=	0xfe000000
+BL32_BASE		?=	0xbe000000
 endif
 $(eval $(call add_define,BL32_BASE))

 

I then build ATF using the following command

 

make PLAT=imx8qx SPD=opteed bl31

My current BSP is based on lf-5.15.71-2.2.0

 

0 Kudos