Skip to content

Latest commit

 

History

History
46 lines (24 loc) · 1.82 KB

README.md

File metadata and controls

46 lines (24 loc) · 1.82 KB

MSB-FW.rs

Mechanical Sensor Board Firmware in Rust (experimental, not for usage on car)

Commands

First, get rustup.

Second, clone and open this root folder.

To build msb-fw-rs, just run cargo build --release. Note the first time you do this it will take a while, as rustup has to install the correct version of rust for this project.

To deploy onto an embedded chip locally connected, run cargo run --release.

To build a different project other than msb-fw-rs (of which none exist), cd into that directory and run build.

To format, run cargo format.

To lint and check stuff, run cargo clippy.

Coding tips and tricks

  • Use defmt macros to print stuff

Repository structure

This is a mega-repo configured as a normal embassy-styled project with multiple dependency crates and sub-projects.

Various files:

Top level Cargo.toml, Embed.toml, build.rs, and rust-toolchain.toml define the various parts of the embassy project. See comments inside for how these were structure, but most follow embassy specification.

The crates folder defines drivers or other code shared between projects.

Top level folders like msb-fw-rs, and any other project, define projects which inherit explicity defined Cargo.toml dependencies, build.rs and Embed.toml settings, and more. They can also depend on a crate in the crates folder.

This structure has multiple benefits, including:

  • Static versioning of all embassy and other dependencies, eliminating version conflicts for in-tree code
  • Inherited build settings so like-microcontroller projects share all of that boilerplate
  • Shared target folder meaning a shared build cache for quicker and space-saving builds
  • Other quirks, such as vscode settings.json and config.toml, are shared between projects