cancel
Showing results for 
Search instead for 
Did you mean: 

Azure RTOS - CMSIS_OS2 wrapper

MStew.1
Associate III

Hello,

so in this video: https://www.youtube.com/watch?v=GZrfZNrA2ro

It is stated that the main thing is that with CMSIS 0S2 wrapper I can call the RTOS api of Arm and beyond that I can use either FreeRTOS or ThreadX. So it is very useful for to switch from a current implementation with for example FreeRTOS to a new implementation with ThreadX.

But I am not sure how does it work. I have a project where I used in the Cube MX the FreeRTOS middleware and added FreeRTOS functions in my main.c

Now when I want to switch to ThreadX how do I benefit from the wrapper?

I assumed I need to initialize a new project and write the implementation with ThreadX from scratch?

1 ACCEPTED SOLUTION

Accepted Solutions
Ghofrane GSOURI
ST Employee

Hello @MStew.1​ 

First let me thank you for posting.

The CMSIS-RTOS2 wrapper is a software layer that abstracts the underlying real-time operating system (RTOS) and provides a standardized API for accessing RTOS services. It enables developers to write portable code that can run on different RTOS kernels without modification, including FreeRTOS and ThreadX.

To switch from FreeRTOS to ThreadX using the CMSIS-RTOS2 wrapper, you would need to modify your existing project to use the CMSIS-RTOS2 API instead of the FreeRTOS API. This would involve replacing your calls to FreeRTOS functions with equivalent calls to the CMSIS-RTOS2 API.

The specific steps required to make this switch will depend on the details of your project, but in general, the process might look something like this:

  1. Remove the FreeRTOS middleware from your CubeMX project.
  2. Add the ThreadX middleware to your CubeMX project.
  3. Modify your main.c file to use the CMSIS-RTOS2 API instead of the FreeRTOS API. This will likely involve changing the names of some functions and modifying any configuration parameters that are specific to FreeRTOS.
  4. Initialize the ThreadX RTOS kernel using the appropriate CMSIS-RTOS2 API function.
  5. Modify any other code that uses FreeRTOS functions to use the equivalent CMSIS-RTOS2 functions.

Note that ThreadX and FreeRTOS have different APIs, so there may be some differences in how you use the RTOS services between the two kernels. However, by using the CMSIS-RTOS2 wrapper, you can minimize the amount of code that needs to be changed to switch between different RTOS kernels.

Thx

Ghofrane

View solution in original post

2 REPLIES 2
Ghofrane GSOURI
ST Employee

Hello @MStew.1​ 

First let me thank you for posting.

The CMSIS-RTOS2 wrapper is a software layer that abstracts the underlying real-time operating system (RTOS) and provides a standardized API for accessing RTOS services. It enables developers to write portable code that can run on different RTOS kernels without modification, including FreeRTOS and ThreadX.

To switch from FreeRTOS to ThreadX using the CMSIS-RTOS2 wrapper, you would need to modify your existing project to use the CMSIS-RTOS2 API instead of the FreeRTOS API. This would involve replacing your calls to FreeRTOS functions with equivalent calls to the CMSIS-RTOS2 API.

The specific steps required to make this switch will depend on the details of your project, but in general, the process might look something like this:

  1. Remove the FreeRTOS middleware from your CubeMX project.
  2. Add the ThreadX middleware to your CubeMX project.
  3. Modify your main.c file to use the CMSIS-RTOS2 API instead of the FreeRTOS API. This will likely involve changing the names of some functions and modifying any configuration parameters that are specific to FreeRTOS.
  4. Initialize the ThreadX RTOS kernel using the appropriate CMSIS-RTOS2 API function.
  5. Modify any other code that uses FreeRTOS functions to use the equivalent CMSIS-RTOS2 functions.

Note that ThreadX and FreeRTOS have different APIs, so there may be some differences in how you use the RTOS services between the two kernels. However, by using the CMSIS-RTOS2 wrapper, you can minimize the amount of code that needs to be changed to switch between different RTOS kernels.

Thx

Ghofrane