2026-01-27 8:47 AM - last edited on 2026-01-27 2:26 PM by mƎALLEm
I have been trying to add freeRTOS to simple LED - TrustZone enabled project (default LED project). I just followed the instructions as given here: How to use STM32U5 with FreeRTOS™ in tickless mode - STMicroelectronics Community
This instruction shows enabling X_CUBE-FREERTOS for NS but this gave me the following errors:
So, I enabled for both, secure and non-secure versions in Cube MX
This solved my previous errors but code hang in HAL_GTZC_MPCBB_ConfigMem() [Note: before enabling RTOS I did not see any issues in calling this function]
Any suggestions?
2026-01-27 12:52 PM
Also, I tried Solved: FreeRTOS in Trustzone - STMicroelectronics Community to compilation error with no luck!
2026-01-29 12:30 AM
Hello @Suthan
To solve the build errors, keep FreeRTOS only in the Non‑Secure (NS) project and disable TrustZone awareness inside FreeRTOS, so that no secure‑context support is required. In practice, you do not enable X‑CUBE‑FREERTOS on the Secure side; instead, in the NS project’s FreeRTOSConfig.h you set configENABLE_TRUSTZONE to 0, configRUN_FREERTOS_SECURE_ONLY to 1, and (unless specifically needed) configENABLE_MPU to 0. This removes all references to SecureContext_LoadContext, SecureContext_FreeContext, SecureContext_Init, and SecureInit_DePrioritizeNSExceptions, because FreeRTOS is now built as a normal NS kernel without per‑task secure context management.