**** Advance Notice ****

This site will be closed on 31 December 2015,

Important Information for users of NXP LPCXpresso

This site is for users of Code Red branded products.

NXP LPCXpresso users should visit the LPCXpresso FAQ's for up-to-date information relevant to that product.

How to reserve space in Flash

StellarisWare provides functions to read/write data into flash to provide persistant data for the application. This entry describes how to reserve space in the flash, to prevent it being used by the application code and data.

We suggest that you the top of flash memory is reserved for your persistent data.

To stop Red Suite from using the reserved area it must be excluded from the linker scripts memory map. By default, Red Suite manages the linker script, but to reserve space, you must manually edit and maintain the linker script. Note that in Stellaris chips, flash is managed in 1K pages, and so you will need to reserve the space in 1K blocks.

The changes required to an existing project are described below. The following example is for a 6965, but the principle is the same for any part.

1. Stop Red Suite managing the linker script. By default Red Suite will generate the linker script whenever the project changes.

     FLASH (rx) : ORIGIN = 0x0, LENGTH = 0x40000 - 0x800
    0x40000 is the size of the flash on a 6965, and
    0x800 (2048) is the amount you wish to reserve

Now, when you build your application, the top 2k of flash will be reserved.

  1. If you wanted to have a pointer to this in C, you can do the following:
  2. create a RESERVED_FLASH memory region. Between the FLASH and SRAM line in the MEMORY configurtion, add:

    RESERVED_FLASH (rx) : ORIGIN = 0x40000 - 0x800, LENGTH = 0x800

    .reserved_flash :
        _reservedFlashStart = . ;

This defines a section called ".reserved_flash" and defines a symbol "_reservedFlashStart" in it, and locates it in the RESERVED_FLASH region.

extern void _eReservedFlashStart ;
void *ptr = &_reservedFlashStart ;

ReserveFlash (last edited 2009-02-13 18:30:45 by DerekMorris)