On Thu, 10 Oct 2013 09:41:19 +0200 flashrom@secure-proxy.org wrote:
Hello,
i try to read SPI flash from a bricked wifi access point. For that purpose I have unsoldered the 4M SPI flash, soldered it onto an ssop-breakout board where I connected it to an Arduino-Nano.
I use flashrom out of my ubuntu distribution, and compiled serprog-duino myself.
Running flashrom to detect the device works as expected:
$ flashrom -p serprog:dev=/dev/ttyUSB0:2000000 flashrom v0.9.5.2-r1517 on Linux 3.2.0-54-generic-pae (i686), built with libpci 3.1.8, GCC 4.6.3, little endian flashrom is free software, get the source code at http://www.flashrom.org
Calibrating delay loop... OK. serprog: Programmer name is "serprog-duino" Found Macronix flash chip "MX25L3205" (4096 kB, SPI) on serprog. No operations were specified.
However when I add the "-r filename" Option, to read the content of the flash, the program get stuck. I tried the master and the ftdi-branch from serprog-duino [the only difference is, that in the ftdi-branch the 10us delay is missing], with no difference in behaviour. I tried both versions with both cabling-recommendations: firsthand with the resistors as voltage-dividers, than with direct 5cm cables.
In all combinations flashrom is hanging during a read-statement.
The strace looks in all cases like (+-5 lines):
write(1, "Note: serprog_delay used, but th"..., 67Note: serprog_delay used, but the programmer doesn't support delay ) = 67 write(3, "\23", 1) = 1 write(3, "\1\0\0\2\0\0\5", 7) = 7 read(3, "\6", 1) = 1 read(3, "\0\0", 2) = 2 mmap2(NULL, 4198400, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7104000 write(1, "Reading flash... ", 17Reading flash... ) = 17 write(3, "\23", 1) = 1 write(3, "\4\0\0\0\0\1\3\0\0\0", 10) = 10 read(3, "\6", 1) = 1 read(3, "'\5\31V\267\205%\3Q\332+\3\0\1\257\10\200 \0\0\200 \0\0\207\312\302\340\5\5\1\0"..., 65536) = 339 […] read(3, "\0\20\4\0\326&\f\0\204\217\2\0\2$L\4\231\217\6\0B\26\244\227\204$\0\0%\226\0\0"..., 17512) = 262 read(3, <===STUCK HERE!!
The Nano is a V3 with Atmega328 and a FT232RL chip.
Any suggestions ?
Looking at the output of -VVV is probably more telling than that wall of syscalls, especially because you say that the log of syscalls is not reproducible. I would assume a problem with the firmware/Arduino, not your cabling.
On a broader scope... it would be useful to have timeouts for those serial reads (and writes). Unfortunately that is not exactly easy/elegant to implement in a cross-platform compatible way.