cancel
Showing results for 
Search instead for 
Did you mean: 

Nucleo-H563ZI: Blink LED with TrustZone enabled

Shubham08
Associate II

Hii Sir,

Recently I have got Nucleo-H563ZI nucleo board and i was trying to do programming for blinking led present on the board with the trust zone activated, but i am unable to get how to do it.

The process i follow is;

1) Created new stm32 project -> Give the name of the project -> selected with TrustZone -> Finish. As the onboard LED was already defined in the .ioc file. Therefore generated the project with the default configuration, under main folder, two more folder were generated secure and non-secure. in nonsecure folder -> Core ->  Src -> main.c in this main.c file searched for while loop and added toggleing of led code in it and build the code. As there was confusion which code to be uploaded first i tried to upload the nonsecure folder but the led was not blinking (only the led was on ) during this when I press the reset button the led was off. second time, I build the secure folder code and flash it in the microcontroller toggleing was working but the led that was on was off.

 

2) I followed some youtube tutorial in that in stm32cube ide there was example code, i searched for the GPIO_Toggle code with trustzone for the particular board (STM32H563ZI nucleo) and generated code for it but that was also not working.

 

I am getting confused and not getting the flow that how write code for this microcontoller as in this I was facing problem with led blinking, consider i want to connect mpu6050 which has i2c protocol for communication how to write code for it like after initializing the pin in ioc file and code generation what steps to be done.

 

As previously, I was using STM32F407 there was direct coding that due to Trustzone I am getting confused about the flow. 

 

 

Thankyou,

Regards,

Shubham

3 REPLIES 3
Bubbles
ST Employee

Hi @Shubham08,

when TZ is selected, the MCU always starts by executing the secure code. This typically sets the boundaries in which the non-secure code can execute. Then it invokes the non-secure code.

In STM32Cube_FW_H5_V1.5.0\Projects\NUCLEO-H563ZI\Examples\GPIO\GPIO_IOToggle_TrustZone is very nice example of the LED blinking demo with TZ enabled.

The readme.file included there will explain how to initiate the debugging with TZ.

BR,

J

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Shubham08
Associate II
  • STM32CubeIDE
  • 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”
    • Select “Startup” > “Add” >
  • Select the xxxxx_NS project
  • Build configuration : Select Release/Debug
  • Click Debug to debug the example

Sir I followed this step but the highlighted step is not working in stm32cube ide and the steps after that is more confusing.

Hello @Shubham08 ,

the point is to have both loaded, which for some reason is not default.

Bubbles_0-1739983230750.png

It's easier in normal commercial IDE.

BR,

J

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.