Crate arm_targets

Crate arm_targets 

Source
Expand description

Useful cfg helpers for when you are building Arm code

Hopefully Rust will stabilise these kinds of target features in the future, and this won’t be required. But until this, arm-targets is here to help you conditionally compile your code based on the specific Arm platform you are compiling for.

In your application, do something like this:

$ cargo add --build arm-targets
$ cat > build.rs << EOF
fn main() {
    arm_targets::process();
}
EOF

This will then let you write application code like:

#[cfg(arm_architecture = "armv7m")]
fn only_for_cortex_m3() { }

#[cfg(arm_isa = "a32")]
fn can_use_arm_32bit_asm_here() { }

Without this crate, you are limited to cfg(target_arch = "arm"), which isn’t all that useful given how many ‘Arm’ targets there are.

To see a full list of the features created by this crate, run the CLI tool:

$ cargo install arm-targets
$ arm-targets
cargo:rustc-check-cfg=cfg(arm_isa, values("a64", "a32", "t32"))
cargo:rustc-check-cfg=cfg(arm_architecture, values("v4t", "v5te", "v6-m", "v7-m", "v7e-m", "v8-m.base", "v8-m.main", "v7-r", "v8-r", "v7-a", "v8-a"))
cargo:rustc-check-cfg=cfg(arm_profile, values("a", "r", "m", "legacy"))
cargo:rustc-check-cfg=cfg(arm_abi, values("eabi", "eabihf"))

Structs§

TargetInfo

Enums§

Abi
The ABI
Arch
The Arm Architecture
Isa
The Arm Instruction Set
Profile
The Arm Architecture Profile.

Functions§

process
Process the ${TARGET} environment variable, and emit cargo configuration to standard out.
process_target
Process a given target string, and emit cargo configuration to standard out.