fwhtool
In 2024, I encountered a problem with a Shuttle SG33G5 desktop computer with which a failed firmware upgrade left the system effectively dead. Such a system, and many others like it of that era, have the flash memory chips containing their firmware connected over a special variant of the Low Pin Count (LPC) bus known as the Intel Firmware Hub (FWH), or even just LPC by itself. While the flashrom project contains support for many of these chips, it is primarily written with internal, in-system programming in mind, which was not suitable for my use case because the system had been damaged to the point where executing flashrom was not a possibility.
While some others had written one-off utilities to access a particular chip from the GPIO headers of a specific single-board computer that they owned (or other similar fixed configurations), I wanted to write a neatly polished program that could access any known LPC/FWH flash chip, from an extensible variety of I/O ports, similar to flashrom's convenience but with the capacity to emulate the necessary bus protocol from widely available GPIO ports and microcontroller test boards.
fwhtool is the product of this labour. It currently supports the following chips:
- W39V080FA
- SST49LF008A
- SST49LF020
- SST49LF016C (Work in Progress)
And the following programmer devices:
- Raspberry Pi Model B/A
- Raspberry Pi Model B+/A+
- Raspberry Pi 2 Model B/A v1.1/v1.2/v1.3
- Raspberry Pi 3 Model B/B+/A+
- Raspberry Pi 4
- Raspberry Pi 5
- Raspberry Pi Zero v1.3/W/WH
- Raspberry Pi Zero 2 W/WH
And the following buses:
- Firmware Hub (FWH)
- Low Pin Count (LPC)
- Low Pin Count, ISA Compatibility (LPC-ISA)
Download and Compile
The software is provided as a single C source file, fwhtool.c. It will compile under any ISO C99-compatible C compiler, but to compile on a Raspberry Pi device running GNU/Linux with the GNU C Compiler for example, you would do this:
gcc -Os -march=native -DBOARD_RASPI=1 fwhtool.c -o fwhtool -lwiringPi
In this case, the WiringPi library must be installed on the system as a dependency.
Instructions
The following main operations are provided.
-
fwhtool -i— Automatically identify the model of the connected chip. -
fwhtool -r <file>— Read the content of the connected chip tofile. -
fwhtool -w <file>— Write the content offileto the connected chip.
Other options, such as erasing the chip without writing, overriding chip detection, or testing with a dummy chip, can be shown with fwhtool -h.
Wiring Specification
In order to use the program, you must wire up the target chip to your programmer correctly according to the pins specified in the source code. Below are some default configurations; consult the datasheet for the chip you want to interface with to see exactly which pins you must connect to.
Raspberry Pi
This should apply to all models of the Raspberry Pi.
| GPIO 1-40 No. | BCM Pin No. | Generic LPC Name |
|---|---|---|
| 1 | 3.3V | |
| 6 | GND | |
| 7 | 4 | WP# |
| 11 | 17 | RST# |
| 12 | 18 | LCLK |
| 13 | 27 | LFRAME |
| 15 | 22 | LAD0 |
| 16 | 23 | LAD1 |
| 18 | 24 | LAD2 |
| 22 | 25 | LAD3 |