MbedOS and CMSIS interface

Hello,
I’m developing some Arduino libraries for a Portenta Machine Control (which use mbed os) which will use thread creation and mutex, etc…

I found by chance that within Arduino libraries is possible to create thread and handle operating system object (semaphore, mutex, etc) using also CMSIS interface which is the one of Keil (and from what I’ve understood mbedos is based on Keil)

At this point is it safe to use CMSIS API (c language) while on mbedos? Or it will be better to use MbedOS API (c++ language) ??

I have some source code which is already running with CMSIS and it can be ported without much efforts by simply using CMSIS calls… but I don’t know if it’s safe to use it on mbedOS (even if it compiles without error/warning)

What do you suggest me? Thank you

I’m fairly sure that the CMSIS-RTOS functions will interoperate fine with the Mbed RTOS classes. You can see from e.g. the Thread class that Mbed RTOS is implemented as a wrapper around CMSIS RTOS, and in most cases doesn’t have much additional functionality. The only really hard part I can think of is that you have to handle allocating stack for the thread yourself, or copy how Mbed does it.

Unluckily I found that trying to use osSemaphore from CMSIS API in an arduino library (MBED OS) does not work.

So I ended using MBED OS API and wrapping it into functions that are called from my pre-existent stack.
This seems to work.