Huy's Notes
Bare Metal Raspberry Pi Notes

Bare Metal Raspberry Pi Notes

#rust #hardware #raspberry-pi

VideoCore is a low-power processor on Raspberry Pi to handle multimedia stuff, some document mentioned it as a GPU of the board. It also supported OpenGL ES.

Raspberry Pi 4 uses VideoCore VI processor, and it can handle textures as large as 7680x7680 pixels.

Reference: https://elinux.org/Raspberry_Pi_VideoCore_APIs


Mailboxes are the communication mechanism between the processor and VideoCore. There are two mailboxes on a Pi, call it M0 (to handle communication from VideoCore to processor) and M1 (for the other way).

Each mailbox has many virtual channels. For example, for framebuffer, LEDs, buttons, touch screen,...

Reference: https://github.com/raspberrypi/documentation/tree/JamesH65-mailbox_docs/configuration/mailboxes


To use QEMU to setup a Raspberry Pi emulator:

Reference:


To compile Rust for bare metal Raspberry Pi, we need to use arm-unknown-linux-gnueabihf target.

$ rustup target add arm-unknown-linux-gnueabihf

Since we're not directly compile our code to a binary, we should point it out in the code:

#![crate_type = "staticlib"]

In the linker process, there's also a function that needed, so we're required to do something like:

#[no_mangle]
pub extern fn __aeabi_unwind_cpp_pr0() {}

More on this later


Some good resources to get started with bare metal programming:

Reference:

Referred in


If you think this note resonated, be it positive or negative, please feel free to send me an email and we can talk.