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.
This commit is contained in:
bunnie 2025-10-16 23:25:44 +08:00
parent 254780b382
commit 0bd4de961a
3 changed files with 14 additions and 3 deletions

1
.gitignore vendored
View file

@ -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

View file

@ -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();

View file

@ -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");
}