Skip to main content
Associate II
November 6, 2024
Solved

STM32U575RIT6 - With TrustZone

  • November 6, 2024
  • 1 reply
  • 1139 views

Hi all!

I’m starting with secure zone projects using the STM32U575RIT6 microcontroller. First, I want a project with the secure zone active, and that jumps to the non-secure zone to print a message. However, when jumping to the secure zone (NonSecure_ResetHandler();) , it enters to error function (void HardFault_Handler(void)) .

I have created a empty project, with this IOC: 

proyo_0-1730885454555.png

In secure zone, main.c: 

#define VTOR_TABLE_NS_START_ADDR 0x08100000UL

And in NonSecure flash:

MEMORY

{

RAM (xrw) : ORIGIN = 0x20040000, LENGTH = 512K /* Memory is divided. Actual start is 0x20000000 and actual length is 768K */

SRAM4 (xrw) : ORIGIN = 0x28000000, LENGTH = 16K

FLASH (rx) : ORIGIN = 0x08100000, LENGTH = 1024K /* Memory is divided. Actual start is 0x08000000 and actual length is 2048K */

}

Does anyone have an idea of what might be happening?

 

Think you in advance! :) 

Best answer by Jocelyn RICARD

Hello @proyo ,

I would suggest using following example:

STM32Cube_FW_U5_V1.6.0\Projects\NUCLEO-U575ZI-Q\Examples\GPIO\GPIO_IOToggle_TrustZone\

The readme file give you indications how you should proceed.

This example also provides an IOC file so you can compare with what you have done with your project

Best regards

Jocelyn

1 reply

Jocelyn RICARD
Jocelyn RICARDBest answer
ST Employee
November 7, 2024

Hello @proyo ,

I would suggest using following example:

STM32Cube_FW_U5_V1.6.0\Projects\NUCLEO-U575ZI-Q\Examples\GPIO\GPIO_IOToggle_TrustZone\

The readme file give you indications how you should proceed.

This example also provides an IOC file so you can compare with what you have done with your project

Best regards

Jocelyn

proyoAuthor
Associate II
November 7, 2024

Thanks for responding so quickly.

I had that project active, but I wanted to make the necessary modifications to use secure zones from the .ioc file, following these instructions:

  • SECWM1_PSTRT=0x0 SECWM1_PEND=0x7F meaning all 128 pages of Bank1 set as secure
  • SECWM2_PSTRT=0x7F SECWM2_PEND=0x0 meaning all 128 pages of Bank2 set as non-secure

In case anyone else has the same problem, I finally resolved it by configuring the FLASH and SAU settings in the .ioc file. 

Thank you!