mirror of
https://github.com/esp-rs/esp-hal.git
synced 2025-09-29 05:10:55 +00:00

* Move macros to new crate * Generate a single file * Pre-generate esp-metadata-generated * Move saving code to xtask * Format with both rustfmt and prettyplease * Fix doc build * Unhide macros * Fix doc string * Update semver-check baseline
28 lines
927 B
Rust
28 lines
927 B
Rust
use esp_config::generate_config_from_yaml_definition;
|
|
|
|
#[macro_export]
|
|
macro_rules! assert_unique_used_features {
|
|
($($feature:literal),+ $(,)?) => {
|
|
assert!(
|
|
(0 $(+ cfg!(feature = $feature) as usize)+ ) == 1,
|
|
"Exactly one of the following features must be enabled: {}",
|
|
[$($feature),+].join(", ")
|
|
);
|
|
};
|
|
}
|
|
|
|
fn main() {
|
|
// Ensure that exactly a backend is selected:
|
|
assert_unique_used_features!("defmt", "println");
|
|
|
|
if cfg!(feature = "custom-halt") && cfg!(feature = "halt-cores") {
|
|
panic!("Only one of `custom-halt` and `halt-cores` can be enabled");
|
|
}
|
|
|
|
// emit config
|
|
println!("cargo:rerun-if-changed=./esp_config.yml");
|
|
let cfg_yaml = std::fs::read_to_string("./esp_config.yml")
|
|
.expect("Failed to read esp_config.yml for esp-backtrace");
|
|
generate_config_from_yaml_definition(&cfg_yaml, true, true, None).unwrap();
|
|
}
|