Skip to content

Commit

Permalink
Start recovery flow between Caliptra Core, MCU, and fake BMC
Browse files Browse the repository at this point in the history
We start implementing a simulated recovery flow engine in a fake BMC,
and having it work with Caliptra Core and MCU bootup.

This depends on an event bus being hooked up between Caliptra Core, the
MCU, and our fake BMC, which is processed on each end to translate
events. For example, recovery block reads and writes from the BMC are
translated to recovery registers available through AXI in Caliptra Core.

This flow is a bit complex, and is not 100% finished yet. Currently it
is working well enough that:

* Emulators start and enable active mode
* MCU ROM boots and sets up Caliptra Core's fuse registers
* MCU ROM starts the recovery flow
* Calipta Core ROM boots and requests the first recovery image
  (Caliptra's own firmware)
* Caliptra Core downloads the firmware successfully

The next step will be to get through validation and handle the SoC
manifest and MCU firmware in Caliptra's runtime code.

But, I wanted to do a check in so that these PRs don't become too
overwhelming.

Assuming you have `caliptra-sw` in `../caliptra-sw`, have built the ROM
(`cd rom/dev && make build-rom`) and the signed Caliptra firmware
(`cd rom/dev && make build-fw-image`), and have a file (doesn't yet
matter the contents) `soc-manifest.bin`, you can test this whole flow
with:

```shell-session
$ cargo xtask runtime --caliptra-rom ../caliptra-sw/target/riscv32imc-unknown-none-elf/firmware/caliptra-rom.bin --caliptra-firmware ../caliptra-sw/target/riscv32imc-unknown-none-elf/firmware/caliptra-rom-test-fw --soc-manifest soc-manifest.bin --active-mode

...
[ldev] Signing Cert with MLDSA AUTHORITY.KEYID = 8
[ldev] --
[fwproc] Wait for Commands...
[fwproc] Recv command 0x52494644
[emulator bmc recovery] Recovery state transition: ReadDeviceStatus -> WaitForRecoveryStatus
[emulator bmc recovery] Sending recovery image 0
[emulator bmc recovery] Recovery state transition: WaitForRecoveryStatus -> WaitForRecoveryPending
[fwproc] Waiting for payload available signal...
[fwproc] Recovery payload of 131072 bytes available
[fwproc] Received Image from Recovery Interface of size 131072 bytes
ROM Fatal Error: 0x000B0003
```

(The fatal error is signature validation failure, which is to be
expected.)

Depends on chipsalliance/caliptra-sw#1938
  • Loading branch information
swenson committed Feb 8, 2025
1 parent a3bcd0a commit 1c1c8f9
Show file tree
Hide file tree
Showing 16 changed files with 744 additions and 102 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/target/
/target*/

# By default, ignore Cargo.lock files in non-workspace directories.
*/**/Cargo.lock
Expand All @@ -22,4 +22,4 @@ book

# flash file
main_flash
recovery_flash
recovery_flash
Loading

0 comments on commit 1c1c8f9

Please sign in to comment.