Documentation / Platform / Firmware build

Firmware build

Compile and run the Rust firmware on opentag one V2 with the repository-pinned Embassy tree.

Use the project checkout.

The application depends on the Embassy submodule through local paths. Initialize submodules in your existing project checkout before building.

Toolchain

cd firmware/rust_bringup/stm32g4
rustup target add thumbv7em-none-eabi
cargo install probe-rs-tools --locked

Firmware targets

BinaryPurposeInterface
twr_init40 Hz two-way-ranging initiatorDWM3000 + USB CDC
twr_respRanging responder, calibration, distance streamDWM3000 + USB CDC
can_txClassical CAN request / echo testFDCAN2 at 500 kbit/s
can_rxClassical CAN echo peerFDCAN2 at 500 kbit/s
can_fd_tx64-byte CAN FD load generator1 Mbit/s nominal, 2 Mbit/s data
can_fd_rxCAN FD sequence, loss, and throughput receiver1 Mbit/s nominal, 2 Mbit/s data

Build without hardware

cargo check --release --bin twr_init
cargo check --release --bin twr_resp
cargo check --release --bin can_tx --bin can_rx
cargo check --release --bin can_fd_tx --bin can_fd_rx

Flash and attach RTT

Connect a compatible SWD probe to the 10-pin Cortex Debug header. The package runner is already configured for STM32G474CC.

DEFMT_LOG=info cargo run --release --bin can_tx

probe-rs erases and programs the image, resets the target, and displays defmt RTT output. For release role images and no local toolchain, use the browser DFU console.

Clocking assumptions

The current V2 examples configure the 8 MHz HSE through PLL1 for a 170 MHz system clock. CAN FD explicitly routes FDCAN from PCLK1; timing constants on every bus node must match.