Last week I released Atomthreads, a free RTOS for embedded systems. This project grew from a task scheduler I created some time ago and subsequently extended with semaphore, mutex, queue and timer modules. The result was a lightweight and portable set of kernel sources which can be dropped in to any embedded systems project to add a thread scheduler. It has been useful to me so I decided to open source it in case it proves useful to anyone else.
There is a project website here and the sources are available for free download at Github. Atomthreads is released under a BSD-style license and is free to use for any commercial projects. You are under no obligation to publish any of your changes or application sources.
Over time I will be adding ports for various CPU architectures, but the first version contains a port for the AVR/ATmega architecture. Starting development by targeting the tiny ATmega CPU has by necessity kept the kernel very lean, but I’ve taken care not to compromise portability by adding any architecture-specific optimisations within the core kernel. The entire kernel is made up of a few small, portable C files, with only minimal architecture-specific functions required externally from architecture ports. If you need a seriously lean RTOS for AVR then you will likely be better served by one of the AVR-specific operating systems, the emphasis here is on portability.
Included in the sources is a full suite of automated tests which run on the target and prove all core kernel functionality. This suite has been used to thoroughly verify the code on an AVR target, and can similarly be used to quickly prove ports to other CPU architectures in the future.
All code has been documented using Doxygen, with detailed description of all kernel APIs. While I have put up a website to provide a general description, all of the information you need to understand the kernel internals and APIs is held within the source code itself. You should find that the Atomthreads sources are a good basis for learning about RTOS internals, are easy to understand, and easy to extend. According to Ohloh, Atomthreads has “Extremely well-commented source code“.
Note that Atomthreads is and always will be a simple scheduler library. If you need auxiliary operating system libraries such as an IP stack or file system then you may be better off with one of the larger operating systems out there. If, however, you don’t need or already have your own IP stack etc, then you can minimise the integration effort by just dropping in the simple Atomthreads scheduler. Those projects considering rolling their own simple thread scheduler can also benefit from the existence of a ready-rolled scheduler that will save both development and validation time.
Pingback: UK Embedded » Blog Archive » Atomthreads: Open Source RTOS | Kelvin’s Thunderstorm