[openfirmware] r1015 - dev/olpc/spiflash

svn at openfirmware.info svn at openfirmware.info
Thu Dec 4 10:17:55 CET 2008


Author: wmb
Date: 2008-12-04 10:17:55 +0100 (Thu, 04 Dec 2008)
New Revision: 1015

Modified:
   dev/olpc/spiflash/spiui.fth
Log:
Erase SPI FLASH blocks just before writing them, as weak protection
against bricking.

Modified: dev/olpc/spiflash/spiui.fth
===================================================================
--- dev/olpc/spiflash/spiui.fth	2008-12-04 09:17:50 UTC (rev 1014)
+++ dev/olpc/spiflash/spiui.fth	2008-12-04 09:17:55 UTC (rev 1015)
@@ -16,15 +16,10 @@
 mfg-data-offset /flash-block +  constant mfg-data-end-offset
 
 : write-flash-range  ( adr end-offset start-offset -- )
-   ." Erasing" cr
-   2dup  ?do
-      i .x (cr  i flash-erase-block
-   /flash-block +loop  ( adr end start )
-   cr                  ( adr end start )
-   
    ." Writing" cr
    ?do                ( adr )
       i .x (cr                           ( adr )
+      i /flash-block mod 0=  if  i flash-erase-block  then
       dup  /chunk  i  flash-write        ( adr )
       /chunk +                           ( adr' )
    /chunk +loop       ( adr )




More information about the openfirmware mailing list