Hi David:
Thanks for your comments.
El 20/04/16 a las 20:42, David Hendricks escribió:
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.
What about writes? My problem is that I have a 4 MiB flash and that usually need to use 32kB from it.
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/
Thanks for the link.
Regards, SET
On Tue, Apr 19, 2016 at 10:48 AM, Salvador Eduardo Tropea <salvador@inti.gob.ar mailto: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 <tel:%28%2B54%2011%29%204724%206300%20ext.%206919> San Martín - B1650KNA FAX: (+54 11) 4754 5194 <tel:%28%2B54%2011%29%204754%205194> Buenos Aires * Argentina _______________________________________________ flashrom mailing list flashrom@flashrom.org <mailto:flashrom@flashrom.org> https://www.flashrom.org/mailman/listinfo/flashrom
-- David Hendricks (dhendrix) Systems Software Engineer, Google Inc.
On Thu, Apr 21, 2016 at 1:41 PM, Salvador Eduardo Tropea < salvador@inti.gob.ar> wrote:
Hi David:
Thanks for your comments.
El 20/04/16 a las 20:42, David Hendricks escribió:
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.
What about writes? My problem is that I have a 4 MiB flash and that usually need to use 32kB from it.
Yes, it works for writes as well. Using your layout file as an example: 00000000:00007e2b fpga 00007e2c:003fffff free
If the eraseblock size is 4KB and you run *"*flashrom -p <programmer> -l layout -i fpga -w foo.bin --fast-verify*"*, chromium's flashrom will: 1. Detect the flash chip. 2. Parse the -i argument 3. Do a partial read. This is broken into a multiple steps. 3a. Determine the "required_erase_size", for example, 4KB. Right now the mechanism is crude and chooses the smallest block size that is eraseable. 3b. Align regions that are read based on required_erase_size. 0000 is already aligned, but 7e2b will be aligned up to 7fff. 3c. Read the aligned region content, which is 0000:7fff instead of 0000:7e2b, into the new content buffer. 4. Copy the new content from the "fpga" region into the new content buffer. 5. Erase and write 0000:7fff 6. Verify from 0000:7fff
Overall it looks pretty similar to what you posted. Here's the original implementation: https://chromium-review.googlesource.com/#/c/240176/ https://chromium-review.googlesource.com/#/c/240176/4. There are a couple of follow-up patches as well, in case you're interested.
One more thing to note - Be careful about interactions with the proposed patch to read the current contents of flash from a file: https://www.flashrom.org/pipermail/flashrom/2015-December/014034.html. Specifically, make sure that the aligned offsets are used for reading old content no matter if the old content is in a flash chip or a file.