This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Armv8-M Hangs on Non-secure Interrupt Handler Exit

Hello,

On exiting non-secure interrupt handler, armv8-M cm33 gets in a bad state and hangs.

I think what's happening is, on exiting non-secure handler, cpu try to restore state from a secure area, I see "sec_err_irq_mpc" fires right after non-secure irq is cleared at handler exit.

How to allow crossing from non-secure to secure state and prevent that security error from happening.

Any clue or help is highly appreciated.

Thanks,

Mohsen

Parents
  • Hi Mohsen

    By "hang", do you mean an exception is occurring and the fault handler enters an endless loop. If so, which exception is occurring e.g. Hard Fault, INVER SecureFault, INVPC UsageFault, or is something else happening?

    Maybe the secure software stack overflowed, or your interrupt handler modified / corrupted EXC_RETURN?

    Suggest you check the value of EXC_RETURN before returning, in particular, the S bit, which indicates whether a Secure or Non-secure stack is used to restore stack frame on exception return.

    A full architectural description of what happens on Exception Return is given in the Armv8-M Architectural Reference Manual at: static.docs.arm.com/.../DDI0553B_k_armv8m_arm.pdf

    For a simpler description, see: developer.arm.com/.../switching-between-secure-and-non-secure-states

    You might also find this App Note useful: www.keil.com/.../apnt_291.pdf

    Which toolchain are you using to build and debug your system - Arm DS, Keil MDK or something else?

    Stephen

Reply
  • Hi Mohsen

    By "hang", do you mean an exception is occurring and the fault handler enters an endless loop. If so, which exception is occurring e.g. Hard Fault, INVER SecureFault, INVPC UsageFault, or is something else happening?

    Maybe the secure software stack overflowed, or your interrupt handler modified / corrupted EXC_RETURN?

    Suggest you check the value of EXC_RETURN before returning, in particular, the S bit, which indicates whether a Secure or Non-secure stack is used to restore stack frame on exception return.

    A full architectural description of what happens on Exception Return is given in the Armv8-M Architectural Reference Manual at: static.docs.arm.com/.../DDI0553B_k_armv8m_arm.pdf

    For a simpler description, see: developer.arm.com/.../switching-between-secure-and-non-secure-states

    You might also find this App Note useful: www.keil.com/.../apnt_291.pdf

    Which toolchain are you using to build and debug your system - Arm DS, Keil MDK or something else?

    Stephen

Children