cancel
Showing results for 
Search instead for 
Did you mean: 

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

HirenThumar2702
Associate III

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

1 ACCEPTED SOLUTION

Accepted Solutions
CMYL
ST Employee

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

View solution in original post

1 REPLY 1
CMYL
ST Employee

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