This repository is aimed to provide a starting point to whoever is trying to build a BCM2835 program from scratch. This repository contains linker scripts and start up codes for it, as well as practical examples of how to work with the Mini UART interface and the frame-buffer graphics. It also contains a basic Rust implementation of the Bresenham' line drawing algorithm.
If you are here you are probably looking for somewhere to start your baremetal journey. Here are a couple of links that really helped me:
- Dwelch67's pi tutorial:
- BCM283' framebuffer (unofficial documentation)
- Jsandler18's tutorial
- Raspberry Pi 4 Rust Os (too many architectural differences)
The systems running BCM2835 are:
- Raspberry Pi B
- Raspberry Pi B2
- Raspberry Pi A+
- Raspberry Pi B+
- Raspberry Pi Zero
NOTE: I haven't tested any of the aforementioned machines, except for the Pi B+.
You will need to have installed the latest version of the arm-none-eabi-gcc
toolchain: this program uses it for linking. Check out rpi.json for
more informations on how the target of this program is structured. You will also need make
.
make bin
This will output a target/kernel.bin
bin file, ready to be used on the BCM2835.
- Get a compatible SD Card. I have a generic Toshiba 4GB SDHC
- Create a new
DOS
partition table - Partition a
W95 FAT32
partition of your size choice - Get from here these files:
- bootcode.bin
- fixup.dat
- start.elf
- Move the files in the newly created FAT32 partition
- Create a
config.txt
file with these contents:
enable_uart=1
uart_2ndstage=1
kernel=kernel.bin
- Move the previously compiled
target/kernel.bin
on the SD card - Unmount the partition and eject the SD card
- Profit!