avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] How to place data in FLASH on GCC 3.2 (avrfreaks)?


From: E. Weddington
Subject: Re: [avr-gcc-list] How to place data in FLASH on GCC 3.2 (avrfreaks)?
Date: Wed, 11 Sep 2002 09:24:09 -0600

> > "Larry Barello" <address@hidden> wrote:
> >
> > > This works under 3.02 (avrfreaks) but fails on 3.2 (experimental)
> because
> > > the data gets placed in SRAM rather than FLASH.
> > >
> > > #define FLASH __attribute__ ((progmem))
> > > typedef struct
> > > {
> > >     ...
> > > } const FLASH SomeStruct;
> > >
> > > SomeStruct MyData = {...};
> > >
> > >
> > > Why?
> >

Larry,

I found that this works:

#define FLASH __attribute__ ((progmem))
 
typedef struct
{
        unsigned char data;
} FLASH const SomeStruct;

SomeStruct MyData = {0x55};
SomeStruct MyData2 = {0xAA};

My map file contains:

 .progmem.data  0x0000008c        0x2 base.o
                0x0000008d                MyData2
                0x0000008c                MyData
                0x0000008e                . = ALIGN (0x2)

I use gcc3.2 experimental.

So it looks like you just have to reorder your declaration and it 
will work.

Eric
avr-gcc-list at http://avr1.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]