EmbeddedRelated.com
Forums

LPC2478 - Store variables directly to FLASH memory

Started by Tomislav February 11, 2010
Hi everyone,

I'm using Gcc compiler 4.1.2 found inside WinARM. I have 64 MB SDRAM and 500k FLASH on my board. I'm using Flash Magic for programming.

I'm looking for a way to store very large constant array directly to FLASH. This array should be preloaded to FLASH, before I start my program. The size of array will be about 200-250k.

Unfortunately, FLASH Magic doesn't have Send File command like SAM-BA has. Can I use const keyword? Is there any other program for this purpose ?

An Engineer's Guide to the LPC2100 Series

Tomislav wrote:
> I'm looking for a way to store very large constant array directly to
> FLASH. This array should be preloaded to FLASH, before I start my
> program. The size of array will be about 200-250k.
>
> Unfortunately, FLASH Magic doesn't have Send File command like SAM-BA
> has. Can I use const keyword? Is there any other program for this purpose ?

I don't know/remember what file formats FLASH Magic supports but if it eats hex
then maybe objcopy will be your friend.

With 'const' you are embedding your variable into the application binary. If
you execute it directly from FLASH, then your variable will be in FLASH too,
which might be what you want. If you first copy your application into the SDRAM
and execute it from there, then you end up copying the variable too, which may
not be what you want. If the latter is your case, you may want to read about
named sections in gcc manual and MEMORY and SECTIONS (especially Output Section
LMA) linker script commands in ld manual.

--

Timo