Home News Features Examples Code FAQ License
AVR Webring
Prev Hub Join Rate Next
Femto OS: Operating System for small embedded devices.

What is this?

The Femto OS is a very concise portable preemptive operating system (RTOS) for embedded devices with minimal ram and flash, up to say 16K flash, 1K ram. The main target is the AVR architecture, such as the ATtiny861/461/261 series. But the system is written in C with a separate port file.

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 12 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. See below for more details. 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). All demo's run on a ATtiny861 and, depending on the code size, also on the smaller models. Most of the demo's run directly on the STK500 board, some require extra (but very simple) hardware. Femto OS is distributed under GPLv3 but a commercial license and support are available.

Femto OS basics in Figures

Maximum number of tasks: 16
Maximum number of priorities: 8
Maximum number of locks: 15
Minimum tcb size per task: 2 bytes
Minimum stack size per task: 4 bytes
Maximum stack size per task: 255 bytes
Minimum OS stack size: 9 bytes
Minimum OS other ram usage: 3 bytes
Smallest application: 366 bytes

Femto OS is specially made for small embedded devices. It relies heavily on preprocessor processing of the source code. The generated code depends on the setting of the configuration parameters. Femto OS is bound to the limits given, and although it can be used in larger systems without much modification, the code does not scale well beyond its limits. This is intentional. It is better to use an other OS, such as the FreeRTOS for such applications.

Femto OS roadmap

A number of functionalities are lacking at this moment. 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. Most important for me in the near future is a file system on the EEPROM. After that i will probably work on some kind of IPv2, to couple multiple avr's.

Femto OS demo application in Figures

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. More about these examples can be found on the page 'examples'.

Application FLASH RAM #tasks Short description
Bare 366 12 0 Counts with leds in the idle 'task'.
Minimal 632 31 2 Copies the switches to leds.
FlashLeds 960 76 8 Runs eight leds independently flashing.
Watchdog 1888 177 10 Shows how the watchdog catches a crashed task.
Rendezvous 1412 190 9 Multiple rendez-vous synchronizing.
Queues 1874 101 3 Pumping data through a queue.
Sleep 1246 68 3 Low power sleep in between the led blinking.
Hooks 878 30 1 Show how to use the system hooks.
Interrupt 2206 150 4 Demonstrates the different interrupt modes.
Shell 5752 482 10 Eight leds blinking controlled by a shell.
Passon 1980 249 10 Testing use of simultaneous mutexes.

Note the the numbers above may slightly differ from the ones found in the examples since i do not always update the above to the latest modifications to the code. Usually that implies that the ratio code size over functionality decreases. 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. Calculation: 4+4=8 bytes per task, 9+3=12 bytes for the OS, total 8x8+12=76 bytes.

Femto OS motivation

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 then 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.

Contact: info@femtoos.org