mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-27 14:04:56 +01:00
24 lines
879 B
Rust
24 lines
879 B
Rust
use std::env;
|
|
|
|
fn main() {
|
|
let target = env::var("TARGET").unwrap();
|
|
|
|
// These targets all have know support for the BASEPRI register.
|
|
if target.starts_with("thumbv7m")
|
|
| target.starts_with("thumbv7em")
|
|
| target.starts_with("thumbv8m.main")
|
|
{
|
|
println!("cargo:rustc-cfg=cortex_m_basepri");
|
|
} else if target.starts_with("thumbv6m") | target.starts_with("thumbv8m.base") {
|
|
println!("cargo:rustc-cfg=cortex_m_source_masking");
|
|
} else if target.starts_with("riscv32i") {
|
|
panic!("No RISC-V support yet.");
|
|
|
|
// TODO: Add feature here for risc-v targets
|
|
// println!("cargo:rustc-cfg=riscv");
|
|
} else if target.starts_with("thumb") || target.starts_with("riscv32") {
|
|
panic!("Unknown target '{target}'. Need to update logic in build.rs.");
|
|
}
|
|
|
|
println!("cargo:rerun-if-changed=build.rs");
|
|
}
|