From c127f00dc1be1f14f963ea22ed87289e0e2e3fe7 Mon Sep 17 00:00:00 2001 From: bunnie Date: Thu, 20 Oct 2022 22:35:17 +0800 Subject: [PATCH] add a no-codec feature for DVT builds specifying this turns off all dependencies that rely on the codec, which is a different device on DVT. --- services/shellchat/Cargo.toml | 1 + services/shellchat/src/cmds.rs | 19 +++++++++++++++---- services/shellchat/src/main.rs | 1 + xtask/src/main.rs | 1 + 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/services/shellchat/Cargo.toml b/services/shellchat/Cargo.toml index 63c6b1d79..a1a9861ab 100644 --- a/services/shellchat/Cargo.toml +++ b/services/shellchat/Cargo.toml @@ -118,6 +118,7 @@ ditherpunk = ["png"] tracking-alloc = ["tracking-allocator", "tracing", "tracing-subscriber"] dbg-ecupdate = [] # for issuing manual commands to initiate an EC update (vs UX). Also need to enable this feature in the status crate. Intended for debug only. test-rekey = [] +no-codec = [] nettest = [] # batch network tests tls = ["rustls", "webpki-roots", "ring", "tungstenite", "url"] perfcounter = ["ring", "perflib", "xous/v2p"] diff --git a/services/shellchat/src/cmds.rs b/services/shellchat/src/cmds.rs index 8ca285b4d..e73a8a6a6 100644 --- a/services/shellchat/src/cmds.rs +++ b/services/shellchat/src/cmds.rs @@ -48,6 +48,7 @@ pub struct CommonEnv { cb_registrations: HashMap::>, trng: Trng, netmgr: net::NetManager, + #[allow(dead_code)] xns: xous_names::XousNames, boot_instant: std::time::Instant, /// make this communal so any number of commands can trigger or reset the performance counter, and/or perform logging @@ -86,7 +87,6 @@ impl CommonEnv { ///// 1. add your module here, and pull its namespace into the local crate mod echo; use echo::*; -mod test; use test::*; mod sleep; use sleep::*; mod sensors; use sensors::*; // mod callback; use callback::*; @@ -111,6 +111,11 @@ mod net_cmd; use net_cmd::*; mod pddb_cmd; use pddb_cmd::*; mod usb; use usb::*; +#[cfg(not(feature="no-codec"))] +mod test; +#[cfg(not(feature="no-codec"))] +use test::*; + #[cfg(feature="tts")] mod tts; #[cfg(feature="tts")] @@ -135,7 +140,6 @@ pub struct CmdEnv { common_env: CommonEnv, lastverb: String::<256>, ///// 2. declare storage for your command here. - test_cmd: Test, sleep_cmd: Sleep, sensors_cmd: Sensors, //callback_cmd: CallBack, @@ -154,6 +158,9 @@ pub struct CmdEnv { wlan_cmd: Wlan, usb_cmd: Usb, + #[cfg(not(feature="no-codec"))] + test_cmd: Test, + #[cfg(feature="tts")] tts_cmd: Tts, @@ -226,7 +233,6 @@ impl CmdEnv { common_env: common, lastverb: String::<256>::new(), ///// 3. initialize your storage, by calling new() - test_cmd: Test::new(&xns), sleep_cmd: Sleep::new(&xns), sensors_cmd: Sensors::new(), //callback_cmd: CallBack::new(), @@ -245,6 +251,9 @@ impl CmdEnv { wlan_cmd: Wlan::new(), usb_cmd: Usb::new(), + #[cfg(not(feature="no-codec"))] + test_cmd: Test::new(&xns), + #[cfg(feature="tts")] tts_cmd: Tts::new(&xns), @@ -269,7 +278,6 @@ impl CmdEnv { let commands: &mut [& mut dyn ShellCmdApi] = &mut [ ///// 4. add your command to this array, so that it can be looked up and dispatched &mut echo_cmd, - &mut self.test_cmd, &mut self.sleep_cmd, &mut self.sensors_cmd, //&mut self.callback_cmd, @@ -292,6 +300,9 @@ impl CmdEnv { &mut self.pddb_cmd, &mut self.usb_cmd, + #[cfg(not(feature="no-codec"))] + &mut self.test_cmd, + #[cfg(feature="tts")] &mut self.tts_cmd, diff --git a/services/shellchat/src/main.rs b/services/shellchat/src/main.rs index 085f26cf6..85e5d5bc6 100644 --- a/services/shellchat/src/main.rs +++ b/services/shellchat/src/main.rs @@ -43,6 +43,7 @@ use xous_ipc::Buffer; mod cmds; use cmds::*; +#[cfg(not(feature="no-codec"))] mod oqc_test; #[cfg(feature="nettest")] diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 12f7bd307..391083c26 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -296,6 +296,7 @@ fn main() -> Result<(), Box> { builder.target_precursor("2753c12-dvt") .add_services(&services) + .add_feature("no-codec") .add_apps(&get_cratespecs()); } Some("tts") => {