Skip to main content
Associate
October 1, 2026
Question

NUCLEO-H563ZI_OEMiROT_Boot Debugging causes HardFault

I’m using the OEMiROT_Boot example with the OEMiROT_Appli_TrustZone secure and non-secure example applications.
I can build the code and correctly provision the NUCLEO-H563ZI board. The applications run correctly and I can attach to the secure and non-secure applications using the debugger. If I use regression to return the board to the OPEN state, I am not able to debug the applications by downloading the code from the debugger. When I try, I receive HardFault when the secure app tries to switch to the non-secure app. I have followed the directions in application note “AN5421” when configuring the secure and non--secure projects. I’m using V9.70.4 of the IAR Embedded Workspace. Using the debugger, I can see the correct code in the secure and non-secure addresses.

Below is the debug log.

Thu Oct 01, 2026 16:20:47: IAR Embedded Workbench 9.70.4 (C:\iar\ewarm-9.70.4\arm\bin\armproc.dll)
Thu Oct 01, 2026 16:20:47: Loaded macro file: C:\iar\ewarm-9.70.4\arm/config/debugger/ST/STM32H5xx.dmac
Thu Oct 01, 2026 16:20:47: Loaded macro file: C:\iar\ewarm-9.70.4\arm/config/debugger/ST/STM32H5xx_DBG.dmac
Thu Oct 01, 2026 16:20:47: Loaded macro file: C:\iar\ewarm-9.70.4\arm/config/debugger/ST/STM32H5xx_OB.dmac
Thu Oct 01, 2026 16:20:47: Loaded macro file: C:\iar\ewarm-9.70.4\arm/config/debugger/ST/STM32H5xx_TRACE.dmac
Thu Oct 01, 2026 16:20:47: Loaded macro file: C:\iar\ewarm-9.70.4\arm/config/flashloader/ST/FlashSTM32H5xx.mac
Thu Oct 01, 2026 16:20:48: Network license: MKSPLAP-ENLIC02 (STD)
Thu Oct 01, 2026 16:20:48: Connected to ST-LINK/V3 [SWD mode 1000 kHz] [Access port: 1] Firmware V3.J17.M11 (Probe no: 002500433235511238363730)
Thu Oct 01, 2026 16:20:48: Hardware reset with strategy 2 was performed
Thu Oct 01, 2026 16:20:48: Initial reset was performed
Thu Oct 01, 2026 16:20:48: Loaded debugee: C:\iar\ewarm-9.70.4\arm/config/flashloader/ST/FlashSTM32H5xx.out
Thu Oct 01, 2026 16:20:48: Target reset
Thu Oct 01, 2026 16:20:49: Unloaded macro file: C:\iar\ewarm-9.70.4\arm/config/flashloader/ST/FlashSTM32H5xx.mac
Thu Oct 01, 2026 16:20:49: Loaded macro file: C:\iar\ewarm-9.70.4\arm/config/flashloader/ST/FlashSTM32H5xx.mac
Thu Oct 01, 2026 16:20:49: Loaded debugee: C:\iar\ewarm-9.70.4\arm/config/flashloader/ST/FlashSTM32H5xx.out
Thu Oct 01, 2026 16:20:49: Target reset
Thu Oct 01, 2026 16:20:49: Unloaded macro file: C:\iar\ewarm-9.70.4\arm/config/flashloader/ST/FlashSTM32H5xx.mac
Thu Oct 01, 2026 16:20:49: Downloaded C:\STM32Cube\Repository\STM32Cube_FW_H5_V1.7.0\Projects\NUCLEO-H563ZI\Applications\ROT\OEMiROT_Appli_TrustZone\EWARM\Secure\NUCLEO-H563ZI_S\Exe\Project_s.out to flash memory.
Thu Oct 01, 2026 16:20:49: 30152 bytes downloaded into FLASH (14.71 Kbytes/sec)
Thu Oct 01, 2026 16:20:50: Loaded debugee: C:\STM32Cube\Repository\STM32Cube_FW_H5_V1.7.0\Projects\NUCLEO-H563ZI\Applications\ROT\OEMiROT_Appli_TrustZone\EWARM\Secure\NUCLEO-H563ZI_S\Exe\Project_s.out
Thu Oct 01, 2026 16:20:50: Loaded extra image: C:\STM32Cube\Repository\STM32Cube_FW_H5_V1.7.0\Projects\NUCLEO-H563ZI\Applications\ROT\OEMiROT_Appli_TrustZone\EWARM\Secure\..\NonSecure\NUCLEO-H563ZI_NS\Exe\Project_ns.out, image ID 4
Thu Oct 01, 2026 16:20:50: Hardware reset with strategy 0 was performed
Thu Oct 01, 2026 16:20:50: 30152 bytes verified (117.31 Kbytes/sec)
Thu Oct 01, 2026 16:20:50: Multiple '__vector_table' symbol found, using the one located at address 0xc01'a400. 
Thu Oct 01, 2026 16:20:50: Consider using debug info from only one of the loaded images.
Thu Oct 01, 2026 16:20:50: Download completed and verification successful.
Thu Oct 01, 2026 16:20:50: Hardware reset with strategy 0 was performed
Thu Oct 01, 2026 16:20:50: Target reset
Thu Oct 01, 2026 16:20:53: There were 2 warnings during the initialization of the debugging session.
Thu Oct 01, 2026 16:20:53: Could not go to 'main'.
Thu Oct 01, 2026 16:21:06: Breakpoint hit: Code @ main.c:141.3, type: default (auto) 
Thu Oct 01, 2026 16:21:09: HardFault exception.
Thu Oct 01, 2026 16:21:09: The processor has escalated a configurable-priority exception to HardFault.
Thu Oct 01, 2026 16:21:09: 
Thu Oct 01, 2026 16:21:09:    The processor has attempted to execute an undefined instruction (CFSR.UNDEFINSTR).
Thu Oct 01, 2026 16:21:09: 
Thu Oct 01, 2026 16:21:09: Exception occurred at PC = 0xc01bf86, LR = 0xc01bf67
Thu Oct 01, 2026 16:21:09: 
Thu Oct 01, 2026 16:21:09: See the call stack for more information.
Thu Oct 01, 2026 16:21:49: Loading the ST-LINK Driver driver
Thu Oct 01, 2026 16:21:49: IAR Embedded Workbench 9.70.4 (C:\iar\ewarm-9.70.4\arm\bin\armproc.dll)
 

1 reply

Associate
October 5, 2026

Looks like the FPU is not enabled in the non-secure zone.

The code is trying to write to SCB->NSACR, but the write is failing even though I am in secure mode.