Add humility host POST code subcommands#603
Conversation
humility host POST codehumility host POST code subcommands
cmd/host/src/lib.rs
Outdated
| bail!("Got bad reflected value: expected U32, got {value:?}"); | ||
| }; | ||
|
|
||
| let op = hubris.get_idol_command("Sequencer.get_post_code")?; | ||
| let handle_value = |v| { | ||
| let Ok(reflect::Value::Base(reflect::Base::U32(v))) = v else { | ||
| bail!("Got bad reflected value: expected U32, got {v:?}"); |
There was a problem hiding this comment.
nitpicky, considered unimportant: perhaps these errors ought to say which IPC returned the surprising value?
There was a problem hiding this comment.
Sure, although we're having a really bad day if that matters!
cmd/host/src/lib.rs
Outdated
| HostCommand::PostCodes { raw } => host_post_codes(hubris, core, raw), | ||
| HostCommand::LastPostCode { raw } => { | ||
| host_last_post_code(hubris, core, raw) | ||
| } |
There was a problem hiding this comment.
hm, here's a thought: since these commands are both Cosmo-specific, I wonder if the command line for them ought to make that more obvious. perhaps humility host cosmo post-codes and humility host cosmo last-post-code?
d2a5577 to
b306bb2
Compare
| #[derive(Parser, Debug)] | ||
| enum CosmoHostCommand { | ||
| /// Prints the most recent POST code | ||
| LastPostCode { | ||
| #[clap(long)] | ||
| raw: bool, | ||
| }, | ||
| /// Dumps the POST code buffer | ||
| PostCodes { | ||
| #[clap(long)] | ||
| raw: bool, | ||
| }, | ||
| } |
There was a problem hiding this comment.
Thanks for adding the subcommand, I think this will make things much clearer to the user.
| host_post_codes(hubris, core, raw) | ||
| } | ||
| CosmoHostCommand::LastPostCode { raw } => { | ||
| host_last_post_code(hubris, core, raw) |
There was a problem hiding this comment.
i wonder somewhat if we ought to change the function names to also say "cosmo" in them, but it's not important to me.
| if let Some(board) = &hubris.manifest.board { | ||
| format!(" but this is a '{board}'") | ||
| } else { | ||
| String::new() | ||
| } |
labbott
left a comment
There was a problem hiding this comment.
I'm a terrible HIF compiler but I think your generated code looks correct.
| // For network-attached systems, function calls are cheap and we can just | ||
| // spam them. For debugger-attached systems, we'll want to run a HIF loop | ||
| // to avoid dispatch overhead. |
There was a problem hiding this comment.
I'm guessing this is a very noticeable lag?
There was a problem hiding this comment.
oh yeah it's terrible – 10+ seconds to read a full 4K codes.
b306bb2 to
6c6fe94
Compare
Closes oxidecomputer/hubris#2288