5 years, 7 months ago.

Where is my program stored in Flash Memory ? LPC11U24


I'm using an MBED LPC11U24 board and I was wondering where the program is stored in the 32kB of flash memory. Does it start at 0x000000004 ? If It does, why am I able to write data onto these addresses without overwriting the code? I dont get any errors when I do so


1 Answer

5 years, 7 months ago.

It is simply programmed from the start of your flash, so instead starting at 0, or 0x4. Why you can write there? Why not? No flash protection bits are set, so you can happily overwrite it. I am not sure if the LPC11u24 mbed reprograms itself everytime it is reset, but for sure if you just power it with Vbat it won't do that, so you can write the start of your program, but then it won't run the second time. If you overwrite enough, until you get to the flash which is still used, your program will crash.

Accepted Answer

I'm sorry, I didn't get you. he Mbed data sheet says the program counter starts at 0x00000004. Doesn't that mean that the program is stored from 0x00000004 to 0x0000abcd ?? And so I should not be able to write into these addresses ?

posted by Bharath S 25 Jun 2014

Yes that is where your program will be stored. But why shouldn't you be able to write there?

First of all, how are you trying to write there? Only IAP can write there, if you are trying to directly write there with pointers nothing will happen. If you write there with IAP you should corrupt your program. I happened to have tried it yesterday on the LPC1768, it could happily erase the first flash sector. Of course after a reset it didn't do anything anymore.

posted by Erik Olieman 25 Jun 2014