cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H573 Secure partition starts at 0xc000400 or 0xc000000? Mapping differs from OBkey settings

Marty_Revival
Associate II

Hi All!

I'm trying to wrap my head around STM32H573 with trustzone, STiRoT etc in STM32CubeMX and I'm missing some information on the firmware sizes.

The STM32H573 has 2MB flash, secure part is from 0x0C00_0000 to 0x0C1F_FFFF. When I select STiRoT + Secure partition and open OBkey settings I want to use maximum firmware size, which is 1MB in my understanding (download area must be same size as application area). So I set firmware offset to zero, firmware download area offset to 0x0010_0000 and firmware area size also to 0x0010_0000. 

When I generate obkey it gives me firmware slots 0 with address 0x0C00_0000 with size 0x10_0000 and slot 1 with address 0x0C10_0000 with size 0x10_0000.

Marty_Revival_1-1776954300700.png

 

But the mapping says Start address 0x0C00_0400 and End address 0xC0F_FFFF which is different from the configured address/size.

Marty_Revival_2-1776954343227.png


If tried going to Tools -> Memory Management but that gives a different image again!
That gives a size of 123kB and address range 0x0C00_0400 - 0x0C01_EFFF, which appears to be the default? But this can't be edited. And also nog the whole RAM range is used, only 320kB out of 640kB?

Marty_Revival_3-1776954554465.png


Can someone shed some light on this?

Thanks!

With kind regards,

Martijn

 

 

3 REPLIES 3
Jocelyn RICARD
ST Employee

Hello @Marty_Revival,

The first 1KB is not usable for the application. It contains the mcuboot header.

So, your application will actually start at offset 0x400, but after signature it will contain this header at the beginning.

By the way, the metadata of the signed image (especially the signature) are appended to the actual firmware. So, your firmware size should be slot size (1MB here) - 1KB - around 300 bytes.

Best regards

Jocelyn

Hello @Jocelyn RICARD ,

Thanks for the fast reply!
That explains some stuff, thank you.

I've tried some stuff in Project Manager -> Boot path -> Edit config files

If I put the following information in I get an error

Marty_Revival_1-1777030578134.png


If I use offset zero and size 0x100000 it does work.
Can I assume that STM32CubeMX handles the rest (0x400 offset and appended signature on the end of the firmware)? It somewhat confusing. 

Marty_Revival_2-1777030625725.png


As for the RAM, the generated linker file only has 320kB RAM defined instead of the 640kB as shown in MMT in previous post. What would be the proper way to get the whole 640kB of ram. Do I need to modify the linkerscripts manually?

 

Jocelyn RICARD
ST Employee

Hello @Marty_Revival ,

I would suggest first trying the STiROT example without CubeMX to understand how things work.

You have a wiki page here dedicated to this.

Best regards

Jocelyn