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

Overview

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!
You might also like...
Standard Graphics is a command-line tool for printing 2D graphics from any language to any screen.
Standard Graphics is a command-line tool for printing 2D graphics from any language to any screen.

2D graphics in any programming language with just print statements!

A graphics engine that I made in rust for my high school graphics course.

A graphics engine that I made in rust for my high school graphics course.

ARM TrustZone-M example application in Rust, both secure world side and non-secure world side

ARM TrustZone-M example application in Rust, both secure world side and non-secure world side; projects are modified from generated result of cortex-m-quickstart.

A framebuffer that takes a `&[bool]` slice and returns 2x4 dot (pixel) braille `char`s

A framebuffer that takes a &[bool] slice and returns 2x4 "dot" (pixel) braille chars.

Cross platfrom window and framebuffer crate for Rust

minifb is a cross platform library written in Rust and that makes it easy to setup a window and to (optional) display a 32-bit pixel buffer. It also m

Deno wrapper around minifb, for making a framebuffer you can draw pixels to

deno minifb This is a thin wrapper around minifb that you can use in deno. Combine it with canvas for native window that works like the canvas web API

ePaperify: Framebuffer/image pre-processing library for e-Paper displays

ePaperify: Framebuffer/image pre-processing library for e-Paper displays

A pure, low-level tensor program representation enabling tensor program optimization via program rewriting

Glenside is a pure, low-level tensor program representation which enables tensor program optimization via program rewriting, using rewriting frameworks such as the egg equality saturation library.

A working, tested example for how to use Rust with warp and JWT

rust-jwt-example Example of JWT authentication and authorization in Rust using Warp Login curl http://localhost:8000/login -d '{"email": "user@userlan

A working example of multi targets compilation for Rust using Github Actions.

A working example of multi targets compilation for Rust using Github Actions. Supports Windows, MacOSX, x86_64, ARM and Raspberry PI Linux.

A variation of the solana helloworld program example with a client written in Rust instead of Typescript

Simple Solana Smart Contract Example This repository demonstrates how to create and invoke a program on the Solana blockchain. In Solana the word prog

OpenSK is an open-source implementation for security keys written in Rust that supports both FIDO U2F and FIDO2 standards.
OpenSK is an open-source implementation for security keys written in Rust that supports both FIDO U2F and FIDO2 standards.

OpenSK This repository contains a Rust implementation of a FIDO2 authenticator. We developed this as a Tock OS application and it has been successfull

OpenSK is an open-source implementation for security keys written in Rust that supports both FIDO U2F and FIDO2 standards.

OpenSK This repository contains a Rust implementation of a FIDO2 authenticator. We developed OpenSK as a Tock OS application. We intend to bring a ful

A simple program for C program IO testing. Written in Rust

A simple program for C program IO testing. Written in Rust, using concurrency to speed up valgrind testing. Make sure to update settings at your first run of the program!

A crate to convert bytes to something more useable and the other way around in a way Compatible with the Confluent Schema Registry. Supporting Avro, Protobuf, Json schema, and both async and blocking.
A crate to convert bytes to something more useable and the other way around in a way Compatible with the Confluent Schema Registry. Supporting Avro, Protobuf, Json schema, and both async and blocking.

#schema_registry_converter This library provides a way of using the Confluent Schema Registry in a way that is compliant with the Java client. The rel

A rust drawing library for high quality data plotting for both WASM and native, statically and realtimely 🦀 📈🚀
A rust drawing library for high quality data plotting for both WASM and native, statically and realtimely 🦀 📈🚀

Plotters - A Rust drawing library focus on data plotting for both WASM and native applications 🦀 📈 🚀 Plotters is drawing library designed for rende

An end-to-end encrypted, anonymous IP-hiding, decentralized, audio/video/file sharing/offline messaging multi-device platform built for both communications and application security and performance.

An end-to-end encrypted, anonymous IP-hiding, decentralized, audio/video/file sharing/offline messaging multi-device platform built for both communications and application security and performance.

