Sample source: Baremetal source code for Raspberry
FreeBaremetal Raspberry Pi code: multicore schedulers, FreeRTOS, USB, and graphics demos
FreeFree tier
About Sample source: Baremetal source code for Raspberry
A comprehensive collection of baremetal Raspberry Pi code, primarily focused on multicore task scheduling, FreeRTOS integration, USB driver development, and graphics demos. The repository includes a 4-core switcher with round-robin scheduling (xRTOS), MMU support, a compact USB driver (CSUD redux), and GLES examples. It supports Raspberry Pi 2 and 3 in both AARCH32 and AARCH64 modes, and provides cross-compilation instructions for Windows and Linux.
Key Features
Multicore task scheduler (xRTOS) with round-robin scheduling for 4 cores
FreeRTOS 10.1.1 integration on single and multicore
MMU (Memory Management Unit) support for virtual memory
Reduced USB driver (CSUD redux) providing control channel functionality for enumeration
GLES 2.0 examples including simple rendering, models, and rotation
Cross-compilation support with makefiles for Windows and Linux
Support for Raspberry Pi 2 and 3 (AARCH32 and AARCH64)
SD/FAT32 file system access
Arduino-style blinker example
Pros & Cons
Pros
- Open source with full source code available on GitHub
- Well-documented cross-compilation setup for multiple operating systems
- Covers a wide range of baremetal topics from fundamental blinker to multicore and graphics
- Active repository with 46 commits and community forks
- Supports both 32-bit and 64-bit ARM architectures on Pi3
- Includes a separate dedicated repository for multicore code
Cons
- Limited to Raspberry Pi hardware (Pi2, Pi3, some Pi1 support but not for multicore)
- Not suitable for beginners without prior baremetal or embedded experience
- Documentation may be sparse for some components (e.g., GLES setup)
- Some code is specific to older Pi models and may require adaptation for newer boards
- Primarily focused on Windows development despite recent makefile support for Linux
Best For
Learning baremetal programming on Raspberry PiBuilding custom operating systems or RTOS experimentsDeveloping multicore task schedulers and synchronizationUnderstanding USB device enumeration and driver developmentExperimenting with GPU-accelerated graphics (GLES) on baremetalEducational projects in embedded systems and low-level programming
FAQ
Does this code work on Raspberry Pi 1?
Multicore code is designed specifically for Pi2 and Pi3 and will not work on Pi1. Some other code (e.g., USB) may work on Pi1 in 32-bit mode.
What toolchain is needed to compile the code?
For 32-bit, the ARM GNU toolchain (gcc-arm-none-eabi) is recommended. For 64-bit on Pi3, the Linaro aarch64-elf toolchain is used. Cross-compilation can be done on Windows or Linux.
Can I use this code on Raspberry Pi 4?
The repository was created before Pi4 release and primarily targets Pi2 and Pi3. Adaptation may be needed for Pi4 hardware.
Is the code only for Windows?
Originally developed with a focus on Windows, but the repository now includes makefiles and documentation for Linux compilation as well.