protected flash

I’ve been fighting gdb and open_ocd server all day and NOW –

All of a sudden I can’t write to flash after an erase.

flash erase 0 0 7

flash write 0 main.bin 0

flash program error

wrote file main.bin to flash bank 0 at offset 0x00000000

I just ran over 4K in program size but it looks like bank 0 is covered to 262K (lpc2103)

flash banks

#0: lpc2000 at 0x00000000, size 0x00040000, buswidth 0, chipwidth 0

#1: cfi at 0x80000000, size 0x00400000, buswidth 2, chipwidth 2

I also discovered this:

flash info 0

#1: lpc2000 at 0x00000000, size 0x00040000, buswidth 0, chipwidth 0

#0: 0x00000000 (0x2000kB) not erased, protected

#1: 0x00002000 (0x2000kB) erased, protected

#2: 0x00004000 (0x2000kB) erased, protected

#3: 0x00006000 (0x2000kB) erased, protected

#4: 0x00008000 (0x2000kB) erased, protected

#5: 0x0000a000 (0x2000kB) erased, protected

#6: 0x0000c000 (0x2000kB) erased, protected

#7: 0x0000e000 (0x2000kB) erased, protected

#8: 0x00010000 (0x10000kB) not erased, protected

#9: 0x00020000 (0x10000kB) not erased, protected

#10: 0x00030000 (0x2000kB) not erased, protected

#11: 0x00032000 (0x2000kB) not erased, protected

#12: 0x00034000 (0x2000kB) not erased, protected

#13: 0x00036000 (0x2000kB) not erased, protected

#14: 0x00038000 (0x2000kB) not erased, protected

#15: 0x0003a000 (0x2000kB) not erased, protected

#16: 0x0003c000 (0x2000kB) not erased, protected

#17: 0x0003e000 (0x2000kB) not erased, protected

Did the bank somehow get protected and is no longer usable?

I don’t know how to interpret the above information versus the Philips manual regarding sectors, so if anyone has a clue, let me know.

Any help will be much appreciated. Thanks.

Hi,

the sectors are listed as protected because LPC sectors are always “protected”. The flash erase/write code unprotects each sector that should be written, so you can just ignore the “protected” status.

Sector 0 will only be reported as erased when you’ve set the memory map to map flash at 0x0. After a reset, the on-chip boot rom maps its first 64 byte at 0x0.

Please send me the debug log (run with -d -l ) to Dominic.Rath@gmx.de, together with the exact config file used and the telnet commands you’ve entered. If possible (i.e. no sensitive data), the main.bin you’ve used would be useful, too, otherwise just tell me its exact size.

Regards

Dominic