diff --git a/Cargo.lock b/Cargo.lock index 7547c9a7..c416c58e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1259,7 +1259,7 @@ dependencies = [ [[package]] name = "humility-bin" -version = "0.12.6" +version = "0.12.7" dependencies = [ "anyhow", "bitfield", @@ -1558,6 +1558,7 @@ dependencies = [ "humility-cortex", "humility-probes-core", "ihex", + "measurement-token", "num-traits", "parse_int", "path-slash", @@ -2790,6 +2791,11 @@ dependencies = [ "void", ] +[[package]] +name = "measurement-token" +version = "0.1.0" +source = "git+https://github.com/oxidecomputer/lpc55_support#936f7d55b76d35165816f6f876f9fa9390fd4f5a" + [[package]] name = "memchr" version = "2.5.0" diff --git a/Cargo.toml b/Cargo.toml index 59fc6e22..54ca128b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -87,9 +87,10 @@ hif = { git = "https://github.com/oxidecomputer/hif" } humpty = { git = "https://github.com/oxidecomputer/humpty", version = "0.1.3" } idol = {git = "https://github.com/oxidecomputer/idolatry.git"} idt8a3xxxx = { git = "https://github.com/oxidecomputer/idt8a3xxxx" } +measurement-token = { git = "https://github.com/oxidecomputer/lpc55_support", default-features = false } pmbus = { git = "https://github.com/oxidecomputer/pmbus" } -spd = { git = "https://github.com/oxidecomputer/spd" } serialport = { git = "https://github.com/jgallagher/serialport-rs", branch = "illumos-support" } +spd = { git = "https://github.com/oxidecomputer/spd" } tlvc = { git = "https://github.com/oxidecomputer/tlvc" } tlvc-text = {git = "https://github.com/oxidecomputer/tlvc"} vsc7448-info = { git = "https://github.com/oxidecomputer/vsc7448.git" } diff --git a/cmd/flash/Cargo.toml b/cmd/flash/Cargo.toml index d7fcffd0..305d4bfa 100644 --- a/cmd/flash/Cargo.toml +++ b/cmd/flash/Cargo.toml @@ -13,6 +13,7 @@ humility-probes-core = { workspace = true } cmd-auxflash = { workspace = true } clap = { workspace = true } anyhow = { workspace = true } +measurement-token = { workspace = true } parse_int = { workspace = true } num-traits = { workspace = true } tempfile = { workspace = true } diff --git a/cmd/flash/src/lib.rs b/cmd/flash/src/lib.rs index dbba7f62..5cc7dd17 100644 --- a/cmd/flash/src/lib.rs +++ b/cmd/flash/src/lib.rs @@ -403,7 +403,23 @@ fn flashcmd(context: &mut ExecutionContext) -> Result<()> { std::thread::sleep(std::time::Duration::from_millis(delay)); } - core.reset()?; + // If this image uses handoff to send a measurement token between the RoT + // and SP, this won't work with a debugger physically attached. To prevent + // the SP from resetting itself, we write a different token which skips this + // reboot loop. The memory address and token values are pulled from the + // `measurement-token` crate in `lpc55_support`, which is also used in the + // SP firmware. + if hubris.manifest.features.iter().any(|s| s == "measurement-handoff") { + core.reset_and_halt(std::time::Duration::from_millis(25))?; + humility::msg!("skipping measurement token handoff"); + core.write_word_32( + measurement_token::SP_ADDR as u32, + measurement_token::SKIP, + )?; + core.run()?; + } else { + core.reset()?; + } // At this point, we can attempt to program the auxiliary flash. This has // to happen *after* the image is flashed and the core is reset, because it diff --git a/humility-bin/Cargo.toml b/humility-bin/Cargo.toml index 2b872796..30d10a88 100644 --- a/humility-bin/Cargo.toml +++ b/humility-bin/Cargo.toml @@ -17,7 +17,7 @@ [package] name = "humility-bin" -version = "0.12.6" +version = "0.12.7" edition = "2021" license = "MPL-2.0" rust-version = "1.68" diff --git a/humility-bin/tests/cmd/chip.trycmd b/humility-bin/tests/cmd/chip.trycmd index 600dc57b..bd725471 100644 --- a/humility-bin/tests/cmd/chip.trycmd +++ b/humility-bin/tests/cmd/chip.trycmd @@ -13,7 +13,7 @@ For more information try --help ``` $ humility --chip this-can-be-anything -V -humility 0.12.6 +humility 0.12.7 ``` @@ -28,7 +28,7 @@ For more information try --help ``` $ humility -c apx432 -V -humility 0.12.6 +humility 0.12.7 ``` diff --git a/humility-bin/tests/cmd/version.trycmd b/humility-bin/tests/cmd/version.trycmd index 9fd87fd9..f4379b1e 100644 --- a/humility-bin/tests/cmd/version.trycmd +++ b/humility-bin/tests/cmd/version.trycmd @@ -2,7 +2,7 @@ Long version flag: ``` $ humility --version -humility 0.12.6 +humility 0.12.7 ``` @@ -10,6 +10,6 @@ Short version flag: ``` $ humility -V -humility 0.12.6 +humility 0.12.7 ``` diff --git a/humility-core/src/hubris.rs b/humility-core/src/hubris.rs index 5e949574..95ceb4d8 100644 --- a/humility-core/src/hubris.rs +++ b/humility-core/src/hubris.rs @@ -40,7 +40,7 @@ const OXIDE_NT_HUBRIS_ARCHIVE: u32 = OXIDE_NT_BASE + 1; const OXIDE_NT_HUBRIS_REGISTERS: u32 = OXIDE_NT_BASE + 2; const OXIDE_NT_HUBRIS_TASK: u32 = OXIDE_NT_BASE + 3; -const MAX_HUBRIS_VERSION: u32 = 9; +const MAX_HUBRIS_VERSION: u32 = 10; #[derive(Default, Debug, Serialize)] pub struct HubrisManifest {