DIY Electronics
— Building circuits, programming microcontrollers, and making things blinkTimer interrupts on Arduino — why delay() is often wrong
E2E Rust Embedded Hello World
Getting an LED to blink in Rust on a bare microcontroller was harder than it should be but taught me the whole toolchain. Here's the minimal path that works.
Platform: STM32F103 Blue Pill ($3), STLink V2 clone ($5). Dependencies in Cargo.toml: cortex-m, cortex-m-rt, stm32f1xx-hal, panic-halt, cortex-m-semihosting. Target: thumbv7m-none-eabi. Memory linker script: the hal crate provides it via memory.x in build.rs.
The blinky main: initialize clocks to 72MHz, configure PC13 (the onboard LED) as push-pull output, toggle in a loop with a delay. The delay function uses the SysTick peripheral through cortex-m. First flash: cargo build --release then probe-rs download --chip STM32F103C8 target/thumbv7m-none-eabi/release/blinky. Seeing the LED blink after writing Rust that compiles to raw ARM instructions is satisfying.