Avoid writing Flash pages

Started by jashugan, October 22, 2015, 05:03:33 AM

Previous topic - Next topic

jashugan

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

Andy Ayre

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
Embedded Systems Academy, Inc.
support at esacademy dot com

jashugan

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

Andy Ayre

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
Embedded Systems Academy, Inc.
support at esacademy dot com

jashugan

Ok! I'll try to apply your advice! Thank you.