Overview

The Raspberry Pi, as originally conceived, was designed to be a low cost computer learning platform - something akin to the throwback days of the Timex TS-1000, TI-99, or the incredibly popular Commodore 64. But an oddity I find ironic (about a computer learning platform) is that the materials one would need to program this platform bare metal are not easy to find. The Raspberry Pi foundation and Broadcom have notoriously been know to publish scant information about low-level programming. But resources do exist, if disjointedly. Here is my attempt to organize what I have found useful.

Tutorials

Raspberry-Pi Bare Metal Tutorial

A very well written set of examples and accompanying tutorial that starts very simply and then builds into some complex subject areas including graphics through the HDMI port. It covers the startup of the ARM CPUs on the Raspberry Pi nicely, in assembler, step by step. The author was recently updating the tutorials to work on the Pi 4.

Baking Pi - Operating Systems Development

An early online course from the University of Cambridge that document a series of tasks using bare metal programming techniques on the Raspberry Pi, that when taken together, cover the big picture components of operating system development. Written at an advanced high school level and does not assume much programming experience. Written in C and assembler.

Raspberry Pi platform without an operating system

An academic bachelor’s-level documentation project with comprehensive examples in C, published in a PDF.

Raspberry Pi 3 Bare Metal - Part 1

All assembler approach to bare metal RPi programming, done step by step with code repo.

Learning operating system development using Linux kernel and Raspberry Pi

Ambitious attempt to building an operating system from scratch for the RPi3 with comparisons and inspiration from the Linux kernel.

Asymmetric Multi Processing (AMP) with Raspberry Pi

Innovative write-up describing how to write and run bare-metal on one RPi3 core, along side the Linux kernel running on three others. This is called Asymmetric Multi Processing (AMP). Interprocess communication techniques are discussed. This technique can blend the benefits of a real-time kernel, one you develop for a specific task, with a more general, feature-rich, Linux kernel, to yield a system that performs well without everything having to be developed from scratch.

Code Samples

Raspberry Pi ARM based bare metal examples

One of the earliest collections of sample applications written in C covering UARTs, SPI, serial bootloaders, timers, interrupts, GPIO and more.

Bare Metal Programming on Raspberry Pi 3 by Zoltan Baldaszti

A more advanced set of examples with light write-ups. 64-bit only in C and some assembler.

Libraries

A C++ bare metal environment for Raspberry Pi with USB

The circle project is not a tutorial but a library of fully worked bare metal classes in C/C++. This includes USB with numerous drivers, UART, SPI, I2C, audio, NIC, file system drivers, graphics, and networking.

Languages

Bare metal Java for microcontrollers

This is a bare metal programming library which builds and embeds a Java runtime with your bare metal kernel. Supports Arduino, Raspberry Pi, Asuro, RCX.

Learn to write an embedded OS in Rust

This may belong in the tutorial section, as the repo is not a programming environment for Rust per se. But Rust is the focus. The most important section that can be universally applied to other languages for bare metal is the testing section. It’s brilliant.

MicroPython on bare metal Raspberry Pi Zero / Zero W / 2

A micropython port targeting the Raspberry Pi.

A JavaScript engine for Internet of Things

As the project implies, a Javascript engine for microcontrollers. I do not see any examples for the Raspberry Pi. I might create some…

Debugging

Bare Metal Raspberry Pi 3B+: JTAG

This is one of the few worked examples of showing how to use the JTAG GPIOs on the Raspbarry Pi to debug the Pi itself, bare metal, and NOT using the Pi as a host debugger.

RPi2 JTAG debugging

An openocd configuration file for bare metal RPi2 JTAG debugging.

RPi JTAG debugging

An openocd configuration file for bare metal RPi Zero JTAG debugging.

Manuals

BCM2835 ARM Peripherals Manual

A link list would not be complete without a reference to this manual. But do not read this manual without looking at the eratta. Very important!

RPi Mailbox Communication

Very hard to come by, this post documents some of the more important ARM->GPU mailbox messages.

The C Runtime Initialization

A nice description of the C runtime initialization. The code is not very useful, but the description of what happens is very good.

ARM1176JZF-S Technical Reference Manual

Definitive CPU documentation for the RPi Zero.

Utilities

Simple boot-over-serial bootloader for the Raspberry Pi

Bare metal RPi development requires moving an SD card back and forth between target and host, unless you have a way to boot over serial, JTAG, or network.