[arm-gnu] Placing variable at absolute address in RAM

JM hondgm at yahoo.com
Thu Apr 5 16:40:04 UTC 2012


I have come across that one a few times, but it doesn't reserve memory. 



________________________________
 From: Moses McKnight <moses at texband.net>
To: JM <hondgm at yahoo.com> 
Sent: Thursday, April 5, 2012 11:45 AM
Subject: Re: [arm-gnu] Placing variable at absolute address in RAM
 
with a quick search I came up with the following link (among many others):
http://stackoverflow.com/questions/4067811/how-to-place-a-variable-at-a-given-absolute-address-in-memory-with-gcc

This is the way it is done in the CMSIS headers and in the device 
headers for the LPC chips I'm using.

Moses

On 04/05/2012 09:37 AM, JM wrote:
> The only reason I mentioned about GCC not making it easy is that
> apparently at least one compiler makes it easy. I'm so jealous!
>
> With the RealView ARM C Compiler, you may use either pointer definitions
> (as shown above) or *__attribute__((at(/address/)))* keyword to define a
> variable at a fixed memory address. In contrast to the pointer
> construct, the following definition also makes a correct memory
> reservation, so that the area cannot be used twice.
>
> int var __attribute__((at(0x40001000)));
>
>
> ------------------------------------------------------------------------
> *From:* 42Bastian <list-bastian.schick at sciopta.com>
> *To:* arm-gnu at codesourcery.com
> *Sent:* Thursday, April 5, 2012 10:23 AM
> *Subject:* Re: [arm-gnu] Placing variable at absolute address in RAM
>
>
>  > I had no idea this would be so difficult, but apparently GCC doesn't
>  > make this easy, unlike other compilers. Since I'm using the lite
>  > (free) compiler, buying one really isn't an option for hobby use.
>
> The problem is complicated. GCC makes it as easy as other compilers to
> place a variable somewhere.
> Your constraints (not wasting RAM) makes is complicated.
>
> Try (untested):
>
> . = ALIGN(1024);
> dma_ring = .;
> /* place some data here e.g.*/
> test.o(.data .bss)
> toto.o(.data .bss)
> dma_eof_data = .;
> dma_desc = dma_ring+464;
> . = dma_desc+16;
> /* place more stuff */
>
> Check the map file, that dma_desc is >= dma_eof_data.
>
> --
> 42Bastian
> +
> | http://www.sciopta.com
> | Fastest direct message passing kernel.
> | IEC61508 certified.
> +
> _______________________________________________
> arm-gnu mailing list
> arm-gnu at codesourcery.com <mailto:arm-gnu at codesourcery.com>
> http://sourcerytools.com/cgi-bin/mailman/listinfo/arm-gnu
>
>
>
>
> _______________________________________________
> arm-gnu mailing list
> arm-gnu at codesourcery.com
> http://sourcerytools.com/cgi-bin/mailman/listinfo/arm-gnu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sourcerytools.com/pipermail/arm-gnu/attachments/20120405/72fc7631/attachment.html>


More information about the arm-gnu mailing list