Skip to content

Example of a Baremetal program written for the Rasperry Pi 1 (BCM2835). Both the UART and the Framebuffer graphics working

License

Notifications You must be signed in to change notification settings

BRA1L0R/raspberrypi-1-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Learning resources

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:

Compiling

Requirements

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.

Using make:

make bin

This will output a target/kernel.bin bin file, ready to be used on the BCM2835.

Preparing the SD Card:

  • 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!

About

Example of a Baremetal program written for the Rasperry Pi 1 (BCM2835). Both the UART and the Framebuffer graphics working

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published