Skip to main content
HirenThumar2702
Associate III
April 29, 2023
Solved

How to create tasks in secure reason on Truszone based MCU STM32U5

Hello Support Team,

Good day,

We have chosen the STM32U585ZIT6Q (-40C to 85C, LQFP -144 pins, with trust zone core) controller for our product.

As per our requirement, We have activated TrustZone security is activated(Option bit TZEN=1) and Tread-X middleware in M33NS cause as well as trust zone security

We have enabled trust zone security and also enabled the middleware of TreadX in M33NS reason.

The non-secure reason is directly accessible from the secure reason, according to the paper below.

https://www.st.com/resource/en/application_note/dm00625692-stm32l5-series-trustzone-features-stmicroelectronics.pdf

I have some questions regarding the secure reason project which is mentioned below

1. I noticed that the secure project has a while loop and int main(). What is the purpose of this while loop?

2. Can I create threads or tasks in the secure reason project? As per our application, we have 4 tasks(Task-1:Display, Task-2:Metering, Task-3:Monitoring Metering data and Task4:Relay operation).

 we want to create a certain task in Secure Reason because it is related to product/User safety points (like Task-3:Monitoring Metering data and Task4:Relay operation ) 

Can you provide guidance on how we can achieve this? 

Thanks

Hiren R. Thumar

This topic has been closed for replies.
CMYLBest answer
ST Technical Moderator
May 5, 2023

1. I noticed that the secure project has a while loop and int main(). What is the purpose of this while loop?

In case the secure to non-secure switch function is bypassed, the while loop is a protection against undefined state

2.

  • ThreadX is secure aware, we can't have 2 instances of the scheduler in both secure and non-secure.
  • If we launch the scheduler in secure, there is no way to switch to non-secure world.
  • The best implementation in your case is to boot in secure, then run ThreadX in non-secure.
  • Tasks 3 and 4 can access the assets in secure part using secure callable (SG) functions.
  • You can define secure callable functions for either getting/setting "Monitoring Metering data" and "relay operation". These Functions can be called by Tasks 3 and 4, which will protect the assets and let you manage them in a secure way.

Best regards

1 reply

CMYLBest answer
ST Technical Moderator
May 5, 2023

1. I noticed that the secure project has a while loop and int main(). What is the purpose of this while loop?

In case the secure to non-secure switch function is bypassed, the while loop is a protection against undefined state

2.

  • ThreadX is secure aware, we can't have 2 instances of the scheduler in both secure and non-secure.
  • If we launch the scheduler in secure, there is no way to switch to non-secure world.
  • The best implementation in your case is to boot in secure, then run ThreadX in non-secure.
  • Tasks 3 and 4 can access the assets in secure part using secure callable (SG) functions.
  • You can define secure callable functions for either getting/setting "Monitoring Metering data" and "relay operation". These Functions can be called by Tasks 3 and 4, which will protect the assets and let you manage them in a secure way.

Best regards