From f27c78c9183613efc69f8efff342362d8f152f4e Mon Sep 17 00:00:00 2001 From: bunnie Date: Sun, 11 May 2025 12:34:48 +0800 Subject: [PATCH] add BOOKEND constants to the hal layer; add MMAP_VIRT range BOOKEND test sentinels are moved out of xous-rs, and into the board definitions allowing us more flexibility on configuration board-specific test configs (before it was a xous-wide constant, which seems a bad idea because it makes migrating test infra hard as the manufacturing infra updates) MMAP_VIRT as a range is also added is this commit --- libs/cramium-hal/Cargo.toml | 2 ++ libs/cramium-hal/src/board/baosec.rs | 13 +++++++++++++ libs/cramium-hal/src/board/hosted.rs | 9 +++++++++ 3 files changed, 24 insertions(+) diff --git a/libs/cramium-hal/Cargo.toml b/libs/cramium-hal/Cargo.toml index 8096d9fcf..cddf084ec 100644 --- a/libs/cramium-hal/Cargo.toml +++ b/libs/cramium-hal/Cargo.toml @@ -47,6 +47,8 @@ loader-baosec = [ "ux-api/loader-baosec", ] kernel-baosec = [] +kernel-baosor = [] +kernel-dabao = [] test-baosec = ["ux-api/loader-baosec", "camera-gc2145"] hosted-baosec = [] # emulated hardware on x86 platform board-baosor = [ diff --git a/libs/cramium-hal/src/board/baosec.rs b/libs/cramium-hal/src/board/baosec.rs index 438dc719c..73ea4563e 100644 --- a/libs/cramium-hal/src/board/baosec.rs +++ b/libs/cramium-hal/src/board/baosec.rs @@ -12,7 +12,11 @@ pub const SPINOR_BULK_ERASE_SIZE: u32 = 0x1_0000; // this is the bulk erase size pub const SPINOR_LEN: u32 = 16384 * 1024; pub const PDDB_LOC: u32 = 4096 * 1024; // located 4MiB in, after the swap image pub const PDDB_LEN: u32 = 4096 * 1024; // 4MiB data for the PDDB total + +// Define the virtual region that memory-mapped FLASH should go to // top 8 megs are reserved for staging updates, backups, etc. +pub const MMAP_VIRT_LEN: usize = SPINOR_LEN as usize; +pub const MMAP_VIRT_END: usize = xous::arch::MMAP_VIRT_BASE + SPINOR_LEN as usize; // console uart buffer pub const UART_DMA_TX_BUF_PHYS: usize = utralib::HW_IFRAM0_MEM + utralib::HW_IFRAM0_MEM_LEN - 4096; @@ -287,3 +291,12 @@ pub fn setup_kb_pins(iox: &T) -> ([(IoxPort, u8); 3], [(Iox pub fn setup_pmic_irq(iox: &T, server: &str, opcode: usize) { iox.set_irq_pin(IoxPort::PB, 13, IoxValue::Low, server, opcode); } + +// sentinel used by test infrastructure to assist with parsing +// The format of any test infrastructure output to recover is as follows: +// _|TT|_,,_|TE|_ +// where _|TT|_ and _|TE|_ are bookends around the data to be reported +// is a single-word identifier that routes the data to a given parser +// is free-form data, which will be split at comma boundaries by the parser +pub const BOOKEND_START: &str = "_|TT|_"; +pub const BOOKEND_END: &str = "_|TE|_"; diff --git a/libs/cramium-hal/src/board/hosted.rs b/libs/cramium-hal/src/board/hosted.rs index ac3aed50e..8eb2398bb 100644 --- a/libs/cramium-hal/src/board/hosted.rs +++ b/libs/cramium-hal/src/board/hosted.rs @@ -4,3 +4,12 @@ pub const SPINOR_BULK_ERASE_SIZE: u32 = 0x1_0000; // this is the bulk erase size pub const SPINOR_LEN: u32 = 16384 * 1024; pub const PDDB_LOC: u32 = 0; pub const PDDB_LEN: u32 = 4096 * 1024; // 4MiB data for the PDDB total + +// sentinel used by test infrastructure to assist with parsing +// The format of any test infrastructure output to recover is as follows: +// _|TT|_,,_|TE|_ +// where _|TT|_ and _|TE|_ are bookends around the data to be reported +// is a single-word identifier that routes the data to a given parser +// is free-form data, which will be split at comma boundaries by the parser +pub const BOOKEND_START: &str = "_|TT|_"; +pub const BOOKEND_END: &str = "_|TE|_";