olFi95 / rust-stm32-playground

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rust-stm32-playground

Warning
STMF446RE

This project is configured for the STMF446RE. If you are using another MCU and board please review all parameters and configure properly.

Ecosystem

embedded rust eco
Figure 1. Embedded Rust ecosystem for STM32 [4]

System packages and preparation

pkg-conf

Install pkg-conf sudo apt install pkg-config

udev

  1. Install libudev sudo apt install libudev-dev.

  2. Download the file 69-probe-rs.rules and place it in /etc/udev/rules.d.

  3. Run sudo udevadm control --reload to ensure the new rules are used.

  4. Run sudo udevadm trigger to ensure the new rules are applied to already added devices.

Toolchain

Install rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Install Rust toolchain and ARM target.
rustup update
rustup target add thumbv7em-none-eabihf

Some additional tools:

  1. cargo-flash - This crate provides a cargo subcommand to flash ELF binaries onto ARM chips.

  2. cargo-embed - Provides a cargo subcommand to work with embedded targets.

  3. cargo-binutils - Cargo subcommands to invoke the LLVM tools shipped with the Rust toolchain.

Install some additional useful tools.
cargo install cargo-flash cargo-embed cargo-binutils

Flash

Flash binary to target.
cargo flash --chip stm32f446re --release

Debug

  1. Create a Run/Debug configuration in CLion.

    clion configure remote debug
  2. Build and flash the binary (debug build) to target and open RTT and GDB.

    cargo embed --chip stm32f446re
  3. Start the configured debugging session in CLion by pressing the little 'bug' button.

    clion run remote debug

About


Languages

Language:Rust 100.0%