Introduction

One frequent question I have had to answer is: Why creating another RTOS?, my usual answer is: Why not? it is not like the perfect RTOS has already been written.

Book Objectives

The objective of the book is to introduce you to a real RTOS, starting from the concepts then the architecture and all the software components, plenty of code examples and experiments will be proposed to the reader.

The book will allow the reader to know enough of ChibiOS/RT to allow the use in real world complex projects and to appreciate its inherent qualities.

Knowledge of the C language is required, previous experience on embedded systems is not strictly required but would make some concepts more clear to the reader.

The book is not meant as a substitute for documentation, it is advisable to have a copy of the API documentation at hand. API details are not documented in the book, the API is just described and use cases provided. The detailed documentation is available on www.chibios.org, section “Documentation”.

History

The ChibiOS/RT project went public in September 2007 on SourceForge but its roots go way back in time. My interest in operating systems originated when I bought the excellent “Operating System Design: The Xinu Approach” by Douglas Comer, the most inspirational book for me, it shaped my future professional path.

Starting from the book code I started writing in 1989 an operating system inspired by Unix and running on my ancient Atari ST, after a couple of years the OS, called BDP, was complete enough to be self sustaining, running EMACS, GCC and most Unix-style utilities. When Linux started becoming popular I decided that the project was redundant and stopped working on it.

The BDP kernel was interesting for its time, it was fully preemptive and supported realtime “co-routines” that I learned to be properly called “threads” after some years. In 1992, I needed a very small multi task kernel for embedded applications, I decided to not use directly the BDP code but to write something minimal from scratch, the result was “MK”, probably one of the first embedded RTOSes, at the time there was no Internet so the project found little use and I forgot about it for about 15 years. It lingered in my mind as that “nice something” I wrote years ago.

In 2006 I needed an RTOS for a project and, instead of using one of the available options, I decided to give a look to that “nice something”, it was even nicer that I remembered so I started immediately improving the obsolete code style, writing documentation, adding extensions and so on. After a while I decided to make it open source and give it a silly name, in 2007 MK was reborn as ChibiOS/RT.

Background

The reason for resurrecting the aforementioned MK was my dissatisfaction with existing RTOSes, at least those I was aware of. My ideal RTOS had to be:

  • Elegant
  • Fast
  • Small
  • Static

The ones I examined failed in one or more of the above points, points that then become the fundamental requirements of ChibiOS/RT:

  • Focus for code elegance and consistency, it must be a pleasure to work with the code.
  • Fully, unambiguously static.
  • Short code paths for all operations, it has to be really fast.
  • Compact.
  • Feature complete.
  • Strong abstraction.

Basically I wanted it to be a real contender not yet another “me too” RTOS.

Installation

The easiest way to get started with ChibiOS is to use the prepackaged toolchain called ChibiStudio. It includes all the software required and ChibiOS itself. ChibiStudio is not mandatory, many other toolchains are usable as well.