For our final project in CS3600 Operating Systems, Stephen Chavez and I wrote an operating System in ARMv6 assembly language that runs on the Raspberry Pi. Our initial work was based of a tutorial called Baking Pi, a Cambridge University operating systems programming tutorial that targets the Raspberry Pi. We completed the tutorial series, and from there went on to add functionality, ramp it up, and create a bare-bones operating system that could be re-purposed for many things.
The code is all ARM, although it uses a custom c Library for the generic keyboard driver. The compiled files are linked together using a linker script and a make-file written by Alex Chadwick, who also wrote the tutorial series. ApothemOS is approx 5000 lines of assembly language code, more than 75% of it being our modifications to what we were left with after completing the tutorial.
One of the most important aspects of our functionality is the complete control over all GPIO pins available. Apothem OS can turn on or off any or all or none of the 54 GPIO pins on the board. via it’s command line, and functions are in place where combinations could be applied. There is a command for each one, i.e.
gpio16 on would turn on GPIO pin #16.
ApothemOS has 59 commands, control over all GPIO pins, a help menu, and several humorous ASCII art commands based on Linux programs such as “cowsay” or other similar programs that echo text. We were more or less just trying to display functionality. However, things can still get confusing, so we added a help menu command
help. The help menu is informative and tells the user how to use each command currently in use in a helpful and simple way, we believe at least.
But having control over all available GPIO pins is a great place to start with I/O and I’ve constructed a 3X3X3 cube to test the pin functionality with some success. Initially, our project was going to be to try to get the LED lights to sync with music, but we ran out of time. An OS is a large enough undertaking as it is in 5 weeks. Here is a picture of the GPIO breakout connected to a breadboard that houses the test LED cube, which BTW, taught me I’m not a very good electrical engineer.
The future of ApothemOS could be that it is re-purposed and stripped down to a level where teachers could assign ARM programming assignments on a Raspberry Pi running ApothemOS, so that the student should get a hands on learning experience. When I learned ARM at first, it was very difficult to even find a way to emulate it, let alone have any fun with it. All this would require would be that students at the particular institution would have to be required to buy a Raspberry Pi unit, but the cost for a bare bones raspberry Pi is $35 and a full kit with everything you could need as a beginner runs roughly $60. So it’s not that unreasonable to ask of a student to purchase one of these units.
Here’s a pic of my unit I got as a present that cost $60:
I plan to attempt to persuade my school to adopt this teaching device for assignments, and hope that something good can come out of it. If not, ah well, I tired… But working with Stephen and doing this assignment (which was not one of the original three assignment choices, but a custom one we got permission for), I learned more about assembly programming doing this assignment than I have in the last 2 years running simulators.
Overall, this was a great way to learn ARM, we are very proud of it, and we hope it can benefit others. It’s licensed in a way that you could do whatever you wanted with it, and the whole source code/developers package can be downloaded from git-hub for people to check out by clicking on this link.. Or you could download a ZIP file in the downloads section in the widgets bar. That site also includes a project description, links to pictures, videos, etc… It’s really the place that documents the project as a whole and the best resource we have to offer. Feel free to make pull requests or fork to your own repository through GIT, SVN or whatever you use. It’s there for people to play with at this point. We had a lot of fun making it, so I hope everyone checks it out if you have the time.