Tuesday, March 19, 2024
ExplainerIoT OS & RTOSIoT Software&Tools

ChibiOS/RT – A compact and fast real-time operating system

ChibiOS/RT is a compact and fast real-time operating system supporting multiple architectures and released under the GPL3 license. It is the high performance RTOS part of the ChibiOS/RT embedded collection. RT has been designed with the idea of creating a very feature-complete RTOS that could excel in performance and code size. It is developed by Giovanni Di Sirio.

One of the most strong points of the RT kernel is the extremely high performance in realtime-related parameters like context switch time and ISR latency. The performance is not just matter of well written code, a series of design solutions make RT the fastest RTOS for deeply embedded applications.

ChibiOS/RT  Key Points

=> RT uses efficient double linked circular lists for most of its internal data structures like:

  • Ready List.
  • Timers List.
  • Queues of Threads.

Linked lists are dynamic structures but in RT all list elements are statically allocated, nowhere memory is allocated or freed, all memory addresses are finalized at link time.

=> In RT the context switch operation is performed sycnhronously with a single function call, there are no interrupts/exceptions/tricks involved.

=>In architectures capable of nested interrupts the context switch is only, optionally, performed at the exit of the last ISR, the operation is automatic and transparent. OS functions called from ISR do not perform a context switch but only handle thread states very quickly, the context switch is done once regardless of how many OS functions have been called.

=> In RT critical zones are never nested, this means that there is no need to have a nesting counter or to save the current context. This makes the API very efficient, OS code paths minimize load/store operations and conditional branches. Critical zones are entered/left only from the outer function.


Read this: IoT Operating Systems


RT Features

RT is the advanced kernel of ChibiOS, it is designed to be a state of the art RTOS for deeply embedded applications. The design guidelines have been:

  • No compromises in performance, it has to be the fastest performing RTOS available.
  • Scalable from 8 bits architectures upward.
  • Functionally complete API. All common RTOS features have to be supported.
  • Fully Static Architecture.
  • Clean and elegant code base.
  • Predictable and Deterministic.
  • Small Size.
  • Fully compliant with HAL OSAL.
  • MISRA 2012 compliance.

In addition to the common RTOS features RT implements a set of unique features that make it one of the most advanced RTOS available:

Feature Description
Real Tick-less Mode The kernel does not require a system tick, interrupts are generated only at the scheduled time. This is optimal for implementing advanced power management modes.
High Resolution Time The time resolution can reach sub-microseconds values. It is possible to use very small delays in tasks.
Full Thread Paradigm Not just “tasks”, the threads paradigm is fully implemented: Create, Exit, Join operations are available.
Cycle-Accurate Statistics Critical zones, ISRs, tasks execution times are measured with a clock-accurate resolution, best/last/worst execution time is reported for all critical code paths.
System State Checker The API call protocol is checked vs the current system state, invalid calls are detected and reported. This resolves at development time one of the most insidious errors in RTOS usage. Potentially saving, by design, from intermittent and hard to debug problems.
Safety Features The RTOS implements a number of safety-related features like: Runtime integrity check API, stacks overflow detection, static design, RTOS global data structures encapsulation.

CMSIS RTOS Compatibility

The Cortex-M RT port also offers a compatibility layer with the CMSIS RTOS specification. The CMSIS RTOS API is mapped almost 1 to 1 on the RT native API, there is close to no overhead caused by the layer.

The implemented CMSIS RTOS features are:

  • Threads, mapped on RT threads management.
  • Timers, mapped on RT virtual timers.
  • Signals, mapped on RT events.
  • Semaphores, mapped on RT counting semaphores.
  • Mutexes, mapped on RT mutexes.
  • Pools, mapped on RT memory pools.
  • Messages, mapped on RT mailboxes.

Most CMSIS data types are mapped directly on the equivalent RT types.

The ChibiOS/RT own API is a superset of the features specified by the CMSIS specification.

Unfortunately CMSIS does not specify many features typical of an RTOS, for example and not limited to:

  • Critical Zones handling and requirements.
  • ISRs requirements.

The equivalent RT API is available to fill this kind of gaps. The RT API is available even when using the CMSIS RTOS compatibility layer, mixed use is permitted.

When an exact behavior is not specified by CMSIS RTOS the equivalent RT behavior is to be expected.

Community and Support

ChibiOS/RT available in GPL Version, Free Commercial Version, Free Commercial Version. You can Download from http://www.chibios.org/.


Source http://www.chibios.org/


You may like also:


 

Harshvardhan Mishra

Hi, I'm Harshvardhan Mishra. Tech enthusiast and IT professional with a B.Tech in IT, PG Diploma in IoT from CDAC, and 6 years of industry experience. Founder of HVM Smart Solutions, blending technology for real-world solutions. As a passionate technical author, I simplify complex concepts for diverse audiences. Let's connect and explore the tech world together! If you want to help support me on my journey, consider sharing my articles, or Buy me a Coffee! Thank you for reading my blog! Happy learning! Linkedin

6 thoughts on “ChibiOS/RT – A compact and fast real-time operating system

Leave a Reply

Your email address will not be published. Required fields are marked *