From 0bd4de961a96c9dcd72b02d7692453509fa864f1 Mon Sep 17 00:00:00 2001 From: bunnie Date: Thu, 16 Oct 2025 23:25:44 +0800 Subject: [PATCH] I think I won't regret putting a semver into the boot0 stage too Even though boot0 DUART output may be inaccessible, the string could still be found by looking in the binary and searching for it. --- .gitignore | 1 + bao1x-boot/boot0/src/main.rs | 3 ++- xtask/src/versioning.rs | 13 +++++++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 90f349a16..fc7e53abb 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ target /emulation/obj # auto-generated services/xous-ticktimer/src/version.rs +bao1x-boot/boot0/src/version.rs bao1x-boot/boot1/src/version.rs apps/i18n.json services/gam/src/apps.rs diff --git a/bao1x-boot/boot0/src/main.rs b/bao1x-boot/boot0/src/main.rs index bb49c0f74..ba87f2535 100644 --- a/bao1x-boot/boot0/src/main.rs +++ b/bao1x-boot/boot0/src/main.rs @@ -8,6 +8,7 @@ mod asm; mod platform; #[cfg(feature = "unsafe-dev")] mod repl; +mod version; #[cfg(feature = "unsafe-dev")] use alloc::collections::VecDeque; #[cfg(feature = "unsafe-dev")] @@ -51,7 +52,7 @@ pub fn uart_irq_handler() { #[export_name = "rust_entry"] pub unsafe extern "C" fn rust_entry() -> ! { crate::platform::early_init(); - crate::println!("\n~~boot0 up!~~\n"); + crate::println!("\n~~boot0 up! ({})~~\n", crate::version::SEMVER); #[cfg(feature = "unsafe-dev")] let mut repl = crate::repl::Repl::new(); diff --git a/xtask/src/versioning.rs b/xtask/src/versioning.rs index aa4119e16..0dbabf342 100644 --- a/xtask/src/versioning.rs +++ b/xtask/src/versioning.rs @@ -18,7 +18,8 @@ pub(crate) fn generate_version(add_timestamp: bool) { let semver = String::from_utf8_lossy(&gitver); let version_file = "services/xous-ticktimer/src/version.rs"; - let boot_version_file = "bao1x-boot/boot1/src/version.rs"; + let boot0_version_file = "bao1x-boot/boot0/src/version.rs"; + let boot1_version_file = "bao1x-boot/boot1/src/version.rs"; // Read the existing file to see if it needs to be updated. let mut existing_data = Vec::new(); @@ -63,7 +64,15 @@ pub(crate) fn generate_version(add_timestamp: bool) { .write(true) .create(true) .truncate(true) - .open(boot_version_file) + .open(boot0_version_file) + .expect("Can't open our version file for writing"); + vfile.write_all(&semver_code).expect("couldn't write semver to version.rs"); + let mut vfile = OpenOptions::new() + .read(true) + .write(true) + .create(true) + .truncate(true) + .open(boot1_version_file) .expect("Can't open our version file for writing"); vfile.write_all(&semver_code).expect("couldn't write semver to version.rs"); }