diff --git a/bao1x-boot/boot1/Cargo.toml b/bao1x-boot/boot1/Cargo.toml index 546dcde29..4395d11ee 100644 --- a/bao1x-boot/boot1/Cargo.toml +++ b/bao1x-boot/boot1/Cargo.toml @@ -45,7 +45,6 @@ print-ifr = [] test-boot0-keys = [] alt-boot1 = [] -force-dabao = [] verilator-only = [] default = [] diff --git a/bao1x-boot/boot1/src/main.rs b/bao1x-boot/boot1/src/main.rs index dac9958d1..13398cc61 100644 --- a/bao1x-boot/boot1/src/main.rs +++ b/bao1x-boot/boot1/src/main.rs @@ -32,7 +32,7 @@ use crate::secboot::try_boot; // Notes: // - "Towards" - not a release yet, but working towards the stated milestone // - Eliminating "Towards" is done at the tag-out point. -const RELEASE_DESCRIPTION: &'static str = "Alpha-1"; +const RELEASE_DESCRIPTION: &'static str = "Towards Beta-0"; static UART_RX: Mutex>> = Mutex::new(RefCell::new(VecDeque::new())); #[allow(dead_code)] @@ -83,19 +83,19 @@ pub unsafe extern "C" fn rust_entry() -> ! { #[cfg(feature = "alt-boot1")] crate::println!("\n~~Alt-Boot1 up! ({}: {})~~\n", crate::version::SEMVER, RELEASE_DESCRIPTION); crate::println!("Configured board type: {:?}", board_type); + + #[cfg(feature = "alt-boot1")] + { + // in alt-boot1, always enable bootwait - otherwise we enter a boot loop + while one_way.get_decoded::().expect("couldn't fetch flag") + != bao1x_api::BootWaitCoding::Enable + { + one_way.inc_coded::().unwrap(); + } + } + if board_type == BoardTypeCoding::Baosec { IS_BAOSEC.store(true, Ordering::SeqCst); - #[cfg(all(feature = "force-dabao", feature = "alt-boot1"))] - { - while one_way.get_decoded::().expect("owc coding error") - != bao1x_api::BoardTypeCoding::Dabao - { - one_way.inc_coded::().expect("increment error"); - } - board_type = one_way.get_decoded::().expect("owc coding error"); - crate::println!("Re-configured board type: {:?}", board_type); - IS_BAOSEC.store(false, Ordering::SeqCst); - } } let iox = Iox::new(utra::iox::HW_IOX_BASE as *mut u32); diff --git a/bao1x-boot/boot1/src/platform/bao1x/bao1x.rs b/bao1x-boot/boot1/src/platform/bao1x/bao1x.rs index 9d25f00fe..09d7eeb33 100644 --- a/bao1x-boot/boot1/src/platform/bao1x/bao1x.rs +++ b/bao1x-boot/boot1/src/platform/bao1x/bao1x.rs @@ -66,6 +66,7 @@ pub fn setup_dabao_se0_pin(iox: &T) -> (IoxPort, u8) { (DABAO_SE0_PORT, DABAO_SE0_PIN) } +#[cfg(not(feature = "alt-boot1"))] pub fn setup_backup_region() -> u32 { let mut bu_mgr = bao1x_hal::buram::BackupManager::new(); if !bu_mgr.is_backup_valid() { @@ -139,6 +140,7 @@ pub fn setup_backup_region() -> u32 { /// This can change the board type coding to a safer, simpler board type if the declared board type has /// problems booting. pub fn early_init(mut board_type: bao1x_api::BoardTypeCoding) -> (bao1x_api::BoardTypeCoding, u32) { + #[cfg(not(feature = "alt-boot1"))] if setup_backup_region() == 0 { crate::println!("backup region is clean!"); } @@ -331,6 +333,8 @@ pub fn early_init(mut board_type: bao1x_api::BoardTypeCoding) -> (bao1x_api::Boa let mut cu = bao1x_hal::coreuser::Coreuser::new(); // Coreuser needs to be set up correctly for check_slots to succeed. cu.set(); + // can't check slots in alt-boot mode because it's effectively baremetal as far as permissions go + #[cfg(not(feature = "alt-boot1"))] crate::platform::slots::check_slots(&board_type); // protect() is called inside sigcheck on boot! diff --git a/baremetal/src/platform/bao1x/dabao_selftest.rs b/baremetal/src/platform/bao1x/dabao_selftest.rs index 5c11680c7..efe52d72c 100644 --- a/baremetal/src/platform/bao1x/dabao_selftest.rs +++ b/baremetal/src/platform/bao1x/dabao_selftest.rs @@ -5,6 +5,13 @@ use xous_bio_bdma::*; const DABAO_PINMASK: u32 = 0b0001_1111_1000_1111_0111_1000_0011_1110; // 0x1F8F783E; pub fn dabao_selftest() { + let one_way = bao1x_hal::acram::OneWayCounter::new(); + while one_way.get_decoded::().expect("couldn't fetch flag") + != bao1x_api::BootWaitCoding::Enable + { + one_way.inc_coded::().unwrap(); + } + let mut bio_ss = BioSharedState::new(); let iox = bao1x_hal::iox::Iox::new(utra::iox::HW_IOX_BASE as *mut u32); iox.set_ports_from_bio_bitmask(DABAO_PINMASK);