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: Anton Erasmus
Subject: Re: [avr-gcc-list] Query regarding hard located variables
Date: Mon, 7 Jan 2002 18:30:40 +0200

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]