Raspberry-Pi Bare Metal Tutorial
FreeRaspberry-Pi Bare Metal Programming in C Tutorial
FreeFree tier
About Raspberry-Pi Bare Metal Tutorial
A comprehensive, step-by-step tutorial series for bare-metal programming on Raspberry Pi in C. Created by Brian Sidebotham, this repository provides code examples and instructions covering the entire process from getting started to graphics and interrupts. The tutorial supports all Raspberry Pi models except the original RPi3 (the RPi3B+ is supported) and requires a Linux host for compilation. It includes a custom compiler script, dependencies on cmake and mtools, and is licensed under MIT. The series covers setup, C runtime, CMake integration, interrupt handling, and basic graphics output, making it ideal for learning low-level embedded development without an operating system.
Key Features
Step-by-step tutorial series covering Getting Started, C Runtime, CMake, Interrupts, and Graphics
Supports all Raspberry Pi models except the original RPi3
Linux host only for compilation
Custom compiler script provided (get_compiler.sh)
Dependencies: cmake and mtools for FAT32 SD card images
Includes firmware retrieval script (get_firmware_repo.sh)
MIT licensed – free and open source
Code examples in C and assembly (C 76.9%, Assembly 8.9%)
Links to original Cambridge tutorial, ARM Instruction Reference, and Circle C++ bare-metal environment
Pros & Cons
Pros
- Comprehensive, well-structured tutorial series with clear progression
- Covers a wide range of topics from booting to graphics
- Supports nearly all Raspberry Pi models (except RPi3)
- Uses C language – accessible for many programmers
- Includes practical, runnable code examples on GitHub
- Free and open source (MIT license)
Cons
- Only supports Linux host for compilation (no Windows or macOS support)
- Not compatible with original Raspberry Pi 3 (ACT LED pin issue)
- No longer maintained or tested on Windows
- Requires manual setup of custom compiler and firmware files
- Tutorial articles are hosted externally on valvers.com (not all content in repository)
Best For
Learning bare-metal programming on Raspberry Pi from scratchUnderstanding ARM assembly and C runtime initializationDeveloping low-level embedded systems without an operating systemExperimenting with graphics and interrupt handling on RPiTeaching embedded systems concepts using a popular single-board computer
FAQ
What Raspberry Pi models are supported?
All Raspberry Pi models are supported except the original RPi3 (the RPi3B+ is supported). The omission is because the ACT LED is not connected to an IO pin on the original RPi3.
What operating system is required to compile the tutorial code?
Only Linux is supported as a host for compiling the tutorial code. Windows support has been dropped and is no longer tested.
How do I get started with the tutorial?
Clone the repository, run the get_compiler.sh script to set up the compiler, and run get_firmware_repo.sh to obtain the Raspberry Pi firmware. Then follow the step-by-step articles on valvers.com.
What is the license for this tutorial?
The tutorial and its code are released under the MIT license, allowing free use, modification, and distribution.
What topics are covered in the tutorial series?
The series currently includes parts on Getting Started, C Runtime, Introducing CMake, Interrupts, and Basic Graphics. Each part builds on the previous one.