From 2f5af89547ce450c15891f39f1a282b5a83ac6a3 Mon Sep 17 00:00:00 2001 From: bunnie Date: Sat, 4 Oct 2025 18:52:30 +0800 Subject: [PATCH] make the swap header length explicitly controlled previously it was just "4096" in the image writer --- libs/bao1x-api/src/offsets/baosec.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libs/bao1x-api/src/offsets/baosec.rs b/libs/bao1x-api/src/offsets/baosec.rs index af6787183..f2d556b8c 100644 --- a/libs/bao1x-api/src/offsets/baosec.rs +++ b/libs/bao1x-api/src/offsets/baosec.rs @@ -1,3 +1,5 @@ +use xous::arch::PAGE_SIZE; + // we actually have 16MiB on the initial prototypes, but constraining to smaller for cost reduction pub const SPI_FLASH_LEN: usize = 8192 * 1024; pub const SPI_FLASH_ID_MASK: u32 = 0xff_ff_ff; @@ -19,9 +21,12 @@ pub const SWAP_RAM_ID_MASK: u32 = 0xff_ff; // KGD 5D, mfg ID 9D; remainder of bits are part of the EID pub const SWAP_RAM_IDS: [u32; 2] = [0x5d9d, 0x559d]; -// "Partition table" of external SPI FLASH +// Location of things in external SPIM flash pub const SWAP_FLASH_ORIGIN: usize = 0x0000_0000; +// maximum length of a swap image pub const SWAP_FLASH_RESERVED_LEN: usize = 4096 * 1024; +// Total area reserved for the swap header, including the signature block. +pub const SWAP_HEADER_LEN: usize = PAGE_SIZE; // PDDB takes up "the rest of the space" - about 4MiB envisioned. Should be // "enough" for storing a few hundred, passwords, dozens of x.509 certs, dozens of private keys, etc.