arm-targets 0.4.0

Compile-time feature detection for Arm processors
Documentation
  • Coverage
  • 97.62%
    41 out of 42 items documented1 out of 21 items with examples
  • Size
  • Source code size: 20.43 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.87 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 12s Average build duration of successful builds.
  • all releases: 11s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • rust-embedded/aarch32
    52 18 7
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • adamgreig jonathanpallant github:rust-embedded:arm

Compile-time Support for Arm Targets

This crate looks at your build target (using the $TARGET environment variable that cargo sets) and provides a selection of --cfg values to rustc that might be useful.

Add to your build dependencies and make a build.rs file like this:

fn main() {
    arm_targets::process();
}

Cargo will be given configuration like this:

cargo:rustc-cfg=arm_architecture="v7-r"
cargo:rustc-check-cfg=cfg(arm_architecture, values("v6-m", "v7-m", "v7e-m", "v8-m.base", "v8-m.main", "v7-r", "v8-r", "v7-a", "v8-a"))
cargo:rustc-cfg=arm_isa="A32"
cargo:rustc-check-cfg=cfg(arm_isa, values("A64", "A32", "T32"))

This allows you to write Rust code in your firmware like:

#[cfg(any(arm_architecture = "v7-r", arm_architecture = "v8-r"))]

Minimum Supported Rust Version (MSRV)

This crate is guaranteed to compile on stable Rust 1.59.0 and up, as recorded by the package.rust-version property in Cargo.toml.

Increasing the MSRV is not considered a breaking change and may occur in a minor version release (e.g. from 0.3.0 to 0.3.1, because this is still a 0.x release).

Licence

  • Copyright (c) Ferrous Systems
  • Copyright (c) The Rust Embedded Devices Working Group developers

Licensed under either MIT or Apache-2.0 at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be licensed as above, without any additional terms or conditions.