mirror of
https://github.com/esp-rs/esp-hal.git
synced 2025-09-28 04:40:52 +00:00

* Extract value and validator modules * Clean up * Replace tuples with ConfigOption * Move generate.rs * Further refactor write_doc_table_line * Carry around the config option, too * Move markdown table processing out of random places * Compare prettified json, use pretty_assertions to diff it * Work with Vec * Emit enumerated cfgs in one place
42 lines
1.9 KiB
Rust
42 lines
1.9 KiB
Rust
use std::env;
|
|
|
|
use chrono::{TimeZone, Utc};
|
|
use esp_config::{generate_config, ConfigOption, Validator, Value};
|
|
|
|
fn main() {
|
|
let build_time = match env::var("SOURCE_DATE_EPOCH") {
|
|
Ok(val) => Utc.timestamp_opt(val.parse::<i64>().unwrap(), 0).unwrap(),
|
|
Err(_) => Utc::now(),
|
|
};
|
|
|
|
let build_time_formatted = build_time.format("%H:%M:%S").to_string();
|
|
let build_date_formatted = build_time.format("%Y-%m-%d").to_string();
|
|
|
|
println!("cargo::rustc-env=ESP_BOOTLOADER_BUILD_TIME={build_time_formatted}");
|
|
println!("cargo::rustc-env=ESP_BOOTLOADER_BUILD_DATE={build_date_formatted}");
|
|
|
|
// emit config
|
|
generate_config("esp-bootloader-esp-idf", &[
|
|
ConfigOption {
|
|
name: "mmu_page_size",
|
|
description: "ESP32-C2, ESP32-C6 and ESP32-H2 support configurable page sizes. This is currently only used to populate the app descriptor.",
|
|
default_value: Value::String(String::from("64k")),
|
|
constraint: Some(Validator::Enumeration(
|
|
vec![String::from("8k"), String::from("16k"),String::from("32k"),String::from("64k"),]
|
|
))
|
|
},
|
|
ConfigOption {
|
|
name: "esp_idf_version",
|
|
description: "ESP-IDF version used in the application descriptor. Currently it's not checked by the bootloader.",
|
|
default_value: Value::String(String::from("0.0.0")),
|
|
constraint: None,
|
|
},
|
|
ConfigOption {
|
|
name: "partition-table-offset",
|
|
description: "The address of partition table (by default 0x8000). Allows you to move the partition table, it gives more space for the bootloader. Note that the bootloader and app will both need to be compiled with the same PARTITION_TABLE_OFFSET value.",
|
|
default_value: Value::Integer(0x8000),
|
|
constraint: Some(Validator::PositiveInteger),
|
|
}
|
|
], true);
|
|
}
|