mirror of
https://github.com/esp-rs/esp-hal.git
synced 2025-09-30 22:01:11 +00:00

* Move ROM function definitions to esp-hal-rom crate * Patch ESP32 ROM-functions, use it in esp-storage * Allow placing additional code in IRAM * esp-storage depends on esp-hal-rom * Move ROM function wrappers from esp-hal to esp-hal-rom * Make bootloader-support crate use CRC ROM function * Minor polishing * changelogs * Make CI green * Define (some) spiflash ROM functions in esp-hal-rom * Lint * Avoid duplicate definition of `__assert_func` * Rename to `esp-rom-sys` * Mention versioning this crate in the README * Fixes * Check self-version * Docs * Clippy * Check if version bump is allowed * Unconditionally place spiflash ROM function patches (if present) in rwtext * Cleanup * Change how unacceptable version bump requests are detected * Initial version 0.1.0 * Docs * Use correct version * Force esp-rom-sys bumps to patch * Fix
50 lines
1.7 KiB
Rust
50 lines
1.7 KiB
Rust
use std::{env, error::Error};
|
|
|
|
use esp_config::generate_config_from_yaml_definition;
|
|
use jiff::Timestamp;
|
|
|
|
#[macro_export]
|
|
macro_rules! assert_unique_features {
|
|
($($feature:literal),+ $(,)?) => {
|
|
assert!(
|
|
(0 $(+ cfg!(feature = $feature) as usize)+ ) <= 1,
|
|
"Exactly zero or one of the following features must be enabled: {}",
|
|
[$($feature),+].join(", ")
|
|
);
|
|
};
|
|
}
|
|
|
|
fn main() -> Result<(), Box<dyn Error>> {
|
|
println!("cargo::rustc-check-cfg=cfg(embedded_test)");
|
|
|
|
// Log and defmt are mutually exclusive features. The main technical reason is
|
|
// that allowing both would make the exact panicking behaviour a fragile
|
|
// implementation detail.
|
|
assert_unique_features!("log-04", "defmt");
|
|
|
|
let build_time = match env::var("SOURCE_DATE_EPOCH") {
|
|
Ok(val) => Timestamp::from_microsecond(val.parse::<i64>()?).unwrap(),
|
|
Err(_) => Timestamp::now(),
|
|
};
|
|
|
|
let build_time_formatted = build_time.strftime("%H:%M:%S");
|
|
let build_date_formatted = build_time.strftime("%Y-%m-%d");
|
|
|
|
println!("cargo::rustc-env=ESP_BOOTLOADER_BUILD_TIME={build_time_formatted}");
|
|
println!("cargo::rustc-env=ESP_BOOTLOADER_BUILD_DATE={build_date_formatted}");
|
|
|
|
// 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-bootloader-esp-idf");
|
|
generate_config_from_yaml_definition(&cfg_yaml, true, true, None).unwrap();
|
|
|
|
#[cfg(not(feature = "std"))]
|
|
{
|
|
// Ensure that exactly one chip has been specified:
|
|
let _chip = esp_metadata::Chip::from_cargo_feature()?;
|
|
}
|
|
|
|
Ok(())
|
|
}
|