Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between FreeRTOS and CMSIS-RTX

What is the difference between FreeRTOS and CMSIS-RTOS? Can anyone explain how the two RTOSes are similar or different?

like image 380
Bilal Qamar Avatar asked Jan 25 '17 18:01

Bilal Qamar


People also ask

What is Cmsis-RTOS RTX?

The CMSIS-RTOS RTX manages the resources of the microcontroller system and implements the concept of parallel threads that run concurrently. There are many advantages of using the CMSIS-RTOS RTX kernel. Applications frequently require several concurrent activities.

What is Keil RTX?

The Keil RTX is a royalty-free, deterministic Real-Time Operating System designed for ARM and Cortex-M devices. It allows you to create programs that simultaneously perform multiple functions and helps to create applications which are better structured and more easily maintained.


2 Answers

I think the source of confusion here is that there exists CMSIS-RTOS API (v1 and v2), and there is CMSIS-RTOS RTX, which is a standalone OS for ARM (and made by ARM), which implements that very API.

The idea was to create a common abstraction layer for RTOSes, so if one is not happy with FreeRTOS queues - he/she can choose another implementation of the same RTOS API without changing his/her firmware sources a lot.

Although I think RTOS makers will violate CMSIS-RTOS as much as MCU vendors violate CMSIS Driver API, I personally prefer CMSIS-RTOS API. There should be a number of wrappers that provide a layer of compatible macros to make existing RTOSes compatible with CMSIS-RTOS API. I'm only aware of PolyMCU attempts:

  • FreeRTOS - https://github.com/labapart/polymcu/blob/master/RTOS/FreeRTOS/cmsis/cmsis_os.h
  • ARM RTX - https://github.com/labapart/polymcu/blob/master/RTOS/RTX/INC/cmsis_os.h
  • RiotOS - https://github.com/labapart/polymcu/blob/master/RTOS/RioTOS/include/cmsis_os.h
like image 73
zserge Avatar answered Sep 23 '22 23:09

zserge


I have used RTX before CMSIS included the RTOS specification, and have compared it to FreeRTOS. At that time RTX was somewhat more primitive particularly in respect to its support for timers. I do not know whether that has changed in CMSIS-RTX.

Both use pre-emptive priority based scheduling and in that sense are "traditional", however internal design of FreeRTOS is somewhat unusual. In most RTOS the fundamental primitive from which all other API services are created is the mutex, in FreeRTOS however the fundamental primitive is the queue. Consequently "simple" primitives such as semaphores and mutexes are created from the more complex queue - rather then perhaps more intuitively complex things being built form simple things. I would imagine that this design has some impact on performance. Even without that I found that even context switches in FreeRTOS took significantly longer that RTX (15us vs 5us on a Cortex-M3 at 72MHz).

FreeRTOS is of course "free", while RTX is included in licensed commercial development tools from Keil. If you are using those tools there there is some degree of RTOS aware support for RTX within the IDE and debugger which may be helpful in development, though not perhaps essential.

like image 25
Clifford Avatar answered Sep 21 '22 23:09

Clifford