Minimal embedded Rust for BBC micro:bit v2 (nRF52833, ARM Cortex-M4F).
Hobby project to learn low-level programming (no_std, bare-metal, interrupts, peripherals).
- Switches between programs using buttons A/B
- LED matrix animations and patterns
- Temperature sensor display
- Speaker/sound output
- micro:bit v2 schematic - Official micro:bit v2 hardware schematic
- microbit-dal - Lancaster University BBC micro:bit runtime
- MicroPython microbit-v2 - Official micro:bit v2 MicroPython implementation
Schematics and hardware specs are available in docs/:
cpu-specs.pdf- nRF52833 CPU specificationshardware.pdf- Hardware overviewschematics.pdf- Circuit schematicsspeaker-specs.pdf- Speaker specifications
rustup target add thumbv7em-none-eabihfcargo install probe-run(orcargo-embed)- Hardware: BBC micro:bit v2
cargo build # Debug build
cargo build --release # Optimized build
cargo embed # Flash debug
cargo embed --release # Flash release
cargo clippy # Lintingsrc/
├── main.rs # Entry point, panic handler
├── system.rs # Hardware init
├── app/ # Application state, program runner
├── drivers/ # Hardware drivers (display, audio, buttons, temp)
│ ├── display/ # LED matrix display
│ └── audio/ # Speaker/sound
├── peripherals/ # Low-level HW access (GPIO, PWM, RTC, temp)
├── programs/ # User programs (switchable via buttons A/B)
│ ├── empty_program.rs
│ ├── startup_program.rs
│ ├── love_program.rs
│ ├── temperature_program.rs
│ ├── x_program.rs
│ └── audio_program.rs
└── interrupt.rs # Interrupt handling
- Create
src/programs/my_program.rsimplementingProgramtrait - Add module and instance in
src/programs/mod.rs - Add to
get_programs()array
- Use
CancellationTokento gracefully stop programs - Use
wfi()to sleep until interrupt - Hardware singleton accessed via
app.hardware - Buttons A/B cycle through programs
- No dynamic allocation (no
Vec,Box, etc.) - No standard library
- Interrupts must be short/fast
- Stack size is limited