Operating Systems Development With The Raspberry Pi

Raspberry Pi - rpi

Even though the Raspberry Pi has, from the very beginning, been touted as an educational computer, we’ve seen neither hide nor hare of coursework, lesson plans, or even computer sciencey tutorials using the Raspi. We’re guessing academia works at a much slower pace than the average hardware hacker, but [Alex Chadwick] at Cambridge University has managed to put together an online tutorial on developing an operating system from scratch for the Raspi.

The goal of this tutorial is to throw a budding Raspi tinkerer into the strange and confusing world of registers, hexadecimal, and ARMv6 assembly. After going through the necessary toolchain, [Alex]’s tutorials cover blinking the ‘OK’ LED on the Raspberry Pi using only assembly.

The OS development guide goes on from there to include drawing graphics on the screen and even accepting input from a USB keyboard.

It’s important to point out what [Alex]’s tutorial isn’t; even though this series of tutorials goes through manipulating the bare metal of the Raspberry Pi, don’t expect to be porting UNIX to the Raspi after going through these guides. That being said, after completing these tutorials, you’ll be in a fabulous position for building your own homebrew OS on the Raspberry Pi.

20 thoughts on “Operating Systems Development With The Raspberry Pi

    1. This is a deeply confused question that rather suggests that you don’t really understand what you’re saying.

      There is a world of difference between these two things, it’s difficult to distill it into a blog reply. The best way to illustrate is to say that if you can reply to my message here on a machine built entirely with 7000 series logic, and you think it’s easier than using a pc, then I will concede the point to you. If not, you have your answer.

  1. It has this gem hidden in there: “I’m pleased to say I did get one [USB host driver] that works with no external help from the Operating System, and can talk to a mouse and keyboard. It is by no means complete, efficient, or correct, but it does work.” That is Fab to have around!

    And a lot more detail on what the Pi is doing at various operation points without RTFS (source) annoyances.

  2. Most Universities do not publish their course work, purely because it costs money to develop it.
    They can then sell it on at a massive profit, in excess of $2,000usd per student.

  3. “…fabulous position for building your own homebrew OS on the Raspberry Pi.”

    Or “bare metal” booter games the likes of which haven’t been seen since the days of the IBM PC, PC/XT and Amiga.

    The early IBMs were simple enough and even the clones were close enough to the IBM to be identical that it was possible to write a game that directly accessed all the hardware it needed.

    The Amiga had much of its OS in ROM which was documented well enough that individual programs could be written to make direct ROM and hardware calls, bypassing the need for the part of the OS normally loaded from floppy or hard disk.

  4. This is really cool. It’s something that I’ve always wanted to do… but be it Linux or FreeRTOS or something was always available that meant I didn’t have to…. I might just give it a go.

  5. I thought operation systems were all about implementing a memory management scheme (using the MMU) and also amongst others thread scheduling I can’t find any of this in the University’s coursework.
    Shouldn’t this just be called “bare metal” programming for the raspberry pi?

    1. Then, I think you just learned that not all machines have MMU’s (i.e. many embedded platforms), not all operating systems require MMU’s (i.e. uClinux), and some operating systems do not multithread or multiprocess (i.e. DOS).

      But if you’re clever, you could implement these things on top of Baking Pi, and have an even better operating system. Good luck!

    2. True most OSs implement a memory management system (malloc, free, etc). That doesn’t mean they use the MMU. A lot of chips don’t have MMUs.

      OS is, at its most basic, a task scheduler (doesn’t even need to support multiple tasks), an application loader, and a basic abstraction of the hardware underneath.

  6. I’ve considered teaching myself enough to write a basic x86 OS for years. Never quite had the motivation, or found a set of tutorials anywhere near comprehensive enough. So I might give this a go +1!

  7. its about writing programs for broadcoms mailbox api, communication with the os running on the videocore.
    thats no more bare metal, than writing a program for winapi, posix or even dos.

    the open firmware is bare-metal, and usb is nearly there, but somone still need to initialize the hdmi.
    and yes there is still the bootrom, but that is litteraly a part of the bare metal.

    it is not bare metal, but still a great tutorial..

Leave a Reply to Mental2kCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.