Hello Salvador,
Yes, this is a very useful feature - we've had it in the chromiumos branch for a while now :-)

I need to read your implementation. Ours is called "fast-verify" which will read and only verify portions of the flash specified with -i arguments.

It will also restore content surrounding regions (to address Michael's concern) by aligning the bytes read with the erase size. So if you wish to change a small amount of content within an eraseable block, the entire block will be read and erased. The region specified with -i will be written with new content, and the remaining bytes within the block will have the old content restored.

Here's our tree in case you'd like to take a look: https://chromium.googlesource.com/chromiumos/third_party/flashrom/


On Tue, Apr 19, 2016 at 10:48 AM, Salvador Eduardo Tropea <salvador@inti.gob.ar> wrote:
Hi All!

Now I'm using an FPGA board with 4 MiB of flash, was using one with 128 kiB. So now the time to read/write/verify the whole memory is enough to annoy me ;-)
So I tried creating a layout like this:

<--
00000000:00007e2b fpga
00007e2c:003fffff free
<--

Note: yes only 32300 bytes used, the rest can be used for other purposes (0,77%).

And then I used "-i fpga".
But it didn't help ... flashrom read the 4 MiB twice (one at the beggining and another for the verification).
Looking at the code I found a variable named read_all_first with a comment about the lack of implementation.
So I implemented the needed code to:
1) Add a command line option to make it 0 (avoiding the big reads). This option can be used only when at least one image is indicated with -i
2) Skip the big read when read_all_first is 0. Only the regions indicated by the user are actually fetched from the memory.
3) Same for the verification stage.

Additionally I added a command line option to show the progress, very usefull for big memories (and impatient users ;-).

Are these additions desired in the project? If yes: I want to discuss the implementation details. If no: I'll just keep them for my use.

Regards, SET

--
Ing. Salvador Eduardo Tropea          http://utic.inti.gob.ar/
INTI - Micro y Nanoelectrónica (CMNB) http://www.inti.gob.ar/
Unidad Técnica Sistemas Inteligentes  Av. General Paz 5445
Tel: (+54 11) 4724 6300 ext. 6919     San Martín - B1650KNA
FAX: (+54 11) 4754 5194               Buenos Aires * Argentina





_______________________________________________
flashrom mailing list
flashrom@flashrom.org
https://www.flashrom.org/mailman/listinfo/flashrom



--
David Hendricks (dhendrix)
Systems Software Engineer, Google Inc.