FREE Reverse Engineering Self-Study Course HERE
Embedded Rust w/ Embassy blink driver.
-
STM32 Nucleo-F303RE Development Board
- Development board based on the STM32F303RET6 microcontroller (ARM Cortex-M4F @ 72MHz).
- Features: Onboard ST-LINK/V2-1 debugger, Arduino Uno V3 connectivity, 512KB Flash, 64KB RAM.
- Ideal for embedded Rust development, async/await experimentation, and Embassy ecosystem learning.
-
USB Mini-B Cable
- For powering the board and programming via ST-LINK.
# Connect your STM32 Nucleo board via USB
# Run the installation script to set up dependencies
./install.sh
# Build and flash
cargo run --releaseThat's it! The firmware will build and flash automatically.
- GPIO Control: Async LED blink on PA5 (green LED LD2)
- UART Output: Status messages via USART2 (ST-Link VCP at 115200 baud)
- Embassy Async Runtime: Clean async/await implementation for STM32F303RE
- LED (LD2): PA5 (GPIO output)
- UART TX: PA2 (USART2, connected to ST-Link VCP)
- User Button: PC13 (not used in this example)
This project uses Embassy from crates.io with STM32F303RE support.
# Install the ARM Cortex-M4F target (already done if you followed setup)
rustup target add thumbv7em-none-eabihf
# Build
cargo build --releaseThe easiest method using the integrated ST-LINK debugger:
# Install probe-run if not already installed
cargo install probe-run
# Build and flash
cargo run --releaseThe .cargo/config.toml is configured to use probe-run as the runner.
For interactive debugging:
# Install probe-rs
cargo install probe-rs-tools --locked
# Build
cargo build --target thumbv7em-none-eabihf
# Start debug session
probe-rs debug --chip STM32F303RE --exe target/thumbv7em-none-eabihf/debug/stm32f303re-blinkIf you have VS Code with the Cortex-Debug extension:
# Install OpenOCD
brew install openocd
# Install ARM GDB
brew tap ArmMbed/homebrew-formulae
brew install arm-none-eabi-gcc
# Press F5 in VS Code to build and debugThe project includes .vscode/launch.json configured for OpenOCD debugging.
Using ST-Link utilities directly:
# Install stlink tools
brew install stlink
# Build
cargo build --release --target thumbv7em-none-eabihf
# Convert to binary
cargo objcopy --release --target thumbv7em-none-eabihf -- -O binary target/thumbv7em-none-eabihf/release/stm32f303re-blink firmware.bin
# Flash
st-flash write firmware.bin 0x8000000The Cargo.toml uses published Embassy crates from crates.io:
embassy-stm32 = "0.4.0"embassy-executor = "0.9.1"embassy-time = "0.5.0"
- Async/Await: LED blink runs asynchronously using Embassy timers
- Type Safety: Rust's type system prevents many common embedded bugs
- No Blocking Loops: Uses
embassy_time::Timerfor clean delay handling - UART Logging: Real-time status messages via ST-Link VCP
Connect to the virtual COM port to see status messages:
# macOS
screen /dev/tty.usbmodem* 115200
# Linux
screen /dev/ttyACM0 115200Output example:
LED ON
LED OFF
LED ON
LED OFF
cargo doc --no-deps --document-private-items --open- FLASH: 512KB starting at 0x08000000
- RAM: 64KB starting at 0x20000000
Defined in memory.x for the STM32F303RET6.
