On a slightly related note...
On older chips, you could program an already-programmed word to something that was bitwise smaller. So for example you could do 0xffff -> 0xfff3 -> 0xfff0 -> 0xff00 -> 0xf000 -> 0x0000. On these chips the specs say that the only allowed "reprogramming" is to value of 0.
I now understand why: each 64-bit word has an 8 bit checksum to do single-error-correct, double-error-detect bit errors. When I try to program 0xfff3-> 0xfff0, it is quite likely that there will be ECC bits that go from 0 -> 1 so the new word cannot be programmed without an erase.
But if there is a 64-bit word that I've programmed with say 60 bits still high, then I can lower a single bit and... it is guaranteed that this will be detected: the ECC word will be different. I can lower another bit and we're in the double-error-detect area: It is guaranteed that the ECC word is different and something checks out "wrong" i.e. it can't be corrected. Change another bit and the ECC word is guaranteed to be wrong, but it would possibly be corrected to a different dataword. Change 4 bits and you're in the territory where you might get a valid word again. Now if my word starts out with 60 bits "1" there are 60*59*58*57/4*3*2*1 possible ways of doing that. I'm betting that about 1/256 of these 487635 (about 1900) have precisely the SAME checksum as the original word. So from a physical point of view, it would be possible to reprogram to one of those 1900 different datawords with the same ECC code.
Now I understand the nightmare that ST would open itself up to if it would specify the ECC code in the datasheet and then publish that it can be done. So I understand the "can't be done" in the datasheet... But would the hardware allow it? My "erase didn't work" always resulted in precisely "0" in the flash location. That would hint at the hardware trying to program it, and if it didn't work (i.e. simply try to program and compare the resulting dataword with the "requested value"), continue to program the new value "0".
If it would compare the current value in flash with the requested new value and error out if there are any 0-> 1 transitions, then I'd find the old value in memory. It looks as if they simply use the "check if programming worked" hardware to forbid the "illegal" transactions. This would mean that it might be possible to reprogram a few times as opposed to what the datasheet says...
Does anybody know the ECC code they use? (I'm guessing they would REALLY like it if 0xffffffffffffffff has ECC 0xff and that 0x0 has ECC 0x0. Not sure if that's possible).