cancel
Showing results for 
Search instead for 
Did you mean: 

TrustZone: Debugging non-secure doesn't work

Grailler
Associate

Hi,

For context I am using the onboard ST-Link from the H563ZI Nucleo board (this one https://www.st.com/en/evaluation-tools/nucleo-h563zi.html). I am using a STM32CubeIDE demo code with IAR from here: https://www.st.com/en/embedded-software/x-cube-freertos.html#st-get-software in the folder:

X-CUBE-FREERTOS\1.2.0\Projects\NUCLEO-H563ZI\Applications\FreeRTOS_Queues_ThreadFlags_TrustZone\EWARM\Project.eww

I followed the Readme and enabled TrustZone by setting TZEN = B4. And also set the flash watermark definition:

Grailler_1-1734026630915.png

Grailler_2-1734026702694.png

In simple, I need to ability to debug my non-secure code. Right now:

  1. If I debug the secure code (by setting the secure project as active), I can step through the code as I would expect it to do so. The code then jumps to non-secure code and then I can’t step through the non-secure, but this is normal as non-secure is in a different context.
  2. Now if I debug the non-secure code (by setting the non-secure project as active), I do not even get to this breakpoint you see below. Actually, the assembly start-up code isn’t even executed.

I believe this has to do with the TrustZone MCU that always boots from secure code. Therefore, trying to download and debug directly from non-secure is probably causing an issue.

I have to be missing something as there has to be a way to debug non-secure application, correct?

Thanks!

0 REPLIES 0