A minimal ARM OS for the Raspberry Pi Zero.
This is my personal bonus project for the course "Embedded Systems Design" [ECE1258].
Table of Contents
Features
Currently, it:
- Boots,
- Communicates using the serial port UART0,
- Utilizes peripherals (ARM/64-bit Timer, LED),
- Utilizes the floating point coprocessor,
- Serves interrupts,
- Manages the memory,
- Implements Virtual Memory,
- Performs context switches,
- Utilizes spinlocks and mutex.
Demo Console
Once the OS is launched and everything is initialized, execution is passed to a demonstration console that can be accessed through /dev/ttyUSB0.
The demo console accepts a few commands:
help
Displays a list of available commands
intr
Setups a repeatable IRQ interrupt that blinks the LED light of
the Pi once every second.
proc
Setups the scheduler, launches a kernel and a user process and
switches between them seamlessly.
lock
Same as proc, but also utilizes mutex locks.
Control is still switched continuously between the two processes;
however, they share a lock, and they sequentially un/lock it.
fpuo
Performs a floating point operation using the floating point coprocessor.
Proof can be found in the kernel.list file that is produced during
compilation if one looks for the fpu_mult details.
Note that separate function must be used to produce the result
(fpu_mult in common/stdlib.c), otherwise the compiler just
precalculates the result.
Requirements
- A Raspberry Pi Zero (stock, W or WH model),
- A USB-to-TTL Serial Cable,
- A properly formatted SD Card,
- A Serial Console (dterm, minicom, screen).
Installation
Manual
- Clone the repository.
cd build
make
- Copy the resulting
kernel.img
to the first partition of your SD Card.
Automatic
- Clone the repository.
- Plug your SD Card in.
cd scripts
./makerLoader.sh
Project Tree
$root
├ build
├ common
├ docs
├ drivers
├ include
│ ├ common
│ └ drivers
├ kernel
└ scripts
References
ARM Architecture Reference Manual, ARMv7-A and ARMv7-R edition
ARM1176JZF-S Technical Reference Manual, revision r0p7
Resources
OSDev.org RaspberryPi Tutorial
RaspberryPi Zero BareMetal Examples by dwelch67
Building an OS for the RaspberryPi by jsandler18
Miscellaneous
Coding style mostly follows the linux kernel coding style.
Shield badges provided by Shields.io.