cfi_cmdset_0002 and writes
Bjorn Wesen
bjorn.wesen at axis.com
Thu Jul 19 13:44:37 EDT 2001
On Wed, 18 Jul 2001, Tim Hockin wrote:
> Right, but this is our boot ROM we're dealing with :) Can you suggest a
> better alternative? The device is rarely ever loaded, but when it is
> loaded we want to read and re-program the whole thing as safely as
> possible.
If you have the space or can make space, the standard way is to
double-buffer the sector in question. Write a new one at a spare sector
with a checksum and sequence number, then after that erase the first
one. So if it crashes you always have at least one sane copy.
If your code requires one sector, and you have a flash with at least 3
sectors, put code to choose the sane sector in sector 0 (the one which is
booted) and use sectors 1 and 2 for the boot code itself. And never update
sector 0 :)
/Bjorn
More information about the linux-mtd
mailing list