|Femto OS: RTOS for small MCU's like AVR.
The Femto OS is a very concise portable real time - preemptive operating system (RTOS) for embedded microcontrollers with minimal ram and flash, say 2KB .. 16KB flash and 128 .. 1024 bytes ram. The main target is the Atmel AVR architecture, such as the ATtiny or smaller ATmega series. The OS runs well on larger hardware also. The system is written in C with a separate port file. Porting has been done for 44 AVR devices.
The typical footprint is between 1K and 4K flash, depending on the functions used. Somewhere around 2K for the OS itself is realistic figure for normal applications. The OS takes between 10 and 20 bytes of ram, tasks can take as little as 6 bytes of ram, but approximately 20 to 40 bytes is more realistic for real applications. Figures are including the stack. It is perfectly possible to run 4 or more tasks on an ATtiny261. There is no separate idle task and most api function calls run in OS space. The OS is interruptible most of the time, if needed. There are tools to watch and protect the use of the stack of the tasks and the OS.
The code itself is heavily documented, and comes with a number of example applications, (which are minimally documented, but are intended to speak for themselves). Demo's run on all devices for which a port is available. Most of the demo's run directly on the STK500/STK501/STK503 boards, some require extra (but very simple) hardware. Femto OS is distributed under GPLv3 but a commercial license and support are available.
Femto OS is specially made for small embedded devices. For example, the 'Smallest application' is the application called 'Bare' compiled for the ATmega8. It solely runs a 16 bit led counter on the idle task hook. It consumes 258 bytes of flash and 10 bytes of ram. Femto OS is specially designed for gcc, and the generated executeable depends on preprocessor processing of the source code. Therefore, Femto OS is bound to the limits given above. If you need to run more than 16 tasks, or more synchronization primitives, you need to use an other OS, such as the FreeRTOS for those applications.
The OS is fairly complete by now, although there is always room for more. I will however not add any code that increases the core code of the OS. Adding optional functionality (i.e. which can be left out depending on the configuration parameters) can be taken into consideration. I have some small wishes, like a simple heap manager.
Most important for me in the near future is making it rock stable. I have one implementation of version 0.82 on a ATtiny861 continuously running from april 2008 now! Then i will probably work on some kind of IPv2, to couple multiple avr's, and maybe a kind of IP stack (Femto IP).
Below find the sizes of the code (in bytes) for several test applications (OS included, ready to run). This is to give an indication what we are talking about. Numbers are for the ATtiny861. More about these examples can be found on the page 'examples'.
|Counts with leds in the idle 'task'.
|Copies the switches to leds.
|Runs eight leds independently flashing.
|Watchdog catching a crashed task.
|Multiple rendez-vous synchronizing.
|Pumping data through a queue.
|Low power sleep in between led blinking.
|Show how to use the system hooks.
|Show the different interrupt modes.
|Eight leds blinking controlled by a shell.
|Testing use of simultaneous mutexes.
|File system stress test.
|Displays Hello World in ascii.
Note that the numbers above may slightly differ depending on the port. Smaller devices usually produce smaller footprints. Apart from "Bare", "Minimal" and "FlashLeds" the applications above are not designed to be as small as possible. Note for example that FlashLeds uses almost the minimal ram. The tcb is 2 bytes larger than the minimum due to the delay information. This application uses a shared stack for all tasks, with the minimum size of 4 bytes. Calculation: 4 bytes per task, 8+3=11 bytes for the OS, 4 bytes for one stack, thus total 4x8+11+4=47 bytes.
The Femto OS project (which is a total 'spare time' project) commenced in august 2007. The whole system was written from scratch. I was inspired by the FreeRTOS (who did a wonderful job, but was to large for the ATtiny devices for anything serious) but my OS is a totally different product.
The name Femto OS is meant to indicate that the OS is really small, significantly smaller than pico]OS, but that room is left for an even smaller OS (atto OS). An other nice point was that, at the moment i started writing, the keyword femtoos not only had a free domain, but that it was totally unused on the internet, see the google search. Truly amazing, a keyword of seven letters and no hits! Btw, Yahoo obtained the same result.
|CC-BY License: Ruud Vlaming.