[U-Boot-Users] Overwriting protected flash memory!!!

Wolfgang Denk wd at denx.de
Thu Dec 9 20:22:10 CET 2004


In message <f96d234e04120911001d14d232 at mail.gmail.com> you wrote:
> 
> I have seen this several times over the years while working on
> embedded systems (including U-boot on PXA255 -- I did the same thing
> you did).  If you write random data to flash, chances are you will hit
> a sequence that will corrupt the flash.  All "protecting" flash memory

This has nothing to do with PXA255,  and  happens  only  ith  certain
types  of  flash  chips.  If  you  use  for example AMD chips, then a
special  programming   sequence   must   be   written   to   special,
no-consequtive  addresses.  It is impossible to generate such a write
pattern by copying data sequentially to flash memory. Such chips  are
safe.

> does is require a slightly more complicated sequence of write
> operations to unlock it.

No. Not even that. For most boards, the "protect" feature  in  U-Boot
is  only  a  flag that prevents certain commands from working on such
"protected" flash areas. Only very few flash chips,  and  even  fewer
boards  using  these  chips,  actually  use  some  kind  of  hardware
protection.In most cases,  just  using  a  couple  of  "mm"  or  "mw"
commands  to  enter the erase or program seqence is all what's needed
to erase / corrupt "protected" sectors.

The  "protect"  stuff  is  something  that  is  intended  to  prevent
accidential data loss by a istyped command etc. It cannot protect you
from doing stupid things.

> I slightly more reliable mechanism is to gate the write strobe in
> hardware or some other hardware mechanism, but this is usually not

It is perfectly sufficient to chose a different kind of flash  chips,
that  cannot  be  brought  into  erase  or  protgram  mode by writing
sequential data. If your hardware guys selected such a type of  flash
you  just  get  what  you deserve. There is no protection against bad
design decisions.

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The human race is faced with a cruel choice: work  or  daytime  tele-
vision.




More information about the U-Boot mailing list