I've reached the limits of the QEMU implementation and my physical board is dead. Since this is a 10-year-old board anyway, I likely will not do much more work on this.
BlogOS -- Excellent course. Highly recommended.
Rust -- Ergonomics are great. Didn't offer many advantages over C for this very low-level project (interrupts, peripherals, etc.) and you still need to learn cc, as, ld.
Loosely following https://os.phil-opp.com/. Adapted for the armv6 CPU in the raspberry pi 1 model B+.
- Freestanding executable running on QEMU. See cargo config and target json for details (cross-compilation, custom linker.ld, etc). Pieced together from the internet and the arm reference manual.
- Bootloader from scratch. See
setup.S
-- no blog-os bootloader crate for ARM, plus it was kind of interesting to have to figure it out. - Basic input and output over the raspi1's UART (configure the UART and read and write characters). This is instead of VGA text mode, which doesn't exist on ARM (I think).
- Testing.
- Refactor the uart code for singleton example
- Use
readc!
instead of getc - Exceptions
- macro for the _irq stuff
- tick tock
- Memory!
- virtual addresses.
- Bug: if you mash tons of keys the input code gets stuck in a spinlock
- Timer. Two known working examples:
reference/arm-tutorial-rpi/part-4/armc-013
andreference/piaplus/blinker05
. My implementation from the datasheet was basically identical but didn't trigger interrupts on QEMU. Spent forever browsing source files for the two references and then finally tested them on qemu -- turns out they don't work either (tried changing their interrupt handlers to loop (and check with gdb), didn't work; svc exit qemu, didn't work). Next steps: do the LED blink and try on real rpi.
See arm-none-eabihf.json
.
Using QEMU. See .cargo/config.toml
for the command, and ./debug.sh
for the debug setup.
Resources:
The ARMv6 processor in the pi B+ is an A-profile processor. There are tons of references online to it being M-profile, but it is not. This is important because: there is no systick exception, the IVT stuff is significantly different, and so are the execution modes.
RPi boot sequence (kind of interesting).
Some guy doing MINIX on rpi 3: here.