cancel
Showing results for 
Search instead for 
Did you mean: 

SVC call from non-secure code does not trigger non-secure SVC exception

MJung.6.279
Associate II

Hello,

I am trying to do a proof-of-concept running the Apache NuttX RTOS on the ST32L562E-DK board as the non-secure application with TrustedFirmware-M.

I can build, sign and flash NuttX as the non-secure application and TF-M boots into the RTOS initialization code. However, once the RTOS initialization code issues the first SVC instruction (to request an initial context switch to the 'init' task) the corresponding exception handler is not called (I do see systick exception handler calls, so generally the vector table seems to be set up correctly).

What could be the reason that an SVC instruction does not trigger the corresponding exception handler (both the SVC and the handler being in non-secure code)?

Any help is highly appreciated.

Thanks!

Michael

1 REPLY 1
MJung.6.279
Associate II

I figured it out: The RTOS uses SVCs while interrupts are disabled, which causes HardFaults. It then detects this situation in the HardFault handler and actually forwards execution to the SVCall handler.

With standard settings the HardFault handler will switch to the Secure mode, though. Setting the BFHFNMINS bit in the SCB->AIRCR from the secure boot loader before starting the RTOS resolved the situation (it causes HardFaults to be presented in NonSecure state).

Thanks and bye,

Michael