Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions cmd/qspi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ struct QspiArgs {
/// persistently selects a storage slot
#[clap(long, group = "command")]
set_persistent_slot: Option<u8>,

/// Target a specific slot
#[clap(long)]
slot: Option<u8>,
}

struct QspiDevice {
Expand Down Expand Up @@ -485,6 +489,27 @@ fn qspi(context: &mut ExecutionContext) -> Result<()> {
let subargs = QspiArgs::try_parse_from(subargs)?;
let mut context = HiffyContext::new(hubris, core, subargs.timeout)?;

match subargs.slot {
None => humility::msg!("Using existing slot settings"),
s @ (Some(0) | Some(1)) => {
let s = s.unwrap();
humility::msg!("Setting slot to {s}");
let out = hiffy_call(
hubris,
core,
&mut context,
&hubris.get_idol_command("HostFlash.set_dev")?,
&[("dev", IdolArgument::String(&format!("Flash{s}")))],
None,
None,
)?;
if let Err(e) = out {
bail!("set_dev failed: {e}");
}
}
_ => bail!("Bad slot setting"),
}

const SECTOR_SIZE: u32 = 64 * 1024;
const BLOCK_SIZE: u32 = 256; // Conflating flash block size with hubris scratch buffer.

Expand Down
Loading