cargo-board

Crates.iocargo-board
lib.rscargo-board
version0.1.0
sourcesrc
created_at2017-08-25 11:33:29.752534
updated_at2017-08-25 11:33:29.752534
descriptionCargo subcommand to manage embedded boards
homepage
repositoryhttps://github.com/steffengy/cargo-board.git
max_upload_size
id28991
size5,603
Steffen Butzer (steffengy)

documentation

README

cargo-board

A cargo subcommand for managing embedded boards

Demo

The configuration for boards is specified in a boards.toml such as:

[soc]
STM32F2XXXB = { arch = "thumbv7m-none-eabi", flash = "128K", ram = "64K" }
STM32F2XXXE = { arch = "thumbv7m-none-eabi", flash = "512K", ram = "128K" }

[board]
flexperiment_mini = { soc = "STM32F2XXXB" }
netboard = { soc = "STM32F2XXXE" }

Usage

cargo board [board_name] <ARGUMENTS TO CARGO>

e.g. cargo board netboard build -p blink

What it does

  • enables the board_[board_name] feature of the compiled crate (passes --feature board_[board_name] to cargo)

  • passes --target [soc.arch] to cargo

  • sets CARGO_TARGET_DIR to target/[board_name]
    (TODO: this leads to duplication of compiled shared crates)

  • exposes LD_FLASH_SIZE and LD_RAM_SIZE as environmental variables to cargo so it can be used in build scripts
    (TODO: make this generic and not hardcoded attributes?)

  • exposes BOARD_FEATURES so we can expose the following features
    (exposed using rustc, so only available in code and not in cargo-configuration):

    • the soc_[soc_name] feature, you can check for a specific soc using #[cfg(feature="soc_[soc_name]")]

    This needs to be in your build.rs.

Commit count: 3

cargo fmt