2025-10-02 2:59 AM - last edited on 2025-10-02 3:15 AM by Andrew Neil
Hi
In the past 6 months, I created a project for an STM32H755. For middleware, I selected CMSIS RTOS v2 (using FreeRTOS underneath).
I noted that the header file is cmsis_os.h, which at first seemed wrong. I (maybe naively) asked the "AI", and with it's usual confident tone, suggested I change them (however, this is hard to maintain if you change your .ioc file).
Looking at past posts on these forums, and inside cmsis_os.h, I confirmed that cmsis_os2.h is indeed included within it (despite the AI not finding this).
So, I challenged the "AI", stating what I had found. Of course, in it's somewhat complimentary way, it agreed with me, but still insisted that if I am using entirely v2 APIs, I should change the headers.
Of course, such responses derive from human content written elsewhere, and I fear it may not backed by actual facts. I have left the headers as they are for now. I have a bad feeling about changing them as ST might have reasons to do things the way they have.
So, is it good practise (or a bad idea) to change all #include "cmsis_os.h" to "cmsis_os2.h" ?
Solved! Go to Solution.
2025-10-02 4:09 AM
Hello @NickO ,
In recent and upcoming versions of STM32CubeMX, "#include cmsis_os2.h" is now used directly for CMSIS-RTOS v2 projects.
Kind regards,
DHIF Khaled
2025-10-02 3:14 AM
@NickO wrote:I noted that the header file is cmsis_os.h, which at first seemed wrong.
Was this actually causing any problems, or is this just a semantic concern about the name?
2025-10-02 3:17 AM
No problems. It's more a safety issue for me, and knowing why things are the way they are.
2025-10-02 3:23 AM
It's not uncommon for stuff like this to include backwards compatibility with previous versions.
If it doesn't cause any problems, I'd leave it.
I don't think that the name "cmsis_os.h" necessarily implies any specific version?
2025-10-02 3:30 AM
Agreed. I intend to leave it unless there is some official guidance that says I should change it (to prevent myself or future developers using an old API that leads to unpredictable problems).
As cmsis_os2.h does imply a version of course, there are forum posts out there complaining the issue I raised is due to a bug (accompanied by strange "workarounds" which all make me nervous). All this seeds doubt and uncertainty, not helped by the AI of course, but I suspect ST know what they are doing and it's entirely intentional.
Thank you for responding.
2025-10-02 3:47 AM
@NickO wrote:I suspect ST know what they are doing and it's entirely intentional.
You would hope so ...
Also, as it's an ARM thing, it might be worth asking ARM:
https://community.arm.com/support-forums/f/operating-systems-forum
2025-10-02 4:02 AM
From my experience, it's usually safer not to change the headers manually unless there is an official note in the documentation. Since cmsis_os.h already includes cmsis_os2.h, it looks like ST made this intentional for backward compatibility. Unless you see real conflicts or errors, leaving it as is should avoid unnecessary issues.
2025-10-02 4:04 AM
@Jessica_Alleen wrote:it looks like ST made this intentional
Could even have been ARM ...
2025-10-02 4:06 AM - edited 2025-10-02 4:10 AM
Hi,
cmsis_os2.h is for Version 2 of the CMSIS-RTOS API. File cmsis_os.h is for version 1.
Version 2 is *not* a drop-in replacement of v.2, so if you have code written for v.1 and want to upgrade to v.2, you have to review and fix incompatibilities. AI usually are great for this task, but yours seems to be broken :(
If you are new to the CMISIS RTOS, you may want to start with version 2 - or bypass the wrappers and directly work with FreeRTOS. After all, it is not so horrible as some say. If the AI robot makes trouble, you can find real live humans here.
2025-10-02 4:09 AM
Hello @NickO ,
In recent and upcoming versions of STM32CubeMX, "#include cmsis_os2.h" is now used directly for CMSIS-RTOS v2 projects.
Kind regards,
DHIF Khaled