Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

How to locate a 'const' in flash

How to locate a 'const' in flash

2006-03-30 by sam_pr

I'm using the EWARM 431

When trying:

const int a = 30;

it locates 'a' in ram. I couldn't find an example where it is defined 
as a flash const.

Please help.

Thanks

Re: How to locate a 'const' in flash

2006-03-30 by ian.scanlon

--- In lpc2000@yahoogroups.com, "sam_pr" <sam_pr@...> wrote:
>
> I'm using the EWARM 431
> 
> When trying:
> 
> const int a = 30;
> 
> it locates 'a' in ram. I couldn't find an example where it is defined 
> as a flash const.
> 
> Please help.
> 
> Thanks
>

Check the linker file (.xcl).  You may be linking the project to load 
in RAM instead of flash. 

There are seperate linker files for RAM and FLASH for most of the parts
This will place code and constants on RAM (at 400000000+)

-DROMSTART=40000040
-DROMEND=40003FFF

This places code and contstants in ROM at 0x00000040:

-DROMSTART=00000040
-DROMEND=0000FFFF         

Ian

Re: [lpc2000] How to locate a 'const' in flash

2006-03-31 by 42Bastian Schick

> I'm using the EWARM 431
> 
> When trying:
> 
> const int a = 30;
> 
> it locates 'a' in ram. I couldn't find an example where it is defined 
> as a flash const.

AFAIK there is no "standard" way to achieve this. But with all the 
different compilers I use,
static const int a = 30;
works.

Or use a pragma to place a into DATA_C (see IAR manual).

-- 
42Bastian

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.