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

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

Re: [avr-gcc-list] Query regarding hard located variables


From: Scott Finneran
Subject: Re: [avr-gcc-list] Query regarding hard located variables
Date: Tue, 08 Jan 2002 09:44:21 +1100

Hello Anton,

Yes, this is the kind of thing that I am after. However I am unable to
find any examples or doumentation on how to do this. Specifically, I
cannot find examples or instructions on how to do this for a single
variable (or even a single file... I can put the "magic" variable in a
file on it's own).

Does anyone have an example that they can point me towards (or send)
which shows how to put a variable or a file into a specific section in
RAM?


Kind Regards,

Scott

Anton Erasmus wrote:
> 
> Date sent:              Mon, 07 Jan 2002 13:33:05 +1100
> From:                   Scott Finneran <address@hidden>
> Organization:           Smart Container
> To:                     avr-gcc-list <address@hidden>
> Subject:                [avr-gcc-list] Query regarding hard located variables
> 
> > Hello All,
> >
> > I would have thought that the following would be a more commonly asked
> > (and therefore answered) question. I can only assume that I am
> > searching for the info in the wrong place or using the wrong keywords.
> > If so, then I apologise in advance.
> >
> > I would like to know how to hard locate a variable using gcc and/or
> > the gnu linker. The hardware that I am using has a number of memory
> > mapped hardware registers. Obviously I would like to avoid having the
> > linker drop variables into memory addresses where these registers
> > live. It would also be nice to be able have variables (of my choosing)
> > be located at these addresses. Of course the latter can be easily
> > achieved with a pointer. Many commercial embedded compilers provide a
> > compiler specific directive such as: eg int reg1 _at(0x4000);
> >
> > Others simply allow you to specify the location of specific variables
> > in linker scripts.
> >
> > I have seen many websites and articles (eg from embedded.com) talk
> > about doing this. Many more say that it is possible. None of them
> > (that I have found) say how, or even better give an example.
> >
> > Can anyone point me to some info or alternatively show me how this is
> > done?
> >
> 
> Hi,
> 
> You can put each variable in it's own named section with the
> "attribute section" command of gcc. In your linker script you can
> define the address of each section. I am not sure how many
> sections the linker can handle.
> 
> Regards
>    Anton
avr-gcc-list at http://avr1.org



reply via email to

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