so!! i am excited!!! to have finally finished the complete reimplementation of the #GlasgowInterfaceExplorer memory-25x applet for managing SPI NOR flashes. it is called memory-25q and it took an enormous amount of effort, because i have decided to Build It Properly

want to jump to the docs (there are a lot of docs, including on the fundamentals of (Q)SPI flashes) or read the code? here we go:

now, why did i do that? two reasons. memory-25x is one of the first applets i made, ~7 years ago, and i had no idea what kind of UI i should be building (yet). to make it worse, i thought that SPI NOR flashes were "easy", you could "just send a few bytes and that's basically it".

nothing could be further from truth. first off, SPI NOR flashes don't really exist—there is no spec, no standard organization that can say "no, your thing is not compliant", no order to any of this. every vendor does whatever they want, and then every other year JEDEC writes down all of the unhinged shit they did. here is the list of six incompatible methods to turn a single bit on or off, as a warmup

second, SPI flashes have an absolutely absurd diversity of framings. you cannot even express it without building a meta-framework for abstracting over all the ways people have come up to squeeze 8 bits into 2 or 4 wires. then on top of it you have to manage a bunch of global state that affects framing in subtle or sometimes really fundamental ways, without having any way to find out that you've made an error besides "you compare the actual data with the expected data (or its checksum) and it is not equal"

anyway, the new applet should be excellent at any daily task and at least okay at >90% of the exotic ones. also it's easily generalized for the (completely incompatible on the wire) QSPI NAND 25N series, octal or DTR variants, etc

applet.memory.25q: new applet by whitequark · Pull Request #1130 · GlasgowEmbedded/glasgow

This is a complete functional replacement for the memory-25q applet and it obsoletes and deprecates the latter. To do: figure out why 1-2-2 and 1-4-4 modes are broken not broken, just crosstalk ...

GitHub

@whitequark Just tested dumping a BIOS from a retro PC:

I: g.hardware.assembly: port A voltage set to 3.3 V
I: g.cli: running handler for applet 'memory-25q'
W: g.applet.memory.25q: argument --quad-spi specified, but fastest read mode is 1-1-1
reading: 100%|███...██| 2.00Mi/2.00Mi [00:01<00:00, 1.42MB/s]
I: g.applet.memory.25q: verify PASS

Nice. I think that is the fastest read/verify I ever saw. Thank you! (Used my new Aliexpress press-on "probe", which worked really nice)

@TobiX nice! I see there's no SFDP in it? (what does identify tell you?)

also, reading "retro PC" about something with an SPI flash in it aged me like a decade 💀

@whitequark Retro hardware is relative  (The PlayStation 3 is not retro yet, right... RIGHT?)

identify output: https://paste.ccc.ac/?ed8ab5c12b1926c2#8XH8jyRrmJB15sLb2amkgZvKPML1W62cfjTEsxDyJrWk

CCCAC Paste

Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.

CCCAC Paste

@TobiX oh! wow, dual-only flash

if you pass --dual-spi you should get a ~2x increase in read speed