flashrom icon indicating copy to clipboard operation
flashrom copied to clipboard

Long Reading and Verifying on Rpi ft2232h W25Q128.V (~4m30s 16MB file)

Open yogggoy opened this issue 5 years ago • 1 comments

Hello, i have trouble with programming falsh, because writing bin file is soo long.

real time delay is reading and verify procedure

Reading old flash chip contents     - ~2m12s
Erasing and writing flash chip      -    ~1s
Verifying flash                     - ~2m12s

my system:

pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.14.34-v7+ #1110 SMP Mon Apr 16 15:18:51 BST 2018 armv7l GNU/Linux
pi@raspberrypi:~ $ lsusb
Bus 001 Device 080: ID 0403:6010 Future Technology Devices International, Ltd FT2232C Dual USB-UART/FIFO IC
Bus 001 Device 104: ID 0403:6014 Future Technology Devices International, Ltd FT232H Single HS USB-UART/FIFO IC
Bus 001 Device 047: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 046: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

try write bin 16MB file ===============WRITE BIN

pi@raspberrypi:~/codes/ire_028 $ ls -l full_write_file.bin
-rw-r--r-- 1 pi pi 16777216 Jan 16 22:40 full_write_file.bin


pi@raspberrypi:~/codes/ire_028 $ time sudo flashrom -p ft2232_spi:type=2232H,port=A -c W25Q128.V -w full_write_file.bin
flashrom v0.9.9-r1954 on Linux 4.14.34-v7+ (armv7l)
flashrom is free software, get the source code at https://flashrom.org

Calibrating delay loop... OK.
Found Winbond flash chip "W25Q128.V" (16384 kB, SPI) on ft2232_spi.
Reading old flash chip contents... done.
Erasing and writing flash chip... Erase/write done.
Verifying flash... VERIFIED.

real    4m25.709s
user    0m10.647s
sys     0m20.407s
===============READ BIN
pi@raspberrypi:~ $ time sudo flashrom -p ft2232_spi:type=2232H,port=A -c W25Q128.V -r read_file.bin
flashrom v0.9.9-r1954 on Linux 4.14.34-v7+ (armv7l)
flashrom is free software, get the source code at https://flashrom.org

Calibrating delay loop... OK.
Found Winbond flash chip "W25Q128.V" (16384 kB, SPI) on ft2232_spi.
Reading flash... done.

real    2m13.035s
user    0m4.688s
sys     0m11.183s

pi@raspberrypi:~/codes/ire_028 $ ls -l read_file.bin
-rw-r--r-- 1 root root 16777216 Jan 16 22:38 read_file.bin

layout image burn is same effect:

===============WRITE BIN layout image
pi@raspberrypi:~/codes/ire_028 $ ls -l layout_write_file.bin
-rw-r--r-- 1 pi pi 16777216 Jan 16 22:52 layout_write_file.bin

pi@raspberrypi:~/codes/ire_028 $ cat rom.layout
00000000:00100000 image_one

pi@raspberrypi:~/codes/ire_028 $ time sudo flashrom -p ft2232_spi:type=2232H,port=A -c W25Q128.V -l rom.layout -i mprime -w layout_write_file.bin
flashrom v0.9.9-r1954 on Linux 4.14.34-v7+ (armv7l)
flashrom is free software, get the source code at https://flashrom.org

Using region: "mprime".
Calibrating delay loop... OK.
Found Winbond flash chip "W25Q128.V" (16384 kB, SPI) on ft2232_spi.
Reading old flash chip contents... done.
Erasing and writing flash chip... Erase/write done.
Verifying flash... VERIFIED.

real    4m25.941s
user    0m10.555s
sys     0m22.149s

thanks !

yogggoy avatar Jan 16 '20 20:01 yogggoy

I'm using the buspirate programmer and it is reading/erasing/writing/verifying the 16Mb image for the W25Q128.V for about 4 hours now and it is still not done :) I'd say your programmer is FAST!

From what I understand how flashrom works the above behavior makes sense to me.

Looking at the time (~ 1s) it takes for erase/write step for you it seems like the chip and the bin file are identical; this step does not do actual erase/write for you. Flashrom is smart enough to read the chip compare the read bytes to the binary you are trying to write and decides if (possibly long) erase/write cycles need to happen.

As with the case where you are using layout, I would not expect any difference in performance since you are defining a single image in the layout that take up the whole chip space (essentially the same effect as not using layout at all).

hinxx avatar Oct 08 '21 10:10 hinxx