cancel
Showing results for 
Search instead for 
Did you mean: 

Bug with STM32CubeMX V6.2.1 and STM32H755 with FreeRTOS CMSIS_V2 interface

GHolc.1
Associate III

The generated code for the CM7 core, file main.c includes "cmsis_os.h", this should include "cmsis_os2." instead because of the V2 interface. The correct file "cmsis_os2.h" is in the Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 directory, the project needs to have that directory added and the CMSIS_RTOS (without _V2) can be removed from the project search path. My compiler is IAR if that makes a difference, MCU and Firmware package is STM32Cube_FW_H7 V1.9.0

1 ACCEPTED SOLUTION

Accepted Solutions
Mahmoud Ben Romdhane
ST Employee

Hello @GHolc.1 @skeeter ,

You can notice that "cmsis_os2.h" exists under cmsis_os.h File and this behavior does not cause compilation errors.

MahmoudBenRomdhane_0-1733906005703.png

Best Regards.

Mahmoud

 

View solution in original post

5 REPLIES 5
skeeter
Associate II

Almost 4 years later and no response. Did you figure this out? I'm having the same issue generating code for IAR STM32F427II + FreeRTOS + CMSIS-RTOS2:

main.c includes the wrong header (cmsis_os.h instead of cmsis_os2.h).

The code generator will overwrite this every time so it needs to be fixed in CubeMX.

 

Mahmoud Ben Romdhane
ST Employee

Hello @GHolc.1 ,

First let me thank you for posting.

Your request is under investigation, and I will get back to you ASAP.

Best Regards.

Mahmoud

Mahmoud Ben Romdhane
ST Employee

Hello @GHolc.1 @skeeter ,

You can notice that "cmsis_os2.h" exists under cmsis_os.h File and this behavior does not cause compilation errors.

MahmoudBenRomdhane_0-1733906005703.png

Best Regards.

Mahmoud

 

GHolc.1
Associate III

@Mahmoud Ben Romdhane Back in 2021 when I reported this, the IAR project that cubeMX created placed the V2 file in Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 but did not add that location to the IAR project search paths that cubeMX created, so the project would not build because of include file not found.  I haven't created a clean project with cube to confirm the V2 directory is now being included.

@skeeter My solution was to fix the cube created IAR project by adding the missing path, it appears cube won't remove user added search paths when you regenerate code.   Searched include directories in the IAR project are found under Project->Options->C/C++ Compiler, under the preprocessor tab.  I can't recall the detail, I don't believe changing what was included was a good solution, fixing the paths and letting the "cmsis_os.h" bring in "cmsis_os2.h" is what my project is doing today.

Thanks @GHolc.1 , that did indeed fix it for me. The cmsis_os.h header is placed in 3 different directories by the code generator, and the EWARM project was including the incorrect path as you mentioned. I added the correct include path to the project and the code generator doesn't overwrite the project settings.

This is a good workaround but it must be done for each new project unless ST fixes CubeMX.