Torbjorn, thanks for the fast reply. On 2022-10-16 10:13, Torbjorn SVENSSON wrote: > >/  #0  0xeffffffe in ?? () />/  #1  0x0c000a9c in HardFault_Handler () />/      at />/C:/dvl/stm32l5trustzone/GPIO_IOToggle_TrustZone/Secure/Src/stm32l5xx_it.c:99 > />/  #2  0x2002ffd8 in ?? () />/  Backtrace stopped: previous frame identical to this frame (corrupt />/stack?) />/  (gdb) />/---------------- />/The frame #1 is at correct PC taken from LR, #2 is a total nonsense. / > I think your assumption here is wrong as 0xeffffffe is a valid value for > Cortex-M33 with TrustZone (FNC_RETURN with S=0). See more on the comment > below. 'B3.17 Function returns from Non-secure state' states: The FNC_RETURN value is: ... the original is a binary value in a table, hard to convert to plain text ... so if I convert correctly 0xfefffffe or 0xfeffffff depending on S bit. Starts with 0xfe not 0xef as the lockup magic! > Reading B3.33 (revision B.m) in the ARMv8-M documentation about lockup > state, it's written that DHCSR.S_LOCKUP=1 AND PC=0xeffffffe. My > interpretations that the PC value alone is not enough. Hmm, how would we read DHCSR then? IMO the PC value is enough. Tomas