From 5151553028f5d034760504db423dfa921398268b Mon Sep 17 00:00:00 2001 From: bunnie Date: Sat, 20 Sep 2025 22:16:16 +0800 Subject: [PATCH] fix dabao target for lib1x-hal this is the "effective" traget for simulation: no external peripherals expected. --- libs/bao1x-hal/Cargo.toml | 4 +++- libs/bao1x-hal/src/board/dabao.rs | 15 +++++++++++---- libs/bao1x-hal/src/board/mod.rs | 4 ++-- libs/bao1x-hal/src/debug.rs | 6 +++--- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/libs/bao1x-hal/Cargo.toml b/libs/bao1x-hal/Cargo.toml index 17014cf47..18a8e4654 100644 --- a/libs/bao1x-hal/Cargo.toml +++ b/libs/bao1x-hal/Cargo.toml @@ -51,6 +51,7 @@ board-baosec = [ "bmp180", "utralib/bao1x", "ux-api/board-baosec", + "ux-api/std", ] # USB form factor token loader-baosec = [ "utralib/bao1x", @@ -66,9 +67,11 @@ kernel-dabao = ["utralib/bao1x"] test-baosec = ["ux-api/loader-baosec", "camera-gc2145"] hosted-baosec = ["std"] # emulated hardware on x86 platform board-baosor = [ + "std", "camera-gc2145", "axp2101", "utralib/bao1x", + "ux-api/std", ] # Precursor form factor loader-baosor = [] board-dabao = ["utralib/bao1x"] # Dev board form factor @@ -89,7 +92,6 @@ std = [ "xous-api-names", "usb-device", "xous-api-ticktimer", - "ux-api/std", "bao1x-api/std", ] derive-rkyv = ["rkyv"] diff --git a/libs/bao1x-hal/src/board/dabao.rs b/libs/bao1x-hal/src/board/dabao.rs index 687277c52..430c0dda9 100644 --- a/libs/bao1x-hal/src/board/dabao.rs +++ b/libs/bao1x-hal/src/board/dabao.rs @@ -1,6 +1,6 @@ // Constants that define pin locations, RAM offsets, etc. for the DaBao basic breakout board -use crate::iox::IoSetup; -use crate::iox::*; + +use bao1x_api::*; // console uart buffer pub const UART_DMA_TX_BUF_PHYS: usize = utralib::HW_IFRAM0_MEM + utralib::HW_IFRAM0_MEM_LEN - 4096; @@ -42,7 +42,7 @@ pub fn setup_usb_pins(iox: &T) -> (IoxPort, u8) { (IoxPort::PB, SE0_PIN) } -pub fn setup_i2c_pins(iox: &dyn IoSetup) -> crate::udma::I2cChannel { +pub fn setup_i2c_pins(iox: &dyn IoSetup) -> bao1x_api::I2cChannel { // I2C_SCL_B[0] iox.setup_pin( IoxPort::PB, @@ -65,5 +65,12 @@ pub fn setup_i2c_pins(iox: &dyn IoSetup) -> crate::udma::I2cChannel { Some(IoxEnable::Enable), Some(IoxDriveStrength::Drive2mA), ); - crate::udma::I2cChannel::Channel0 + bao1x_api::I2cChannel::Channel0 } + +// these are a bodge to allow some UDMA imports to work - they need to be present even if +// there currently no SPINOR devices attached. +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; diff --git a/libs/bao1x-hal/src/board/mod.rs b/libs/bao1x-hal/src/board/mod.rs index aae709edc..cdb1ff099 100644 --- a/libs/bao1x-hal/src/board/mod.rs +++ b/libs/bao1x-hal/src/board/mod.rs @@ -16,9 +16,9 @@ pub use baosec::*; pub mod baosor; #[cfg(any(feature = "board-baosor", feature = "loader-baosor"))] pub use baosor::*; -#[cfg(any(feature = "board-dabao", feature = "loader-dabao"))] +#[cfg(any(feature = "board-dabao", feature = "loader-dabao", feature = "kernel-dabao"))] pub mod dabao; -#[cfg(any(feature = "board-dabao", feature = "loader-dabao"))] +#[cfg(any(feature = "board-dabao", feature = "loader-dabao", feature = "kernel-dabao"))] pub use dabao::*; #[cfg(feature = "hosted-baosec")] pub mod hosted; diff --git a/libs/bao1x-hal/src/debug.rs b/libs/bao1x-hal/src/debug.rs index 8332b8bbc..6ad106d8b 100644 --- a/libs/bao1x-hal/src/debug.rs +++ b/libs/bao1x-hal/src/debug.rs @@ -66,13 +66,13 @@ impl Uart { use core::fmt::{Error, Write}; impl Write for Uart { - fn write_str(&mut self, s: &str) -> Result<(), Error> { + fn write_str(&mut self, _s: &str) -> Result<(), Error> { #[cfg(not(all(feature = "std", not(feature = "debug-print-usb"))))] - for c in s.bytes() { + for c in _s.bytes() { self.putc(c); } // #[cfg(all(feature = "std", not(feature = "debug-print-usb")))] - // log::info!("{}", s); + // log::info!("{}", _s); Ok(()) } }