Hi,
I am currently using IAR for developing a Secure and Non Secure application on an STM32U575.
I am calling a function on the secure app from the non-secure app. The function has an added __attribute__( ( cmse_nonsecure_entry ) ) to it which are required for secure entry functions.
Upon examining the disassembly of the instruction the entry function doesnt have a Secure Gateway (SG) instruction but instead tagged as "DC32".
This causes a Bus Fault error as expected since the program wasnt able to transition from non-secure to secure without the SG instruction.
There seems to be no problem with the linker files and the compiler options.
Would anyone be able to know what the problem is here?
Hi Stephen,
Thank you for your help. I turns out I am debugging in ARM mode when it was compiled in Thumb mode.
I am currently able to see the correct instructions but still I am encountering bus errors when a PUSH instruction is executed
This instruction occurs when I am calling a function, which is inside the secure project, from the cmse_nonsecure_entry function.
The CFSR shows he following bits set
The BFAR shows this:
This immediately occurs after the Push instruction
Hi RenanA fault when executing a PUSH is often caused by the Stack Pointer not being initialized correctly, so check the value of SP before the PUSH. Another reason might be that the stack region is outside of any valid MPU regions, so check the MPU setup too.As I wrote before, this forum is for users of the Arm Development Studio tools. For assistance with IAR products, please contact IAR directly: https://www.iar.com/supportStephen
Thank you Stephen!
Your point regarding the Stack region became the clue I need to fix this. Turns out I failed to setup the secure side stack in the RTOS that I was using.