cancel
Showing results for 
Search instead for 
Did you mean: 

GPIO_IOToggle_TrustZone example using STM32 TrustZone

stst9187
Associate III

Hi everyone,

I’m currently experimenting with the GPIO_IOToggle_TrustZone example using STM32 TrustZone.

When I build and flash both the Secure and NonSecure firmware, everything works correctly: the LED toggles as expected, so the interaction between Secure and NonSecure worlds seems fine.

However, I’m running into an issue with debugging:

  • I can successfully debug the Secure project
  • but I cannot seem to debug the NonSecure project

I am using STM32CubeIDE and I would like to understand how to properly configure the environment to be able to debug the NonSecure application as well.

Specifically:

  • Do I need a separate debug configuration for the NonSecure project?
  • Is it required to start debugging the Secure project first and then attach to NonSecure?
  • Or is there a specific STM32CubeIDE / ST-LINK / TrustZone debug configuration that I am missing?

Any guidance on the correct way to set up STM32CubeIDE for debugging the NonSecure project would be really appreciated.

Thanks in advance!

2 REPLIES 2
Jocelyn RICARD
ST Employee

Hello @stst9187 ,

To debug both Secure and non secure applications, you just need to have a setup, based for instance on secure application on which you add non secure application in startup tab of debug configuration.

Just click on Add ... button, select non secure project and OK.

If you leave everything by default, the debugger will flash both applications, load symbols of both applications and stop in the main of the secure.

Best regards

Jocelyn

 

Hi Ricard,

Thank you for your reply and support.

The instructions I found in the README.md inside the example project folder were also very useful, especially these steps:

  • Open STM32CubeIDE
  • File > Import. Point to the STM32CubeIDE folder of the example project. Click Finish.
  • Select and build the xxxxx_NS project, this will automatically trigger build of xxxxx_S project
  • Select the xxxxx_S project and select “Debug configuration”
    • Double click on “STM32 Cortex-M C/C++ Application”
    • Click on "Debugger" and select "ST-LINK (OpenOCD)" as Debug probe
    • Select “Startup” > “Add”
  • Select the xxxxx_NS project
  • Build configuration: Select Release/Debug
  • Click Debug to debug the example

Starting from these indications and after a few tests, I managed to correctly debug both Secure and Non Secure applications.

Thanks again for the support.

Best regards,
Marco