Skip to content

Commit

Permalink
add "humility mwocp" to flash PSU firmware (#521)
Browse files Browse the repository at this point in the history
This adds a new Humility command, "humility mwocp", that allows for
command-line flashing of PSU firmware on the Murata MWOCP68 family.
  • Loading branch information
bcantrill authored Feb 5, 2025
1 parent 5666b80 commit 26696f2
Show file tree
Hide file tree
Showing 9 changed files with 702 additions and 48 deletions.
30 changes: 27 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ members = [
"cmd/manifest",
"cmd/map",
"cmd/monorail",
"cmd/mwocp",
"cmd/net",
"cmd/openocd",
"cmd/pmbus",
Expand Down Expand Up @@ -155,6 +156,7 @@ cmd-lsusb = { path = "./cmd/lsusb", package = "humility-cmd-lsusb" }
cmd-manifest = { path = "./cmd/manifest", package = "humility-cmd-manifest" }
cmd-map = { path = "./cmd/map", package = "humility-cmd-map" }
cmd-monorail = { path = "./cmd/monorail", package = "humility-cmd-monorail" }
cmd-mwocp = { path = "./cmd/mwocp", package = "humility-cmd-mwocp" }
cmd-net = { path = "./cmd/net", package = "humility-cmd-net" }
cmd-openocd = { path = "./cmd/openocd", package = "humility-cmd-openocd" }
cmd-pmbus = { path = "./cmd/pmbus", package = "humility-cmd-pmbus" }
Expand Down
72 changes: 32 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ a specified target. (In the above example, one could execute `humility
- [humility diagnose](#humility-diagnose): analyze a system to detect common problems
- [humility doc](#humility-doc): print command documentation
- [humility dump](#humility-dump): generate Hubris dump
- [humility etm](#humility-etm): commands for ARM's Embedded Trace Macrocell (ETM)
- [humility exec](#humility-exec): execute command within context of an environment
- [humility extract](#humility-extract): extract all or part of a Hubris archive
- [humility flash](#humility-flash): flash archive onto attached device
Expand All @@ -255,13 +254,13 @@ a specified target. (In the above example, one could execute `humility
- [humility hydrate](#humility-hydrate): Rehydrate a bare memory dump
- [humility i2c](#humility-i2c): scan for and read I2C devices
- [humility ibc](#humility-ibc): interface to the BMR491 power regulator
- [humility itm](#humility-itm): commands for ARM's Instrumentation Trace Macrocell (ITM)
- [humility jefe](#humility-jefe): influence jefe externally
- [humility lpc55gpio](#humility-lpc55gpio): LPC55 GPIO pin manipulation
- [humility lsusb](#humility-lsusb): List all USB devices visible to Humility
- [humility manifest](#humility-manifest): print archive manifest
- [humility map](#humility-map): print memory map, with association of regions to tasks
- [humility monorail](#humility-monorail): Management network control and debugging
- [humility mwocp](#humility-mwocp): Murata power shelf operations
- [humility net](#humility-net): Management network device-side control and debugging
- [humility openocd](#humility-openocd): Run OpenOCD for the given archive
- [humility pmbus](#humility-pmbus): scan for and read PMBus devices
Expand Down Expand Up @@ -641,13 +640,6 @@ ID TASK GEN PRI STATE



### `humility etm`

Enables and operates upon the Embedded Trace Macrocell (ETM) found in
some ARM Cortex-M parts.



### `humility exec`

`humility exec` executes a command for a target within the specified
Expand Down Expand Up @@ -1279,37 +1271,6 @@ had **not** be up for 777 days (or, for that matter, for 4,969).



### `humility itm`

`humility itm` consumes data from the Instrumentation Trace Macrocell
(ITM) present in many ARM Cortex-M variants. ITM is problematic in many
dimensions: it is lossy; it requires knowledge of the target's clocking to
configure properly; it relies on functionality (SWO/SWV) that is often
buggy in chip debuggers; it isn't present everywhere (Cortex-M0+ in
particular doesn't have ITM). So in general, ITM isn't what Hubris
programmers should be looking for: those developing code and wishing to
see if and how that code is executed should prefer ring buffers to
ITM-based instrumentation. (See the documentation for `humility ringbuf`
for details.)

That said, ITM remains the best way to get certain messages from the
Hubris kernel (e.g., boot and panic messages); use `humility itm -ea` to
enable ITM and attach to the connected device. For example, if running
with the `ping` task, one will see messages from `jefe` restarting it:

```console
$ humility -a /path/to/my/hubris-archive.zip itm -ea
humility: attached via ST-Link
humility: core halted
humility: core resumed
humility: ITM synchronization packet found at offset 6
Task #7 Divide-by-zero
Task #7 Memory fault at address 0x0
Task #7 Divide-by-zero
```



### `humility jefe`

Humility allows for some (well-defined) manipulation of tasks via `jefe`,
Expand Down Expand Up @@ -1774,6 +1735,37 @@ PHY register names are also found in the
[`vsc7448-pac` crate](https://github.com/oxidecomputer/vsc7448/tree/master/vsc7448-pac/src/phy).


### `humility mwocp`

`humility mwocp` allows for flashing the MWOCP68 family of PSUs with a
firmware payload specified via the `--flash` option.

Like `humility pmbus`, a device can be specified via an address (along
with an I2C bus or controller and port) or via a PMBus rail. Note that
either the 54V or 12V rail can be used; it is only used to identify the
PSU.

```console
$ humility mwocp -r V54_PSU1 -f ./FW_M5813_F1_v0_7_62.bin
humility: starting update; revision is currently 0701-0701-0000
humility: writing boot loader key
humility: sleeping for 3 seconds...
...
humility: flashed 32.00KB in 2 minutes
humility: sending checksum (0x0036f1c7)
humility: sleeping for 2 seconds...
humility: checksum successful!
humility: resetting PSU
humility: sleeping for 5 seconds...
humility: update complete; revision is now 0762-0701-0000
```

Note that the MWOCP68 itself may reject firmware that is self-consistent
(i.e., valid checksum) but invalid; in this case, an error won't be
indicated, but the revision will not change across the update.



### `humility net`
`humility net` exposes commands to interact with the management network from
the client's perspective.
Expand Down
26 changes: 26 additions & 0 deletions cmd/mwocp/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[package]
name = "humility-cmd-mwocp"
version = "0.1.0"
edition = "2021"
description = "Murata power shelf operations"

[dependencies]
anyhow.workspace = true
clap.workspace = true
colored.workspace = true
hif.workspace = true
indicatif.workspace = true
num-derive.workspace = true
num-traits.workspace = true
parse_int.workspace = true
pmbus.workspace = true
zerocopy.workspace = true

humility-cli.workspace = true
humility-cmd.workspace = true
humility-hiffy.workspace = true
humility-i2c.workspace = true
humility-idol.workspace = true
humility-pmbus.workspace = true
humility.workspace = true

Loading

0 comments on commit 26696f2

Please sign in to comment.