COMP 4550 - Realtime Systems

I have never taught this course, but I have been the official TA and marker for it, and I have a lot of experience working with embedded and realtime systems.

The world of small-scale computing has been changing quite dramatically in the last several years. With the advent of the Arduino community, and low-cost PCs able to run full operating systems (like the Raspberry Pi and Udoo boards), the need to write code in C or assembly to run on a micro-controller is less-common outside very specific and niche areas.

That being said, you learn SO FRAKKIN' MUCH writing an 8-bit OS from scratch. Without access to a terminal (let alone a GUI or file system) for debugging, you learn how to think through your code to a level that's simply not needed when working with Eclipse or Visual Studio. The usefulness of a single LED that you can turn on and off, or a piezo-electric speaker that can buzz at different frequencies cannot be over-stated.

Is writing bare-metal code (i.e. code intended to run directly on a microcontroller without the benefit of an operating system shell) easy? No. Is it fun and rewarding when you finally get something working the way it should? Absolutely.

AVR Butterfly Samples

The AVR Butterfly is a cheap evaluation tool for the ATmega169 CPU. It includes multiple GPIO pins, LCD screen, five-direction switch, and a piezo-electric speaker.

Below are some simple programs I've written for the AVR Butterfly. None of these are especially complex, but they may be useful for anyone looking for examples code for the AVR-family of processors.

Examples

FrigOS

When I took COMP 4550 as an undergrad, our last assignment was to implement an interrupt-driven, multi-tasking OS for the AVR Butterfly. Eventually this work led to the development of Freezer OS by students in the AA Lab. Work on Freezer OS continued for many years, and eventually I worked on it as part of my graduate-level Realtime Embedded Systems course.

In the grad-level course we added several novel features, the most notable was the introduction of Monitor Threads -- stackless, mini "threads" that are executed during the scheduler context switch for the purposes of setting global condition flags. The main reasons for implementing this feature was two-fold:

  1. reduce RAM usage by not allocating stack space for simple polling tasks, and
  2. allow the implementation of asynchronously-checking while-loops.

(If you are interested in more about Monitor Threads, please read this paper on the subject.)

After finishing with the course I decided to fork my own implementation of Freezer OS into my own, independently managed project, licensed under the GPL. This project, named FrigOS, is available as a Git project.

Note that FrigOS is still in-development, and is not feature-complete. However, if you're looking for a good example of a multi-tasking OS that includes support for monitor threads, it may serve as a useful source.