mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
add self destruct support
this will wipe a chip to a factory-blank state. It's unrecoverable on dabao: fully bricks the board.
This commit is contained in:
parent
a6870a617f
commit
68841a45b4
2 changed files with 18 additions and 1 deletions
|
|
@ -458,6 +458,16 @@ impl Repl {
|
|||
crate::println!("Boot1 has no valid signature, lockdown would brick the chip.")
|
||||
}
|
||||
},
|
||||
"self_destruct" => {
|
||||
if !matches!(args.as_slice(), [s] if s == "void_my_warrantee") {
|
||||
return Err(Error::help(
|
||||
"Usage: 'self_destruct void_my_warrantee'. This PERMANENTLY wipes the chip and bricks it. No returns or exchanges are allowed after executing this command.",
|
||||
));
|
||||
}
|
||||
let mut rram = bao1x_hal::rram::Reram::new();
|
||||
unsafe { rram.self_destruct() }
|
||||
// ... and all was null and void!
|
||||
}
|
||||
"baosec-init" => {
|
||||
if !matches!(args.as_slice(), [s] if s == "confirm") {
|
||||
return Err(Error::help(
|
||||
|
|
@ -645,7 +655,7 @@ impl Repl {
|
|||
_ => {
|
||||
crate::println!("Command not recognized: {}", cmd);
|
||||
crate::print!(
|
||||
"Commands include: reset, echo, altboot, boot, bootwait, idmode, localecho, uf2, boardtype, audit, lockdown, paranoid"
|
||||
"Commands include: reset, echo, altboot, boot, bootwait, idmode, localecho, uf2, boardtype, audit, lockdown, paranoid, self_destruct"
|
||||
);
|
||||
#[cfg(feature = "test-boot0-keys")]
|
||||
crate::print!(", publock");
|
||||
|
|
|
|||
|
|
@ -164,6 +164,13 @@ impl<'a> Reram {
|
|||
rram
|
||||
}
|
||||
|
||||
/// This is unsafe because it erases the entire system. Only call this if you want to self destruct.
|
||||
pub unsafe fn self_destruct(&mut self) -> ! {
|
||||
self.csr.wo(utra::rrc::SFR_RRCAR, 0x2468);
|
||||
// busy-wait the CPU so that the suicide flow can complete. There is no return.
|
||||
loop {}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
/// `base` specifies the actual offset from the beginning of the RRAM array
|
||||
/// to where this range maps to. This is necessary because `range` is virtually
|
||||
|
|
|
|||
Loading…
Reference in a new issue