2021-04-07 05:44 AM
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
Solved! Go to Solution.
2024-12-11 12:33 AM
You can notice that "cmsis_os2.h" exists under cmsis_os.h File and this behavior does not cause compilation errors.
Best Regards.
Mahmoud
2024-12-09 05:41 AM
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.
2024-12-09 08:35 AM
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
2024-12-11 12:33 AM
2024-12-11 06:46 AM
@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.
2024-12-15 09:48 AM
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.