From bc98064a5930fac888a77812326c2657edfd4cee Mon Sep 17 00:00:00 2001 From: bunnie Date: Wed, 5 Jan 2022 11:22:29 +0800 Subject: [PATCH] add a function to recycle the PDDB for faster PDDB testing cycles --- services/shellchat/src/cmds/keys.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/services/shellchat/src/cmds/keys.rs b/services/shellchat/src/cmds/keys.rs index 51f8f0ca8..061574e2f 100644 --- a/services/shellchat/src/cmds/keys.rs +++ b/services/shellchat/src/cmds/keys.rs @@ -10,6 +10,7 @@ pub struct Keys { rootkeys: root_keys::RootKeys, } #[derive(Debug)] +#[allow(dead_code)] #[cfg(not(feature="spinortest"))] pub struct Keys { spinor: spinor::Spinor, @@ -63,7 +64,7 @@ impl<'a> ShellCmdApi<'a> for Keys { fn process(&mut self, args: String::<1024>, env: &mut CommonEnv) -> Result>, xous::Error> { use core::fmt::Write; let mut ret = String::<1024>::new(); - let helpstring = "keys [usblock] [usbunlock] [spinortest]"; + let helpstring = "keys [usblock] [usbunlock] [pddbrecycle]"; let mut tokens = args.as_str().unwrap().split(' '); @@ -113,6 +114,11 @@ 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(); } + "pddbrecycle" => { + // erase the page table, which should effectively trigger a reformat on the next boot + self.spinor.bulk_erase(xous::PDDB_LOC, 1024 * 1024).expect("couldn't erase page table"); + write!(ret, "PDDB page table ereased").unwrap(); + } #[cfg(feature="spinortest")] "spinortest" => { let region = self.testing_range.as_slice::();