From af043c3a18c71403ffa570ee57221cf392af68aa Mon Sep 17 00:00:00 2001 From: bunnie Date: Mon, 3 Mar 2025 02:09:30 +0800 Subject: [PATCH] make usb-cramium suitable as a dependency for hosted emulation --- services/usb-cramium/Cargo.toml | 14 +++++++++++--- services/usb-cramium/src/lib.rs | 3 +++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/services/usb-cramium/Cargo.toml b/services/usb-cramium/Cargo.toml index 3af1d7e28..e1c54ae39 100644 --- a/services/usb-cramium/Cargo.toml +++ b/services/usb-cramium/Cargo.toml @@ -18,8 +18,9 @@ cramium-hal = { path = "../../libs/cramium-hal", features = [ "debug-print-usb", # "verbose-debug", "axp2101", -] } -cram-hal-service = { path = "../cram-hal-service" } +], optional = true } +cram-hal-service = { path = "../cram-hal-service", optional = true } +cramium-emu = { path = "../cramium-emu", optional = true } xous-usb-hid = { git = "https://github.com/betrusted-io/xous-usb-hid.git", branch = "main" } rkyv = { version = "0.8.8", default-features = false, features = [ "std", @@ -37,7 +38,14 @@ version = "0.2.8" features = ["log"] [features] -cramium-soc = ["utralib/cramium-soc", "utralib/std"] +cramium-soc = [] +board-baosec = [ + "utralib/cramium-soc", + "utralib/std", + "cramium-hal", + "cram-hal-service", +] +hosted-baosec = ["utralib/hosted", "utralib/std", "cramium-emu"] # none of these other modes are actually supported, but are listed here # to allow direct re-use of API code precursor = ["utralib/precursor", "utralib/std"] diff --git a/services/usb-cramium/src/lib.rs b/services/usb-cramium/src/lib.rs index 87a1bafe9..8d1e4716f 100644 --- a/services/usb-cramium/src/lib.rs +++ b/services/usb-cramium/src/lib.rs @@ -1,6 +1,9 @@ #![cfg_attr(target_os = "none", no_std)] +#[cfg(feature = "cramium-soc")] use cram_hal_service::trng; +#[cfg(feature = "hosted-baosec")] +use cramium_emu::trng; pub mod api; pub use api::*;