diff --git a/kernel/Cargo.toml b/kernel/Cargo.toml index dc7b9de87..48e5a6e5a 100644 --- a/kernel/Cargo.toml +++ b/kernel/Cargo.toml @@ -44,12 +44,7 @@ critical-section = "1.1.1" unexpected_cfgs = { level = "warn", check-cfg = ['cfg(ci)', 'cfg(baremetal)'] } [features] -cramium-soc = [ - "utralib/cramium-soc", - "cramium-hal/cramium-soc", - "rand_chacha", - "raw-trng", -] +cramium-soc = ["utralib/cramium-soc", "rand_chacha", "raw-trng"] verilator-only = [] cramium-fpga = ["utralib/cramium-fpga", "rand_chacha"] board-baosec = ["cramium-hal/kernel-baosec", "memmap-flash", "swap"] diff --git a/libs/cramium-hal/Cargo.toml b/libs/cramium-hal/Cargo.toml index 717a81cdc..b8ed9e59c 100644 --- a/libs/cramium-hal/Cargo.toml +++ b/libs/cramium-hal/Cargo.toml @@ -32,7 +32,6 @@ camera-ov2640 = [] camera-gc2145 = [] display-sh1107 = [] axp2101 = [] -cramium-soc = ["utralib/cramium-soc"] board-baosec = [ "camera-gc2145", "display-sh1107", @@ -41,6 +40,7 @@ board-baosec = [ "ux-api/board-baosec", ] # USB form factor token loader-baosec = [ + "utralib/cramium-soc", "camera-gc2145", "display-sh1107", "axp2101", diff --git a/libs/cramium-hal/src/mbox.rs b/libs/cramium-hal/src/mbox.rs index 8e95cef35..ba74b46bd 100644 --- a/libs/cramium-hal/src/mbox.rs +++ b/libs/cramium-hal/src/mbox.rs @@ -67,9 +67,9 @@ pub struct MboxToCm7Pkt<'a> { pub struct MboxToRvPkt { pub version: u32, pub opcode: ToRvOp, - #[cfg(target_os = "xous")] + #[cfg(feature = "std")] pub data: Vec, - #[cfg(not(target_os = "xous"))] + #[cfg(not(feature = "std"))] pub len: usize, } @@ -78,7 +78,7 @@ pub struct Mbox { } impl Mbox { pub fn new() -> Mbox { - #[cfg(target_os = "xous")] + #[cfg(feature = "std")] let csr_mem = xous::syscall::map_memory( xous::MemoryAddress::new(mailbox::HW_MAILBOX_BASE), None, @@ -86,9 +86,9 @@ impl Mbox { xous::MemoryFlags::R | xous::MemoryFlags::W, ) .expect("couldn't map mailbox CSR range"); - #[cfg(target_os = "xous")] + #[cfg(feature = "std")] let mut csr = CSR::new(csr_mem.as_mut_ptr() as *mut u32); - #[cfg(not(target_os = "xous"))] + #[cfg(not(feature = "std"))] let mut csr = CSR::new(mailbox::HW_MAILBOX_BASE as *mut u32); csr.wfo(mailbox::LOOPBACK_LOOPBACK, 0); // ensure we're not in loopback mode // generate available events - not hooked up to IRQ, but we'll poll for now @@ -129,7 +129,7 @@ impl Mbox { } } - #[cfg(target_os = "xous")] + #[cfg(feature = "std")] pub fn try_rx(&mut self) -> Result { let version = self.expect_rx()?; let op_and_len = self.expect_rx()?; @@ -142,7 +142,7 @@ impl Mbox { Ok(MboxToRvPkt { version, opcode, data }) } - #[cfg(not(target_os = "xous"))] + #[cfg(not(feature = "std"))] pub fn try_rx(&mut self, data: &mut [u32]) -> Result { let version = self.expect_rx()?; let op_and_len = self.expect_rx()?; diff --git a/libs/cramium-hal/src/udma/spim.rs b/libs/cramium-hal/src/udma/spim.rs index 418514a46..a30d9afa3 100644 --- a/libs/cramium-hal/src/udma/spim.rs +++ b/libs/cramium-hal/src/udma/spim.rs @@ -606,14 +606,14 @@ impl Spim { /// Wait for the pending tx/rx cycle to finish, returns a pointer to the Rx buffer when done. pub fn txrx_await(&mut self, _use_yield: bool) -> Result<&[u8], xous::Error> { - #[cfg(not(target_os = "xous"))] + #[cfg(not(feature = "std"))] if let Some(pending) = self.pending_txrx.take() { while self.udma_busy(Bank::Tx) || self.udma_busy(Bank::Rx) || self.udma_busy(Bank::Custom) {} Ok(&self.rx_buf()[..pending]) } else { Err(xous::Error::UseBeforeInit) } - #[cfg(target_os = "xous")] + #[cfg(feature = "std")] { if let Some(pending) = self.pending_txrx.take() { let tt = xous_api_ticktimer::Ticktimer::new().unwrap(); diff --git a/loader/Cargo.toml b/loader/Cargo.toml index 8e99348f4..01b1c7256 100644 --- a/loader/Cargo.toml +++ b/loader/Cargo.toml @@ -82,7 +82,7 @@ renode = [ cramium-soc = [ "utralib/cramium-soc", "debug-print", - "cramium-hal/cramium-soc", + "cramium-hal", "cramium-api", "rand_chacha", "sram-margin",