[flashrom] flashrom as programmer slow because it reads the whole SPI Flash contents before writing anything

Stefan Tauner stefan.tauner at alumni.tuwien.ac.at
Mon Jan 11 20:50:17 CET 2016


On Mon, 11 Jan 2016 14:58:12 +0100
"R. Diez" <rdiezmail-flashrom at yahoo.de> wrote:

> Hi all:
> 
> I am trying to use flashrom with a fast generic FTDI FT2232H adapter as 
> an SPI Flash programmer in a small production line.
> 
> The SPI Flash chip can hold 8 MiB of data, but we are only using the 
> first 512 KiB of it.
> 
> I found flashrom to be surprisingly slow. I started digging and the step 
> "Reading old flash chip contents..." is taking minutes. It looks like 
> flashrom is reading the whole contents before writing anything at all.
> 
> I am using 7.5 MHz at the moment. I cannot pump up the frequency too 
> much, as I am still using flywires to connect the SPI flash chip to the 
> programmer.
> 
> I know that the flash chips are empty (0xFF), so flashrom does not need 
> to read anything beforehand. If it is going to read anything, the first 
> 512 KiB would suffice, because I am not touching anything else.
> 
> I found the following in the source code:
> 
>    int read_all_first = 1; /* FIXME: Make this configurable. */
> 
> I also found the following message about it:
> 
>    http://www.flashrom.org/pipermail/flashrom/2011-December/008440.html
> 
> I guess the corresponding command-line argument is still missing.
> 
> I cannot tell how hard it would be to code and test the missing parts. 
> The "Development Guidelines" are several pages long. There are very many 
> unmerged patches in the pipeline, and some of them are years old. The 
> repository is in Subversion. In summary, not very encouraging.
> 
> Does anybody know of some fork or alternative that does not read 
> everything before writing any data at all?
> 
> Please copy me on any answers because I am not subscribed to the mailing 
> list.
> 

The reading serves a purpose (more than one actually)... one that does
not give an advantage in your case though. flashrom can decide which
blocks need to be rewritten and which can be left alone after reading
the initial contents. This actually speeds up the process dramatically
in many use cases.
flashrom also reads the whole chip after writing to verify everything
is fine which would slow you down even further. That's the way it is
and it won't change anytime soon but we are aware of it.

-- 
Kind regards/Mit freundlichen Grüßen, Stefan Tauner




More information about the flashrom mailing list