Topic: Next big step - read/write flash for mere humans

After playing with Fernvale tools (fernly specifically) for few days, it becomes clear that the last missing piece to be able to claim that Fernvale basic functionality matches that of Arduino is ability to dump flash ROM contents, and program it back with original contents and own code. Of course, it's clear that @bunnie and @xobs did all that. Maybe for them, current functionality of fernly is equivalent of having that support. Unfortunately, for folks with less experience, being able to submit raw SPI commands doesn't really help to get their flash dumped.

So, guys, if you have any code, please share it! If not, please provide info/hints/references on how to do that - other folks will write easy to use tools. Thanks.

Re: Next big step - read/write flash for mere humans

It's a standard SPI flash device, and rather than try and figure out the intricacies of SPI, I just used the "flashrom" program.  Hence the command "spi flashrom".

A patch to add support for Fernvale is available at http://bunniefoo.com/xobs/add-fernvale.patch but this should probably be pushed upstream, or moved somewhere more reliable.

Patch their svn with "patch -p0 < add-fernvale.patch"

Re: Next big step - read/write flash for mere humans

Thanks for the info and patch!

Re: Next big step - read/write flash for mere humans

This "flashrom" tool is a joke - it wants to enumerate all possible flash chips in the world, and refuses to work with those it doesn't know personally by id - as if there were no way to query the geometry (maybe nowadays it's indeed not possible, unlike before with classic NAND flash, call it progress). When it doesn't recognize a chip, it dumps completely dumb message, making you think there's problem with communication, unless you run it with --verbose and can see real bytes for yourself. No progress indicator during operations. Dumping 16MB takes 8.5min.

All in all, I dumped mine twice, and results are stable. (Device requires poweroff between tries due to https://github.com/xobs/fernly/issues/21).

It took me 7 months to do flash dump for my device, so it's not really "for mere humans" yet. I'll try to write up instructions and submit pullreq for fernly.

Re: Next big step - read/write flash for mere humans

Ok, flashrom instructions and patch are now available in fernly repo: https://github.com/xobs/fernly/commit/f … c8908ff869 . Thanks xobs!

Re: Next big step - read/write flash for mere humans

Reviving an old thread here, but I'm able to successfully read a 4MB flash (GD25LQ32) from a MT6261-based system, but when I try to write it hangs. Any ideas?

Re: Next big step - read/write flash for mere humans

This is what flashrom says with the verbose option, so none of the block protect bits are set:

Probing for GigaDevice GD25LQ32, 4096 kB:   Wrote 1 bytes: 9f   Reading 3 bytes: 0xc8: 0x60: 0x16:  Read 3 bytes: c8 60 16 
probe_spi_rdid_generic: id1 0xc8, id2 0x6016
Found GigaDevice flash chip "GD25LQ32" (4096 kB, SPI) on fernvale_spi.
  Wrote 1 bytes: 05   Reading 2 bytes: 0x00: 0x00:  Read 2 bytes: 00 00 
Chip status register is 0x00.
Chip status register: Status Register Write Disable (SRWD, SRP, ...) is not set
Chip status register: Block Protect 4 (BP4) is not set
Chip status register: Block Protect 3 (BP3) is not set
Chip status register: Block Protect 2 (BP2) is not set
Chip status register: Block Protect 1 (BP1) is not set
Chip status register: Block Protect 0 (BP0) is not set
Chip status register: Write Enable Latch (WEL) is not set
Chip status register: Write In Progress (WIP/BUSY) is not set

Re: Next big step - read/write flash for mere humans

Finally got writing working with urjaman's fernly flashrom interface. See https://www.kosagi.com/forums/viewtopic … 3132#p3132

This fernvale flashrom patch would read from flash just fine, but writing failed with a stall after a few hundred bytes. Strangely enough crafting a file consisting of only 0x00 or only 0xFF (e.g. dd if=/dev/zero bs=4M count=1) would write fine, so something buggy going on there.