From http://www.chibios.org: ChibiOS/RT is designed for deeply embedded real time
applications where execution efficiency and compact code are important requirements.
This RTOS is characterized by its high portability, compact size and, mainly, by its
architecture optimized for extremely efficient context switching.
- Efficient and portable preemptive kernel.
- Static architecture, everything is statically allocated at compile time.
- Dynamic extensions, dynamic objects are supported by an optional layer built on top
of the static core.
- Rich set of primitives: threads, virtual timers, semaphores, mutexes, condition
variables, messages, mailboxes, event flags.
- Extensive test suite with benchmarks.
- Many supported architectures.
- And many more features, take a look at the ChibiOS/RT page.
The static architecture makes the life a little easier. Here you do not need to setup
e.g. a thread or semaphore count of your project. It does not waste your memory, only
resources are used which are really needed.
Measurement with port pins and oscilloscope
How to measure the context switch time? I will not invent the wheel again, and use the
following methode from SEGGERs web page.
The context switching time is the time between switching the LED on and off. If the
LED is switched on with an active high signal, the context switching time is the time
between rising and falling edge of the signal. If the LED is switched on with an active
low signal, the signal polarity is reversed.
The real context switching time is shorter, because the signal also contains the
overhead of switching the LED on and off. The time of this overhead is also displayed
on the oscilloscope as a small peak right before the task switching time display and
has to be subtracted from the displayed context switching time. The picture below shows
a simplified oscilloscope signal with an active-low LED signal (low means LED is illuminated).
There are switching points to determine:
- A = LED is switched on for overhead measurement
- B = LED is switched off for overhead measurement
- C = LED is switched on right before context switch in low-prio task
- D = LED is switched off right after context switch in high-prio task
The time needed to switch the LED on and off in subroutines is marked as time
tAB. The time needed for a complete context switch including the time
needed to switch the LED on and off in subroutines is marked as time tCD.
The context switching time tCS is calculated as follows:
tCS = tCD - tAB
Context switch time
The switch from one task to the next can be triggered by several synchronisation mechanisms like:
- Event flags
- Mutexes (not measured here)
I hope that here is no typo occurred. All programs which were used here for the test will be
available in the download section. In case you find a problem, send me a note and I will check it.
For the test the following boards were used:
And for the Compiler:
- ARM7 / Cortex-M3 / Cortex-A8: CrossWorks for ARM (v2.3.0)
- Atmel AT91SAM7 CPU Support Package (v1.13)
- STMicroelectronics STM32 CPU Support Package (v2.15)
- Texas Instruments Sitara CPU Support Package (v1.0)
I think this should be all of the background informtion you need to reproduce the
test on your desk too.
If you need more information, please don't hesitate to ask.
ChibiOS/RT v2.4.3 was used for the ARM7, CM3, Nios II and Cortex-A8 test.
Context switch time in µs (last update 14.02.2013):
The ARM7 test was done in Thumb mode. The ARM7 and Cortex-M3 port was
optimized by the author of ChibiOS/RT.
The Cortex-A8 test was done in ARM mode.
I do not know why you should select ChibiOS.
I was searching for a free OS which can be used in private projects. Here
I found the following candidates:
Nut/OS, I have
used this system in some of my AVR projects
before, and even an ARM page exists.
Therefore, I want to play with a new one. This was not a technical decision, I wanted to
see whether I could find a new toy.
personally I have got the book "MicroC/OS-II
The Real-Time Kernel" (2nd edition). The book comes with source code (of an older version
of µC/OS-II, the book is some years old) and I could really recommend this book if you
want to learn something about an OS. But if I want to make my complete project public,
this is not allowed. Because it is not allowed to publish the source of the OS itself.
µC/OS-II is an comercial OS and therefore the restriction is full acceptable. Btw, a
project page exists here too.
embOS is not a free OS.
TNKernel, here I have created a
project page too.
FreeRTOS, perhaps this is the right
OS for me? It is licensed under the GPL and therefore I can make my complete project public,
inclusive the source of the OS itself. But unfortunately there is a GPL Exception, Clause 2
FreeRTOS may not be used for any competitive or comparative purpose,
including the publication of any form of run time or compile time metric, without the express
permission of Real Time Engineers Ltd. (this is the norm within the industry and is intended
to ensure information accuracy).
I do not like this exception, and therefore it is not the correct OS for me.
ChibiOS/RT, after a while
I stumbled over ChibiOS/RT.
As you can see, there exist a lot of OS systems there. You must decide by your own which is
the perfect OS for your requirements. Speed is not everything. Even the following aspects
should be taken into account as well:
- Is the source code needed for your project?
- How fast is the support?
- Are there other components needed for your projects, which may be available from the
same manufacturer, like a File System or TCP/IP Stack?
- Is a commercial RTOS a must,
or can an OpenSource version be used?
The zip files do not contain a full ChibiOS/RT version. Even I have made some little
modification to get the examples compiled with CrossWorks for ARM. For an original version of ChibiOS/RT take a
look at the following page.
chibios-speed-arm7-243-20130203 (495 KB)
chibios-speed-m3-243-20130203 (533 KB)
Here is the Cortex-A8 port with the test suite and the benchmark projects.
The version is tested with the "IRQ-STORM".
chibios-v246-test-bb-20140622 (433 KB)
chibios-v246-bb-20140622 example with HAL, PAL and SERIAL (518 KB)
chibios-speed-a8-243-20130214 (1.41 MB)
And here are the Quartus II 11.1 projects. The port for the Altera DE1 Board
with the test suite, the benchmarks results and the projects for the several speed test.
The SOPC system is included in each project. For more information about Nios II and ChibiOS/RT
take a look at this page.
chibios-v263-test-de1-20140504 (1.10 MB)
chibios-v246-test-de1-20140504 (1.11 MB)
chibios-speed-de1-243-20130203 (533 KB)