rust_arango enables you to connect with ArangoDB server, access to database, execute AQL query, manage ArangoDB in an easy and intuitive way, both async and plain synchronous code with any HTTP ecosystem you love.

rust_arango enables you to connect with ArangoDB server, access to database, execute AQL query, manage ArangoDB in an easy and intuitive way, both async and plain synchronous code with any HTTP ecosystem you love.

UnTeX is both a library and an executable that allows you to manipulate and understand TeX files.

UnTeX UnTeX is both a library and an executable that allows you to manipulate and understand TeX files. Usage Executable If you wish to use the execut

Owner
Pietro
@stack_smash on telegram.
Pietro
The sysroot manager that lets you build and customize `std`

PSA: Xargo is in maintenance mode xargo The sysroot manager that lets you build and customize std Cross compiling `std` for i686-unknown-linux-gnu Xar

Jorge Aparicio 993 Jan 2, 2023
GPIO reader, writer and listener

Unbothered gpio Everything is unwrapped under the hood for the precious prettiness of your code. It's more than a simple Rust crate, it's a philosophy

null 0 Nov 7, 2021
Libraries and tools for the SMT-LIB-2 standard.

smt2utils: Libraries and tools for the SMT-LIB-2 standard This project aims to develop Rust libraries and tools around the SMT-LIB-2 standard. The SMT

Meta Incubator 18 Dec 16, 2022
Raspberry PI library for Rust. GPIO controller, L298N motors, sockets and "i2clib" integrated

raslib Raspberry PI library for Rust. GPIO controller, L298N motors, sockets and "i2clib" integrated All tests are made on Raspberry PI 4B+ on Raspbia

Anтo 5 Apr 12, 2022
A program to share a TTY like a GPS UART between 2 processes.

TTYTEE - A process that exposes 2 copies of the same TTY. The initial use case for this crate has been sharing a single GPS device talking through an

Skyways 4 Jun 25, 2023
Generic framebuffer implementation in Rust for use with embedded-graphics library

Fraramebuffer implementation for Rust's Embedded-graphics Framebuffer approach helps to deal with display flickering when you update multiple parts of

Bernard Kobos 9 Nov 29, 2022
Easy c̵̰͠r̵̛̠ö̴̪s̶̩̒s̵̭̀-t̶̲͝h̶̯̚r̵̺͐e̷̖̽ḁ̴̍d̶̖̔ ȓ̵͙ė̶͎ḟ̴͙e̸̖͛r̶̖͗ë̶̱́ṉ̵̒ĉ̷̥e̷͚̍ s̷̹͌h̷̲̉a̵̭͋r̷̫̊ḭ̵̊n̷̬͂g̵̦̃ f̶̻̊ơ̵̜ṟ̸̈́ R̵̞̋ù̵̺s̷̖̅ţ̸͗!̸̼͋

Rust S̵̓i̸̓n̵̉ I̴n̴f̶e̸r̵n̷a̴l mutability! Howdy, friendly Rust developer! Ever had a value get m̵̯̅ð̶͊v̴̮̾ê̴̼͘d away right under your nose just when

null 294 Dec 23, 2022
1️⃣ el lisp number uno - one lisp to rule them all 🏆

luno el lisp number uno luno is the one lisp to rule them all. Still experimental, do not use it in production yet. goals embeddable small size simple

Eva Pace 3 Apr 25, 2022
Baremetal Backtracing on RISC-V

It provides a simple but useful backtrace in baremetal machine, basically it links DWARF info into the binary and print them when backtrace the program. Currently it only supports RISC-V architecture, but I did not see any barrier to make it available in other architectures like x86.

JohnWeston 3 Jun 25, 2021
Portable linked-list allocator designed for baremetal systems

Palloc Portable linked-list allocator for embedded / baremetal systems. Using the crate Include this in the [dependencies] section of Cargo.toml pallo

Pietro 3 Jan 11, 2022