2017-04-06 21:06:33 +02:00
|
|
|
use std::env;
|
|
|
|
|
|
|
|
fn main() {
|
2017-04-12 06:15:05 +02:00
|
|
|
let target = env::var("TARGET").unwrap();
|
|
|
|
|
2020-04-20 15:18:43 +02:00
|
|
|
if version_check::Channel::read().unwrap().is_nightly() {
|
2022-02-18 19:38:48 +01:00
|
|
|
println!("cargo:rustc-cfg=rustc_is_nightly");
|
2020-04-20 15:18:43 +02:00
|
|
|
}
|
|
|
|
|
2022-07-03 18:24:11 +02:00
|
|
|
// These targets all have know support for the BASEPRI register.
|
2019-06-29 09:11:42 +02:00
|
|
|
if target.starts_with("thumbv7m")
|
|
|
|
| target.starts_with("thumbv7em")
|
2022-07-03 18:24:11 +02:00
|
|
|
| target.starts_with("thumbv8m.main")
|
|
|
|
{
|
|
|
|
println!("cargo:rustc-cfg=have_basepri");
|
|
|
|
|
|
|
|
// These targets are all known to _not_ have the BASEPRI register.
|
|
|
|
} else if target.starts_with("thumb")
|
|
|
|
&& !(target.starts_with("thumbv6m") | target.starts_with("thumbv8m.base"))
|
2019-06-29 09:11:42 +02:00
|
|
|
{
|
2022-07-03 18:24:11 +02:00
|
|
|
panic!(
|
|
|
|
"Unknown target '{}'. Need to update BASEPRI logic in build.rs.",
|
|
|
|
target
|
|
|
|
);
|
2017-04-06 21:06:33 +02:00
|
|
|
}
|
2017-04-10 05:42:17 +02:00
|
|
|
|
|
|
|
println!("cargo:rerun-if-changed=build.rs");
|
2017-04-06 21:06:33 +02:00
|
|
|
}
|