fix dabao target for lib1x-hal

this is the "effective" traget for simulation: no external
peripherals expected.
This commit is contained in:
bunnie 2025-09-20 22:16:16 +08:00
parent 4f8169c3d9
commit 5151553028
4 changed files with 19 additions and 10 deletions

View file

@ -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"]

View file

@ -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<T: IoSetup + IoGpio>(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;

View file

@ -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;

View file

@ -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(())
}
}