I made this post as a addition or supplement to my “Flashing a BIOS chip with an Arduino” post.
While doing some research online I found several articles/posts from people using a Raspberry Pi to flash SPI flash chips. Apparently the Raspberry Pi is very suitable for this kind of thing as it has a SPI interface and is able to run linux. I was eager to try this out for myself so I got out my Pi 3 model B and got to work. For this project I used a Winbond 25X80 salvaged from a motherboard I had lying around.
Preparing the RaspberryPi
As others have pointed out, the latest version of Raspbian (Stretch) will also work by adding the spispeed param to the Flashrom command.
Enable the SPI interfaces by typing sudo raspi-config and selecting P4 SPI under the Interfacing options.


The SPI interfaces will become available under /dev/spidev0.0 and /dev/spidev0.1.
Next we install the packages are needed by Flashrom by using the following command.
sudo apt install git libpci-dev libusb-1.0 libusb-dev
Make and install Flashrom.
git clone https://github.com/flashrom/flashrom.git cd flashrom make && sudo make install
Connecting the Raspberry to the SPI flash chip
The table below show the connections between the RaspberryPi and the chip.
RPi pin | SPI flash |
---|---|
25 | GND |
24 | CS |
23 | SCK |
21 | DO |
19 | DI |
17 | VCC 3.3V and /HOLD and /WP |
Flashing the chip
In order to verify Flashrom correctly identifies the chip we run Flashrom without any operations.
pi@raspberrypi:~ $ flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=512 flashrom p1.0-76-g291764a on Linux 4.14.34-v7+ (armv7l) flashrom is free software, get the source code at https://flashrom.org Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). Found Winbond flash chip "W25X80" (1024 kB, SPI) on linux_spi. No operations were specified.
Now that Flashrom correctly identifies the Winbond W25X80 we can continue to backup the current BIOS.
pi@raspberrypi:~ $ flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=512 -r flash.dat flashrom p1.0-76-g291764a on Linux 4.14.34-v7+ (armv7l) flashrom is free software, get the source code at https://flashrom.org Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). Found Winbond flash chip "W25X80" (1024 kB, SPI) on linux_spi. Reading flash... done.
After backing up the old BIOS we can safely write the new BIOS back to the chip.
pi@raspberrypi:~ $ flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=512 -w flash.dat flashrom p1.0-76-g291764a on Linux 4.14.34-v7+ (armv7l) flashrom is free software, get the source code at https://flashrom.org Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). Found Winbond flash chip "W25X80" (1024 kB, SPI) on linux_spi. Reading old flash chip contents... done. Erasing and writing flash chip... Warning: Chip content is identical to the requested image. Erase/write done.
References:
- https://github.com/flashrom/flashrom
- https://www.flashrom.org/RaspberryPi
- http://dalincom.ru/datasheet/W25X80.pdf