This is where we store our embedded software for each board we develop.
- Ubuntu:
sudo apt update && sudo apt install -y build-essential cmake protobuf-compiler libusb-1.0-0 - macOS (Homebrew):
brew install cmake protobuf - Windows: use WSL2 (Ubuntu) or install the above equivalents; USB access works best via WSL2.
- Install Rustup:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh - Toolchain config is pinned in
rust-toolchain.toml - Verify:
rustc --version,rustup target list --installed
- Install
cargo-make(used by CI/tasks):cargo install cargo-make - Install
rustfmtused for linting:rustup component add rustfmt - Install
cargo-sortused for cleaning upCargo.tomlfiles.cargo install cargo-sort
- Install probe-rs tools:
cargo install probe-rs-tools - On linux you need to setup udev rules (no sudo needed for USB):
-
curl -L https://probe.rs/files/udev/60-probe-rs.rules | sudo tee /etc/udev/rules.d/60-probe-rs.rules. This link might not be maintained always. Might need to google how to setup the usb device rules withprobe-rs.sudo udevadm control --reload-rules && sudo udevadm trigger
- With a JLINK probe connected to your USB, verify that is visible:
probe-rs list
Cargo runner is already configured to use probe-rs with the correct chip. You can simply run cargo run --bin {board} and it will build and flash to the chip.
- To run tests on the embedded device
cargo make test-embedded - To run tests that can be run on your host machine
cargo make test-host
probe-rs.probe-rs-debuggerrust-lang.rust-analyzer
Shows you the memory size breakdown of a compiled Rust binary: rustup component add llvm-tools-preview
To run against your build cargo size --bin {board}
To see if use of a generic causing monomorphization bloat. We can use cargo bloat. cargo install cargo-bloat cargo-binutils rustfilt
cargo bloat --release -n 200 --demangle
- Rust-analyzer is complaining about my target triple being my host PC's target instead of embedded when looking at embedded code.
embassy_executor::main: proc macro server error: Cannot create expander for ./target/debug/deps/libembassy_executor_macros-dfe0a64b5f1613f4.dylib:
mismatched ABI expected: `rustc 1.89.0 (29483883e 2025-08-04)`, got `rustc 1.91.0-nightly (7aef4bec4 2025-09-01)
This is common because rust-analyzer picks up what target to use based on the vscode's working directory's .cargo/Config.toml build target. If you install the "Rust Target" extension you can dynamically jump around targets. Or alternatively open the folder for the board as your vscode's working directory instead of the entire monorepo and rust-analyzer will pick up the .cargo/Config.toml of the board's folder. We're using the thumbv7em-none-eabihf target triple.