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

Nico Huber nico.h at gmx.de
Mon Jan 11 21:11:51 CET 2016


Hi rdiez,

On 11.01.2016 14:58, R. Diez 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.
Nice to here.

> 
> The SPI Flash chip can hold 8 MiB of data, but we are only using the
> first 512 KiB of it.
I guess, a very simple patch would be to change the size of the chip in
flashchips.c.

> 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.
flashrom was designed with very low-latency internal programmers in
mind. What makes it slow is the overhead for synchronous USB reads.
This would help to reduce overall read times:
http://www.flashrom.org/pipermail/flashrom/2015-August/013823.html
(Needs to be enabled per chip in flashchips.c)

> 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.
With very short wires, I got my FT2232H up to the full 30MHz once...
Also, sometimes I forget that 6 is a valid divisor between 8 and 4 :)

> 
> 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.
There are some layout patches floating around that would do the trick.
Yeah, more unmerged patches...

> 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.
There is:
http://www.flashrom.org/pipermail/flashrom/2015-December/014034.html

Regards,
Nico




More information about the flashrom mailing list