STM32U575 + TrustZone + X-CUBE-FREERTOS 1.6.0: missing Secure FreeRTOS sources in generated project
Hi,
I am using:
- STM32U575VGT6Q
- STM32CubeIDE 2.1.1
- STM32Cube FW U5 V1.9.0
- X-CUBE-FREERTOS 1.6.0 / FreeRTOS 11.2
- TrustZone enabled
- FreeRTOS running in NonSecure (
TZ_Non_Secure) - FreeRTOS Secure support enabled (
TZ_Secure)
The generated NonSecure project fails at link time with:
undefined reference to `SecureContext_AllocateContext'
undefined reference to `SecureContext_LoadContext'
undefined reference to `SecureContext_FreeContext'
undefined reference to `SecureContext_SaveContext'
undefined reference to `SecureContext_Init'
undefined reference to `SecureInit_DePrioritizeNSExceptions'
Some of them are followed by:
Unknown destination type (ARM/Thumb)
dangerous relocation: unsupported relocation
The NonSecure linker correctly links:
Secure/Debug/secure_nsclib.o
but CubeMX did not copy the required Secure FreeRTOS source files into the generated project:
secure_context.c
secure_context_port.c
secure_heap.c
secure_init.c
Only the corresponding .h files were copied under:
Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM33/secure/
The four .c files are present correctly in the installed X-CUBE-FREERTOS 1.6.0 package.
As a workaround I manually copied those four .c files into the Secure project and added these include paths:
../../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM33/secure
../../NonSecure/Core/Inc
After that, the Secure project compiled successfully and the NonSecure linker errors disappeared.
Is this a known CubeMX / X-CUBE-FREERTOS 1.6.0 code generation issue for STM32U5 TrustZone?
I can provide the .ioc and generated project files if needed.

