2023-05-20 03:02 AM - edited 2023-11-20 05:02 AM
Hello Support Team,
Good day,
For product development, we chose the STM32U585 family, a trust zone-based MCU. Consequently, we are having a problem when we generate projects using Cube Ide.
I've listed the actions we're taking below.
When I compiled code we have seen below compilation error
undefined reference to `SecureContext_SaveContext' portasm.c
undefined reference to `SecureContext_AllocateContext' port.c
undefined reference to `SecureContext_LoadContext'
undefined reference to `SecureContext_Init'
I've included a screenshot of the error for debugging.
Solved! Go to Solution.
2023-05-22 08:19 AM - edited 2023-11-20 05:02 AM
Hello @HirenThumar2702
First let me thank you for posting.
The compilation error you are facing are caused by the fact that X-Cube-FreeRtos is not selected for the secure project. Therefore, some dependencies are not generated and will lead to those errors.
However, at he moment the tool will not allow you to select the pack for both context at the same time whichi will make the errors appear every time. This is a know issue and it's tracked by this ticket to be resolved asap 151921 (This is an internal tracking number and is not accessible or usable by customers).
In the mean while, and as a temporary solution, I advise you to follow these steps to generate your project:
This solution should resolve the dependency issue, waiting for a permanent fix.
Don't hesitate to ask further question if you still facing any misbehavior in the tool.
Kind regards,
Semer.
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.
2023-05-22 08:19 AM - edited 2023-11-20 05:02 AM
Hello @HirenThumar2702
First let me thank you for posting.
The compilation error you are facing are caused by the fact that X-Cube-FreeRtos is not selected for the secure project. Therefore, some dependencies are not generated and will lead to those errors.
However, at he moment the tool will not allow you to select the pack for both context at the same time whichi will make the errors appear every time. This is a know issue and it's tracked by this ticket to be resolved asap 151921 (This is an internal tracking number and is not accessible or usable by customers).
In the mean while, and as a temporary solution, I advise you to follow these steps to generate your project:
This solution should resolve the dependency issue, waiting for a permanent fix.
Don't hesitate to ask further question if you still facing any misbehavior in the tool.
Kind regards,
Semer.
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.
2023-05-26 02:21 AM
Hello Semer,
Good day,
Thanks for providing support
I tried as per provided step but the same issue was faced so can you provide me with an example(NS side freeRTOS and Enble Trustzone) or .ioc file
c:\st\stm32cubeide_1.6.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.200.202301161003\tools\arm-none-eabi\bin\ld.exe: D:/EVLoop/Project/POC1/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM33/non_secure/port.c:826: undefined reference to `SecureContext_LoadContext'
c:\st\stm32cubeide_1.6.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.200.202301161003\tools\arm-none-eabi\bin\ld.exe: D:/EVLoop/Project/POC1/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM33/non_secure/port.c:836: undefined reference to `SecureContext_FreeContext'
c:\st\stm32cubeide_1.6.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.200.202301161003\tools\arm-none-eabi\bin\ld.exe: D:/EVLoop/Project/POC1/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM33/non_secure/port.c:845: undefined reference to `SecureInit_DePrioritizeNSExceptions'
c:\st\stm32cubeide_1.6.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.200.202301161003\tools\arm-none-eabi\bin\ld.exe: D:/EVLoop/Project/POC1/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM33/non_secure/port.c:848: undefined reference to `SecureContext_Init'
c:\st\stm32cubeide_1.6.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.200.202301161003\tools\arm-none-eabi\bin\ld.exe: ./Middlewares/RTOS2/CMSIS/RTOS2/Core/TZ_Non_Secure/portasm.o: in function `PendSV_Handler':
D:/EVLoop/Project/POC1/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM33/non_secure/portasm.c:214: undefined reference to `SecureContext_SaveContext'
Thanks
Hiren R. Thumar
2023-05-26 03:30 AM - edited 2023-11-20 05:03 AM
Hello @Semer CHERNI ,
I've taken the steps above, but I'm still getting the below errors .
port.c:826: undefined reference to `SecureContext_LoadContext'
port.c:836: undefined reference to `SecureContext_FreeContext'
port.c:845: undefined reference to `SecureInit_DePrioritizeNSExceptions'
port.c:848: undefined reference to `SecureContext_Init'
I am not able to select "Copy all used libraries in to project folder" option.(attached image)
So Please guide how to use FREERTOS in non-secure zone. Please share .ioc file if possible
I am using STM32U585AII6.
2024-03-26 12:07 AM
Hi
I followed the above steps , I am still getting the same error Also Can you guide me how to use FreeRtos when TrustZone is enabled .
/STM32CubeIDE/workspace_1.14.4/TRustZone_FreeRtos/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM33/non_secure/port.c:889: undefined reference to `SecureContext_LoadContext'
/STM32CubeIDE/workspace_1.14.4/TRustZone_FreeRtos/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM33/non_secure/port.c:900: undefined reference to `SecureContext_FreeContext'
/RoopaN/STM32CubeIDE/workspace_1.14.4/TRustZone_FreeRtos/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM33/non_secure/port.c:909: undefined reference to `SecureInit_DePrioritizeNSExceptions'
/STM32CubeIDE/workspace_1.14.4/TRustZone_FreeRtos/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM33/non_secure/port.c:912: undefined reference to `SecureContext_Init'
/Middlewares/RTOS2/CMSIS/RTOS2/Core/TZ_Non_Secure/portasm.o: in function `PendSV_Handler':
2024-07-31 09:52 AM
@Semer CHERNI could you please provide an update on ST Internal ticket #151921? It's been over a year and this "ASAP" issue still seems problematic.