2025-05-27 6:46 AM
Hi,
I am trying to add FreeRTOS to my project.
Board = Nucleo-U5A5ZJ-Q
Trustzone = enabled
FreeRTOS = in non-secure project
I have Trustzone enabled, therefore a secure and a non-secure project is generated by CubeMX. I added FreeRTOS in the non-secure project. Upon building the project, it gives the following errors (the output is modified to remove additional build information and long project paths):
.../GCC/ARM_CM33/non_secure/port.c.obj: in function `vPortSVCHandler_C': [build] .../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM33/non_secure/port.c:1042: undefined reference to `SecureContext_AllocateContext' [build] .../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM33/non_secure/port.c:1047: undefined reference to `SecureContext_LoadContext' [build] .../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM33/non_secure/port.c:1058: undefined reference to `SecureContext_FreeContext' [build] .../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM33/non_secure/port.c:1067: undefined reference to `SecureInit_DePrioritizeNSExceptions' [build] .../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM33/non_secure/port.c:1070: undefined reference to `SecureContext_Init' [build] .../GCC/ARM_CM33/non_secure/portasm.c.obj: in function `PendSV_Handler': [build] .../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM33/non_secure/portasm.c:423: undefined reference to `SecureContext_SaveContext' [build] .../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM33/non_secure/portasm.c:423: undefined reference to `SecureContext_LoadContext' |
Solved! Go to Solution.
2025-05-28 3:02 AM - edited 2025-05-28 3:04 AM
Hello @fa31,
The errors you're getting are related to missing references for secure context functions in your FreeRTOS setup.
You need to include these FreeRTOS files in your Secure project to handle context switching between secure and non-secure parts of the application
Hope that helps!
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.
2025-05-28 3:02 AM - edited 2025-05-28 3:04 AM
Hello @fa31,
The errors you're getting are related to missing references for secure context functions in your FreeRTOS setup.
You need to include these FreeRTOS files in your Secure project to handle context switching between secure and non-secure parts of the application
Hope that helps!
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.
2025-05-28 3:09 AM
Thank you @Sarra.S for the reply.
For someone trying to solve the same errors:
I added those files from FreeRTOS official git repo: link.
Added the files in my project under Middlewares -> Third_Party -> FreeRTOS -> Source -> portable -> GCC -> ARM_CM33 -> secure, and then added the file paths into my CMakeList and was able to build the project without any errors.