cancel
Showing results for 
Search instead for 
Did you mean: 

Facing issue in project creation through STM32Cube IDE

HirenThumar2702
Associate III

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.

  1. Selected IC STM32U585AII6
  2. Enabled Trustzone
  3. Enabled X-CUBE-FREERTOS and active for non-secure region
  4. Generate a project code
  5. Compile code as per generated tool

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.
_legacyfs_online_stmicro_images_0693W00000bkU8eQAE.png
_legacyfs_online_stmicro_images_0693W00000bkU8ZQAU.png 

1 ACCEPTED SOLUTION

Accepted Solutions
Semer CHERNI
ST Employee

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:

  • Go to [Software Packs]->[Select Components] : select the X-Cube-FreeRtos for the secure context


_legacyfs_online_stmicro_images_0693W00000bkaHIQAY.png

  • Under [Middleware and Software Packs]->[X-CUBE-FREERTOS] : Select the "CMSIS RTOS2" for the secure context


_legacyfs_online_stmicro_images_0693W00000bkaJ4QAI.png

  • Under [Project Manager]->[Code Generator] :
    • select the "Copy all used libraries into the project folder"
    • Uncheck the "Delete previously generated files when not re-generated"


_legacyfs_online_stmicro_images_0693W00000bkaIaQAI.png

  • Generate Code
  • Go back to the [Software Packs]->[Select Components] : uncheck the X-Cube for the secure context and select the pack for the non-secure one with the heap configuration you need


_legacyfs_online_stmicro_images_0693W00000bkaJJQAY.png

  • Under [Middleware and Software Packs]->[X-CUBE-FREERTOS] : Select the "CMSIS RTOS2" for the non-secure context with the configuration you want


_legacyfs_online_stmicro_images_0693W00000bkaL0QAI.png 

  • Generate Code

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.

View solution in original post

5 REPLIES 5
Semer CHERNI
ST Employee

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:

  • Go to [Software Packs]->[Select Components] : select the X-Cube-FreeRtos for the secure context


_legacyfs_online_stmicro_images_0693W00000bkaHIQAY.png

  • Under [Middleware and Software Packs]->[X-CUBE-FREERTOS] : Select the "CMSIS RTOS2" for the secure context


_legacyfs_online_stmicro_images_0693W00000bkaJ4QAI.png

  • Under [Project Manager]->[Code Generator] :
    • select the "Copy all used libraries into the project folder"
    • Uncheck the "Delete previously generated files when not re-generated"


_legacyfs_online_stmicro_images_0693W00000bkaIaQAI.png

  • Generate Code
  • Go back to the [Software Packs]->[Select Components] : uncheck the X-Cube for the secure context and select the pack for the non-secure one with the heap configuration you need


_legacyfs_online_stmicro_images_0693W00000bkaJJQAY.png

  • Under [Middleware and Software Packs]->[X-CUBE-FREERTOS] : Select the "CMSIS RTOS2" for the non-secure context with the configuration you want


_legacyfs_online_stmicro_images_0693W00000bkaL0QAI.png 

  • Generate Code

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.

HirenThumar2702
Associate III

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

JShah.7
Associate III

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)
_legacyfs_online_stmicro_images_0693W00000bkwLlQAI.png

So Please guide how to use FREERTOS in non-secure zone. Please share .ioc file if possible

I am using STM32U585AII6.

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':

@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.