Remember that flash memory cannot be erased in arbitrary areas, but
only in so called "erase regions" or "sectors". If you have U-Boot
running you can use the flinfo
(Flash information,
short fli
) command to print information about the
flash memory on your board, for instance:
=> fli
Bank # 1: AMD AM29LV160B (16 Mbit, bottom boot sect)
Size: 4 MB in 35 Sectors
Sector Start Addresses:
40000000 (RO) 40008000 (RO) 4000C000 (RO) 40010000 (RO) 40020000 (RO)
40040000 40060000 40080000 400A0000 400C0000
400E0000 40100000 40120000 40140000 40160000
40180000 401A0000 401C0000 401E0000 40200000
40220000 40240000 40260000 40280000 402A0000
402C0000 402E0000 40300000 40320000 40340000
40360000 40380000 403A0000 403C0000 403E0000
In the example above, the area 40050000 ... 40050100 lies right in
the middle of a erase unit (40040000 ... 4005FFFF), so you cannot
erase it without erasing the whole sector, i. e. you have to type
=> erase 40040000 4005FFFF
Also note that there are some sectors marked as read-only
((RO)
); you cannot erase or overwrite these
sectors without un-protecting the sectors first (see the U-Boot
protect
command).