Roll Your Own Real-Time OS

A real-time OS is essential for most embedded applications.  However, those who buy a commercial one are often quite disappointed.  A typical system is like a creaky antique car, awkward to use and difficult to learn.  Furthermore, the cost is high and frequently involves royalties on each product sold.  Embedded Linux is an obvious alternative, but it consists of extensions to a non-real-time system and its documentation is frequently obscure.  In cases where only limited features are needed, one can use an automated tool to generate a real-time OS.  The cost is minimal, the time required is small, and the performance is high.  Similar tools have long been used to generate minimal systems software for new or specialized computers.

A typical example is SynthOS from Zeidman Technologies.  It allows a programmer to synthesize a real-time OS. The programmer writes code in standard C. He or she adds simple SynthOS statements to the C code to specify task and operating system parameters. The output code, after synthesis, is completely written in standard C. SynthOS allows programmers to use all their current tools, such as compilers, debuggers, interpreters, and emulators, to execute and debug the resulting code. SynthOS also optimizes code and checks to ensure that race conditions cannot occur and that tasks have the correct priorities and frequencies. It works with the GNU toolset and with other popular development environments.

Making SynthOS Work

When one task needs to call another, or wait for another to complete, the programmer inserts a special SynthOS primitive that looks like a function call. The programmer also uses SynthOS to specify the parameters of each task, such as its priority and period, and to specify the requirements of the operating system such as the scheduling mechanism to use. SynthOS is then run on all the task code. It creates semaphores and message queues for each task and inserts the code at the appropriate points. SynthOS also creates management code to manage the tasks and their associated message queues and semaphores.

Because SynthOS’ output is in standard C, users can see everything that is going on in the operating system. All the tools used to compile and debug the tasks can also be used on the OS. The OS code can also be easily modified manually, if necessary, giving the user complete control over it.

SynthOS is very easy to set up and use via a simple command line interface. A graphical user interface is currently under development. SynthOS has been used successfully to create an operating system for a self-contained, multitasking web server running on an Altera 32-bit Nios processor.

Conclusion

The code produced by SynthOS is completely royalty free.  Also, the OS’s memory requirements are small because SynthOS only creates the code required for the various tasks. SynthOS fulfills the promise of automatic code generation for low cost, small footprint task management. It gives designers flexibility and control that no off-the-shelf RTOS or program development tool can offer.

Jacob Harel
VP of Product Management
Zeidman Technologies