A collection of STM32 embedded Rust examples covering GPIO, ADC, DMA, I2C, SPI, UART, PWM, and more. Each subdirectory is an independent example that can be built and flashed; this repository is intended for learning, demos, and quick prototyping of STM32 peripherals.
- Overview
- Quick Start
- Build & Flash (Common Commands)
- Selected Subprojects
Note: Each subproject usually includes its own
README.md,Cargo.toml, andmemory.x. Please check the subproject README for example-specific instructions.
- Install Rust (stable or the toolchain required by a specific example):
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- Add a target triple (example):
rustup target add thumbv7m-none-eabi # or thumbv6m-none-eabi depending on the MCU - Useful tools (optional):
probe-run:cargo install probe-runcargo-embed:cargo install cargo-embedopenocd/st-flash: install via your package manager
- Build:
cd <example-dir> cargo build --release
- Run with
probe-run:cargo run --release
- Flash and debug with
cargo-embed:cargo embed --release
Note: Commands may vary depending on the example's
Cargo.tomlrunner configuration and the target MCU; consult the subproject README.
01_led_blink— LED blink example (quick start)adc_mul,adc_sig— ADC examplespwm_servo,pwm-led— PWM examplesiic_oled,iic_mpu_*— I2C peripheral examplesspi_w25_*— SPI NOR flash examplesusart*— UART related examples (See the repository folders for more examples)