cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H533RE-Issue while jumping from NonSecure world to Secure world

Amu
Associate

I am currently working on an STM32 TrustZone project and trying to implement the following flow:

NonSecure world running

Calls Secure_add()

Secure world executes

Returns value 8

UART prints the result in NonSecure world

However, I am facing an issue while jumping from the NonSecure world to the Secure world. The expected secure function execution is not happening properly.

If anyone has faced a similar issue or has suggestions regarding NSC gateway configuration, linker settings, or TrustZone function calls, please share your insights.

 

Screenshot 2026-03-06 192517.png

 this much i am getting the out

CMSE_NS_ENTRY uint32_t Secure_add(uint32_t a, uint32_t b)

{

return a + b;

}    ------------------------ My Nsc.c entry logic

 
 

for(int i = 0; i < 5; i++)

{

printf("NONSECURE WORLD RUNNING\r\n");

printf("I am amritha\r\n");

 

//for(volatile int d=0; d<500000; d++);

}

uint32_t result;

printf("Before Secure_add\r\n");

result = Secure_add(5,3);

printf("Before Secure_add\r\n");

printf("Secure result = %lu\r\n", result); -------------------------my non secure main.c

1 REPLY 1
lobna
ST Employee

Dear @Amu 

Please first verify that the Secure function is correctly declared as a Non-Secure Callable (NSC) entry, and that it is placed in the NSC region defined in the Secure linker script.

Also, please check that the SAU configuration is correctly set and that the NSC region matches the address of the Secure entry function. In addition, you may inspect the SAU->CTRL register: if SAU->CTRL is 0, then the SAU is not active.

Please also make sure that the STM32 memory map and the device security constraints allow the Non-Secure world to access this callable region.

For debug purposes, you may also test with a Secure function returning a fixed value to confirm the gateway behavior.

 

BR

Lobna