cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U5 - GPIO_IOToggle_TrustZone example gets stuck in HardFault-handler

SReic.1
Associate

I followed the GPIO_IOToggle_TrustZone Example for STM32U5, which is documented in UM2883 (STM32CubeU5GettingStarted.pdf; section 5.1.1).

The development board used is a NUCLEO-U575ZI-Q.

Details:

  • I've set the TZEN-Bit in FLASH_OPTR using STM32CubeProg successfully
  • Used STM32CubeIDE to import existing project (%USERPROFILE%\STM32Cube\Repository\STM32Cube_FW_U5_V1.0.0\Projects\NUCLEO-U575ZI-Q\Examples\GPIO\GPIO_IOToggle_TrustZone) from filesystem into default workspace (%USERPROFILE%\STM32CubeIDE\workspace_1.7.0)
  • sticked to the guide in UM2883:
  1. Open the STM32CubeIDE toolchain
    1. Open Multi-projects workspace file .project
    2. Rebuild xxxxx_Secure project
    3. Rebuild xxxxx_NonSecure project
    4. Launch Debug as STM32 Cortex-M C/C++ Application for the secure project.
    5. In the Edit configuration window, select the Startup panel, and add load image and symbols of the non-secure project.
    6. Be careful, the non-secure project has to be loaded before the secure project.
    7. Then click "OK"
    8. Run the example on debug perspective.

When I set a breakpoint in HAL_SYSTICK_Callback (where the LED is toggelt) this breakpoint is never hit. Instead, when initialization is done, the HardFault_Handler() in %USERPROFILE%\STM32Cube\Repository\STM32Cube_FW_U5_V1.0.0\Projects\NUCLEO-U575ZI-Q\Examples\GPIO\GPIO_IOToggle_TrustZone\Secure\Src is entered.

All steps were checked by one of my colleagues, so my last hope is this expert forum here.

3 REPLIES 3
Imen GH
ST Employee

Hello @SReic.1​ ,

Welcome to STM32 Community!

I recommend you to have a look to readme file under STM32Cube directory:

STM32Cube\Repository\ STM32Cube_FW_U5_V1.0.0/Projects/B-U585I-IOT02A/Examples/GPIO/GPIO_IOToggle_TrustZone/readme.html

Imen

SReic.1
Associate

Hi Imen,

Thank you. In the meantime I have found my mistake. It was that I forgot to set the values for SECWM[1-2]_PSTRT and SECWM[1-2]_PEND with STM32CubeProgrammer.

I sticked to STM32Cube_FW_U5_V1.0.0\Projects\NUCLEO-U575ZI-Q\Examples\GPIO\GPIO_IOToggle_TrustZone\Readme.html.

Stephan

Imen GH
ST Employee

Hello @SReic.1​ ,

Really glad to know you overcame your problem

Thank you.

Imen