diff --git a/services/shellchat/Cargo.toml b/services/shellchat/Cargo.toml index 7ad5d6fbe..d68d0c6ae 100644 --- a/services/shellchat/Cargo.toml +++ b/services/shellchat/Cargo.toml @@ -72,6 +72,7 @@ utralib = {path = "../../utralib"} [features] debugprint = [] +spinortest = [] # for spinor testing. contra-indicated with PDDB, as it steals memory from the PDDB. default = [] # "debugprint" [target.'cfg(any(windows,unix))'.dependencies] diff --git a/services/shellchat/src/cmds.rs b/services/shellchat/src/cmds.rs index 2d8b53608..260177cf5 100644 --- a/services/shellchat/src/cmds.rs +++ b/services/shellchat/src/cmds.rs @@ -86,7 +86,7 @@ mod rtc_cmd; use rtc_cmd::*; mod vibe; use vibe::*; mod ssid; use ssid::*; mod ver; use ver::*; -mod audio; use audio::*; +//mod audio; use audio::*; // this command is currently contra-indicated with PDDB, as the test audio currently overlaps the PDDB space. We'll fix this eventually, but for now, let's switch to PDDB mode. mod backlight; use backlight::*; mod accel; use accel::*; mod sha; use sha::*; @@ -95,7 +95,7 @@ mod aes_cmd; use aes_cmd::*; mod trng_cmd; use trng_cmd::*; mod engine; use engine::*; mod console; use console::*; -mod memtest; use memtest::*; +//mod memtest; use memtest::*; mod keys; use keys::*; mod wlan; use wlan::*; mod jtag_cmd; use jtag_cmd::*; @@ -115,13 +115,13 @@ pub struct CmdEnv { rtc_cmd: RtcCmd, vibe_cmd: Vibe, ssid_cmd: Ssid, - audio_cmd: Audio, + //audio_cmd: Audio, sha_cmd: Sha, ecup_cmd: EcUpdate, aes_cmd: Aes, trng_cmd: TrngCmd, engine_cmd: Engine, - memtest_cmd: Memtest, + //memtest_cmd: Memtest, keys_cmd: Keys, jtag_cmd: JtagCmd, net_cmd: NetCmd, @@ -145,7 +145,7 @@ impl CmdEnv { let aes = Aes::new(&xns, &mut common); let ecup = EcUpdate::new(&mut common); let engine = Engine::new(&xns, &mut common); - let memtest = Memtest::new(&xns, &mut common); + //let memtest = Memtest::new(&xns, &mut common); // print our version info let (maj, min, rev, extra, gitrev) = common.llio.soc_gitrev().unwrap(); @@ -168,13 +168,13 @@ impl CmdEnv { rtc_cmd: RtcCmd::new(&xns), vibe_cmd: Vibe::new(), ssid_cmd: Ssid::new(), - audio_cmd: Audio::new(&xns), + //audio_cmd: Audio::new(&xns), sha_cmd: sha, ecup_cmd: ecup, aes_cmd: aes, trng_cmd: TrngCmd::new(), engine_cmd: engine, - memtest_cmd: memtest, + //memtest_cmd: memtest, keys_cmd: Keys::new(&xns), jtag_cmd: JtagCmd::new(&xns), net_cmd: NetCmd::new(&xns), @@ -203,7 +203,7 @@ impl CmdEnv { &mut self.vibe_cmd, &mut self.ssid_cmd, &mut ver_cmd, - &mut self.audio_cmd, + //&mut self.audio_cmd, &mut backlight_cmd, &mut accel_cmd, &mut self.sha_cmd, @@ -212,7 +212,7 @@ impl CmdEnv { &mut self.trng_cmd, &mut self.engine_cmd, &mut console_cmd, - &mut self.memtest_cmd, + // &mut self.memtest_cmd, &mut self.keys_cmd, &mut wlan_cmd, &mut self.jtag_cmd, diff --git a/services/shellchat/src/cmds/keys.rs b/services/shellchat/src/cmds/keys.rs index f5e81ab45..51f8f0ca8 100644 --- a/services/shellchat/src/cmds/keys.rs +++ b/services/shellchat/src/cmds/keys.rs @@ -3,23 +3,32 @@ use root_keys::api::{AesRootkeyType, Block}; use xous_ipc::String; #[derive(Debug)] +#[cfg(feature="spinortest")] pub struct Keys { testing_range: xous::MemoryRange, spinor: spinor::Spinor, rootkeys: root_keys::RootKeys, } +#[derive(Debug)] +#[cfg(not(feature="spinortest"))] +pub struct Keys { + spinor: spinor::Spinor, + rootkeys: root_keys::RootKeys, +} +#[cfg(feature="spinortest")] const TEST_SIZE: usize = 0x4000; +#[cfg(feature="spinortest")] const TEST_BASE: usize = 0x608_0000; impl Keys { pub fn new(xns: &xous_names::XousNames) -> Keys { - #[cfg(any(target_os = "none", target_os = "xous"))] + #[cfg(all(any(target_os = "none", target_os = "xous"), feature="spinortest"))] let testing_range = xous::syscall::map_memory( Some(core::num::NonZeroUsize::new(TEST_BASE + xous::FLASH_PHYS_BASE as usize).unwrap()), // occupy the 44.1khz short sample area for testing None, TEST_SIZE, xous::MemoryFlags::R, ).expect("couldn't map in testing range"); - #[cfg(not(any(target_os = "none", target_os = "xous")))] // just make a dummy mapping to keep things from crashing in hosted mode + #[cfg(all(not(any(target_os = "none", target_os = "xous")), feature="spinortest"))] // just make a dummy mapping to keep things from crashing in hosted mode let testing_range = xous::syscall::map_memory( None, None, @@ -31,11 +40,20 @@ impl Keys { // NOTE NOTE NOTE -- this should be removed once we have the SoC updater code written, but for testing // we occupy this slot as it is a pre-requisite for the block to work spinor.register_soc_token().unwrap(); - Keys { + + #[cfg(feature="spinortest")] + let keys = Keys { testing_range, spinor, rootkeys: root_keys::RootKeys::new(&xns, Some(AesRootkeyType::User0)).expect("couldn't allocate rootkeys API"), - } + }; + + #[cfg(not(feature="spinortest"))] + let keys = Keys { + spinor, + rootkeys: root_keys::RootKeys::new(&xns, Some(AesRootkeyType::User0)).expect("couldn't allocate rootkeys API"), + }; + keys } } @@ -95,6 +113,7 @@ impl<'a> ShellCmdApi<'a> for Keys { env.llio.debug_usb(Some(false)).unwrap(); write!(ret, "USB debug port unlocked: all secrets are readable via USB!").unwrap(); } + #[cfg(feature="spinortest")] "spinortest" => { let region = self.testing_range.as_slice::(); let region_base = TEST_BASE as u32; // base offsets are 0-relative to start of FLASH