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();
|
|
|
|
|
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")
|
|
|
|
{
|
2023-03-04 02:26:34 +01:00
|
|
|
println!("cargo:rustc-cfg=feature=\"cortex-m-basepri\"");
|
2023-02-19 14:30:49 +01:00
|
|
|
} else if target.starts_with("thumbv6m") | target.starts_with("thumbv8m.base") {
|
2023-03-04 02:26:34 +01:00
|
|
|
println!("cargo:rustc-cfg=feature=\"cortex-m-source-masking\"");
|
2023-09-27 21:39:35 +02:00
|
|
|
//this should not be this general
|
|
|
|
//riscv processors differ in interrupt implementation
|
|
|
|
//even within the same target
|
|
|
|
//need some other way to discern
|
2023-02-19 14:30:49 +01:00
|
|
|
} else if target.starts_with("riscv32i") {
|
2023-09-27 21:39:35 +02:00
|
|
|
println!("cargo:rustc-cfg=feature=\"riscv-esp32c3\"");
|
2022-07-03 18:24:11 +02:00
|
|
|
|
2023-02-19 14:30:49 +01:00
|
|
|
// TODO: Add feature here for risc-v targets
|
2023-03-04 02:26:34 +01:00
|
|
|
// println!("cargo:rustc-cfg=feature=\"riscv\"");
|
2023-02-19 14:30:49 +01:00
|
|
|
} else if target.starts_with("thumb") || target.starts_with("riscv32") {
|
|
|
|
panic!("Unknown target '{target}'. Need to update logic in build.rs.");
|
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
|
|
|
}
|