cancel
Showing results for 
Search instead for 
Did you mean: 

optee 3.12, stm32mp1 custom board and DRAM (256M) sizes.

milkylainen
Associate III

I have a custom board with a stm32mp151c and 256M DRAM.

Trying to get optee 3.12 from ecosystem 3.0.0 to start.

Everything works fine with tf-a 2.4-r1 and sp_min, u-boot 2020.10 etc.

But I can't get optee to start. I've enabled a high loglevel and the last print I get from optee is:

...

I/TC: Pager is enabled. Hashes: 2208 bytes

Then everything goes quiet. No stacktrace, fault, or anything else. Just "dead".

To me, this looks like some very basic issue with DRAM sizes etc. But I can't say for sure.

My dts looks correct with memory regions and declarations.

But I noticed that in the build conf.mk was getting some weird stuff.

CFG_DRAM_SIZE

CFG_SHMEM_START

CFG_TZDRAM_START

These three had some wonky values for a 256M board. And they seem to be used?

So my conclusion is that it does not suffice to set dts properties for optee, some tweaking of platform memory sizes (looks like there are options for 512M 1G etc, but not 256M) needs to be done.

Anything else that needs to be fixed for a 256M board?

Maybe this information can be valuable to someone with a custom board.

1 ACCEPTED SOLUTION

Accepted Solutions
OlivierK
ST Employee

Hi milkylainen (Community Member)

You may need to change the optee board level dts file containing mem size.

for instance in OPTEE in stm32mp135f-dk.dts

memory@c0000000 {

device_type = "memory";

reg = <0xc0000000 0x10000000>;

};

rmem_linux: optee-rmem-linux@c0000000 {

/* Linux kernel memory shared with other masters */

reg = <0xc0000000 0x0d000000>;

st,protreg = <

TZC_REGION_S_NONE

TZC_REGION_NSEC_ALL_ACCESS_

RDWR

>;

};

rmem_framebuffer: optee-rmem-framebuffer@cd000000 {

/* Secure framebuffer memory */

reg = <0xcd000000 0x1000000>;

st,protreg = <TZC_REGION_S_RDWR 0>;

no-map;

};

The OPTEE conf.mk change the DDR size for 256M

in /core/arch/arm/plat-stm32mp1/conf.mk

CFG_DRAM_SIZE ?= 0x10000000

Regards,

Olivier

View solution in original post

3 REPLIES 3
OlivierK
ST Employee

Hi milkylainen (Community Member)

You may need to change the optee board level dts file containing mem size.

for instance in OPTEE in stm32mp135f-dk.dts

memory@c0000000 {

device_type = "memory";

reg = <0xc0000000 0x10000000>;

};

rmem_linux: optee-rmem-linux@c0000000 {

/* Linux kernel memory shared with other masters */

reg = <0xc0000000 0x0d000000>;

st,protreg = <

TZC_REGION_S_NONE

TZC_REGION_NSEC_ALL_ACCESS_

RDWR

>;

};

rmem_framebuffer: optee-rmem-framebuffer@cd000000 {

/* Secure framebuffer memory */

reg = <0xcd000000 0x1000000>;

st,protreg = <TZC_REGION_S_RDWR 0>;

no-map;

};

The OPTEE conf.mk change the DDR size for 256M

in /core/arch/arm/plat-stm32mp1/conf.mk

CFG_DRAM_SIZE ?= 0x10000000

Regards,

Olivier

I pushed the CFG_x values from my additional custom board layer.

optee starts just fine now. Tnx.

Hi Olivier,

 

stm32mp135f-dk.dts doesn't include rmem_linux and rmem_framebuffer. Do You mean they should be added?

I want to increase the memory from 512MB to 1GB. The conf.mk in optee has two different CFG_DRAM_SIZE definitions as below. Could you let me know how to handle two different sizes? Thanks.

ifneq ($(filter $(CFG_EMBED_DTB_SOURCE_FILE),$(flavorlist-512M)),)
CFG_DRAM_SIZE ?= 0x20000000
endif

CFG_DRAM_BASE ?= 0xc0000000
CFG_TZSRAM_START ?= 0x2ffc0000
CFG_TZSRAM_SIZE ?= 0x0003f000
CFG_STM32MP1_SCMI_SHM_BASE ?= 0x2ffff000
CFG_STM32MP1_SCMI_SHM_SIZE ?= 0x00001000
CFG_TZDRAM_SIZE ?= 0x01e00000
CFG_SHMEM_SIZE ?= 0x00200000
CFG_DRAM_SIZE ?= 0x40000000
CFG_TZDRAM_START ?= ($(CFG_DRAM_BASE) + CFG_DRAM_SIZE - $(CFG_TZDRAM_SIZE))
CFG_SHMEM_START ?= ($(CFG_TZDRAM_START) - $(CFG_SHMEM_SIZE))

Regards,

Jeff