Flash Magic Forum

In-System Programming Support => ARM Cortex => Topic started by: jashugan on October 22, 2015, 05:03:33 AM

Title: Avoid writing Flash pages
Post by: jashugan on October 22, 2015, 05:03:33 AM
Hello,
I'm using an LPC1114, and I have a program that simulates the flash as an EEprom. The four upper banks are reserved for this use. When I run the bootloader, I would like not to change the values in these four banks, is it possible? At the moment, the program writes entirely the flash.

Thank you,
Mattia Berton
Title: Re: Avoid writing Flash pages
Post by: Andy Ayre on October 27, 2015, 02:03:39 AM
If you look at chapter 26 of the LPC1100 user manual from NXP you will see that there isn't an ISP command for erasing pages. Therefore Flash Magic can't do it.

You can chose which blocks/sectors to erase individually in section 2 of the main window.

Andy
Title: Re: Avoid writing Flash pages
Post by: jashugan on October 27, 2015, 03:00:00 AM
Yes, you're correct, but if I try to upload the new firmware via bootloader, it overwrites the upper banks, used in the program as EEprom emulation, so I lose all information stored.
Is there any way (in the Flashmagic or in the LPCXpresso) to tell the bootloader not to write those banks? Perhaps via the linker file, I don't know. Just for help, I'm attaching the linker file.

Thank you,
Mattia
Title: Re: Avoid writing Flash pages
Post by: Andy Ayre on October 27, 2015, 03:11:14 AM
You can control the memory ranges your firmware uses in your linker configuration. You can control which blocks are erased in Flash Magic. However, you must always erase the blocks used by your firmware.

If you have done something like this:

unsigned char EEPROM[0x1000] _at_ 0xC000;

then your firmware will occupy the memory at 0xC000 to 0xCFFF, and Flash Magic will want to erase it. Instead do:

unsigned char *EEPROM = (unsigned char *)0xC000;

which uses the same memory location but it is unallocated. This is now into the area of programming rather than Flash Magic so for further help with that you might want to check the LPCware forums.

Andy
Title: Re: Avoid writing Flash pages
Post by: jashugan on October 27, 2015, 09:45:26 AM
Ok! I'll try to apply your advice! Thank you.