Bare metal Raspberry Pi 3 tutorials
FreeBare Metal Programming on Raspberry Pi 3
FreeFree tier
About Bare metal Raspberry Pi 3 tutorials
This repository provides a series of bare metal programming tutorials for the Raspberry Pi 3 (64-bit ARM). The tutorials are designed for hobby OS developers who want to learn how to interface directly with the hardware, covering topics such as UART serial communication, mailbox property tags, framebuffer graphics, reading from the boot partition, virtual memory, and exception handling. Each tutorial is a self-contained example in C (with some assembly) and includes a cross-compiler setup guide. The author assumes basic GNU/Linux knowledge and explicitly states this is not a full OS tutorial but rather a low-level hardware interfacing guide.
Key Features
Cross-compiler setup for ARM64
64-bit bare minimum kernel
Multicore CPU initialization
UART1 and UART0 serial console
Mailbox property channel (hardware info, framebuffer, clock)
Hardware random number generator
Timer delays
Power management (turning off cores, watchdog)
Framebuffer with linear frame buffer
PC screen font rendering
Pros & Cons
Pros
- Step-by-step examples that compile out of the box
- Covers most hardware peripherals of the Raspberry Pi 3
- 64-bit architecture leverages large address space
- Open source under MIT license
- Well-structured repository with numbered folders for each topic
Cons
- Primarily for Raspberry Pi 3; Pi 4 has a different MMIO base address
- Assumes familiarity with GNU/Linux command line and toolchain
- Not a full operating system tutorial (no multitasking, memory management, or VFS)
- Limited documentation beyond the code comments and README
Best For
Learning bare metal programming on ARM64Developing hobby operating systems for Raspberry Pi 3/4Understanding low-level hardware interfacing (UART, GPU, interrupts, MMU)Creating standalone embedded applications without an OS
FAQ
Is this tutorial for Raspberry Pi 4?
The tutorial focuses on Raspberry Pi 3 (BCM2837). It notes that the same peripherals are used on Pi 4, but the MMIO_BASE address differs. The author recommends rpi4-osdev for Pi 4 specific tutorials.
Why is the tutorial written in C and not C++ or Rust?
C in freestanding mode allows direct hardware access without a runtime library. C++ requires a runtime, which is covered by the Circle library. The author personally prefers C for this type of bare metal work.