diff --git a/libs/bao1x-hal/Cargo.toml b/libs/bao1x-hal/Cargo.toml index ca866d5b6..1966c374c 100644 --- a/libs/bao1x-hal/Cargo.toml +++ b/libs/bao1x-hal/Cargo.toml @@ -39,6 +39,7 @@ ed25519-dalek = { package = "ed25519-dalek-bao1x", path = "../../bao1x-boot/ed25 "zeroize", ], optional = true } sha2-bao1x = { path = "../../bao1x-boot/sha2-bao1x", optional = true, default-features = false } +linked_list_allocator = { version = "0.10.5", optional = true } # [target.'cfg(target_os = "xous")'.dependencies] xous = { version = "0.9.66", features = ["v2p"] } @@ -54,7 +55,7 @@ camera-gc2145 = [] display-sh1107 = [] axp2101 = [] bmp180 = [] -sigcheck = ["ed25519-dalek", "sha2-bao1x", "digest"] +sigcheck = ["ed25519-dalek", "sha2-bao1x", "digest", "linked_list_allocator"] board-baosec = [ "std", "camera-gc2145", diff --git a/libs/bao1x-hal/src/board/baosec.rs b/libs/bao1x-hal/src/board/baosec.rs index 0c38342cc..8ca757a3c 100644 --- a/libs/bao1x-hal/src/board/baosec.rs +++ b/libs/bao1x-hal/src/board/baosec.rs @@ -1,7 +1,7 @@ // Constants that define pin locations, RAM offsets, etc. for the BaoSec board use bao1x_api::*; -pub const DEFAULT_FCLK_FREQUENCY: u32 = 800_000_000; +pub const DEFAULT_FCLK_FREQUENCY: u32 = bao1x_api::offsets::baosec::DEFAULT_FCLK_FREQUENCY; pub const I2C_AXP2101_ADR: u8 = 0x34; pub const I2C_TUSB320_ADR: u8 = 0x47; diff --git a/libs/bao1x-hal/src/board/dabao.rs b/libs/bao1x-hal/src/board/dabao.rs index d3f35cb5b..d7c5895d9 100644 --- a/libs/bao1x-hal/src/board/dabao.rs +++ b/libs/bao1x-hal/src/board/dabao.rs @@ -2,8 +2,7 @@ use bao1x_api::*; -/// Run at 400MHz to ensure we can boot even without an external VDD85 regulator! -pub const DEFAULT_FCLK_FREQUENCY: u32 = 400_000_000; +pub const DEFAULT_FCLK_FREQUENCY: u32 = bao1x_api::offsets::dabao::DEFAULT_FCLK_FREQUENCY; // console uart buffer - needs to be fixed here because it matches dabao. Keeps the code base // simple between the two variants for shared paths in the bootloader. @@ -30,7 +29,7 @@ pub const IFRAM0_RESERVED_PAGE_RANGE: [usize; 2] = [31 - 4, 31]; pub const IFRAM1_RESERVED_PAGE_RANGE: [usize; 2] = [31 - 0, 31]; const SE0_PIN: u8 = 13; -const SE0_PORT: IoxPort::PC; +const SE0_PORT: IoxPort = IoxPort::PC; /// Sets the SE0 pin to drive and returns the port number. Note this side-effects the boot switch reading. pub fn setup_usb_pins(iox: &T) -> (IoxPort, u8) { iox.setup_pin( @@ -117,3 +116,12 @@ pub const SPINOR_PAGE_LEN: u32 = 0x100; pub const SPINOR_ERASE_SIZE: u32 = 0x1000; // this is the smallest sector size. pub const SPINOR_BULK_ERASE_SIZE: u32 = 0x1_0000; // this is the bulk erase size. pub const SPINOR_LEN: u32 = 16384 * 1024; + +// 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/bao1x-hal/src/sigcheck.rs b/libs/bao1x-hal/src/sigcheck.rs index cc4cea30d..0bf3fc9ba 100644 --- a/libs/bao1x-hal/src/sigcheck.rs +++ b/libs/bao1x-hal/src/sigcheck.rs @@ -43,7 +43,6 @@ pub fn validate_image( auto_jump: bool, mut spim: Option<&mut Spim>, ) -> Result { - crate::println!("validate_image"); // Copy the signature into a structure so we can unpack it. let mut sig = SignatureInFlash::default(); if let Some(ref mut spim) = spim { @@ -90,7 +89,6 @@ pub fn validate_image( crate::println!("Key at index {} is revoked ({}), skipping", i, revocation_value); continue; } - let verifying_key = ed25519_dalek::VerifyingKey::from_bytes(key).or(Err(String::from("invalid public key")))?;