A bare-metal operating system for Raspberry Pi built from scratch using ARM assembly language.
This project implements a minimal operating system following Cambridge University's "Baking Pi" tutorial series. It demonstrates low-level hardware programming without any existing OS layer.
- Lesson 1-2 (OK01-OK02): GPIO control and LED blinking
- Lesson 3 (OK03): Functions, stack management, and code organization
- Lesson 4 (OK04): System timer for precise delays
- Lesson 5 (OK05): Data storage and pattern sequences
- Lesson 6 (Screen01): Framebuffer graphics and screen output
baking-pi/
├── source/
│ ├── main.s # Main program entry and rendering loop
│ ├── gpio.s # GPIO controller functions
│ ├── systemTimer.s # System timer functions
│ ├── mailbox.s # Mailbox communication with GPU
│ └── framebuffer.s # Framebuffer initialization
├── build/ # Compiled object files (generated)
├── Makefile # Build automation
├── kernel.ld # Linker script
└── kernel.img # Final kernel image (generated)
sudo apt-get update
sudo apt-get install gcc-arm-none-eabi make qemu-system-arm# Clean build
make clean
# Compile
makeThis generates kernel.img which can be run on Raspberry Pi or in QEMU.
qemu-system-arm -m 1024 -M raspi2b -kernel kernel.img -serial stdioYou should see a colorful gradient pattern on the screen!
- Boot: The Raspberry Pi loads
kernel.imgat address 0x8000 - Initialization: Sets up stack pointer and initializes framebuffer
- GPU Communication: Uses mailbox to request framebuffer from GPU
- Rendering: Continuously draws pixels to screen memory
- Display: GPU reads framebuffer and outputs to screen
- Architecture: ARMv6 (Raspberry Pi 1)
- Assembler: GNU ARM Assembler (arm-none-eabi-as)
- Display Mode: High Color (16-bit, 65,536 colors)
- Resolution: 1024x768 pixels
- Memory Layout: Code at 0x8000, stack grows down from 0x8000
- ARM assembly language and instruction set
- Bare-metal hardware programming
- Memory-mapped I/O
- Function calling conventions (ABI)
- Stack management
- Hardware timers
- DMA and GPU communication
- Framebuffer graphics
Continue with:
- Screen02-04: Drawing lines, text, and terminal output
- Input01-02: Keyboard and mouse input
Educational project following Cambridge University's Baking Pi tutorial.