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

JM hondgm at yahoo.com
Thu Apr 5 14:37:02 UTC 2012


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
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/6cfcab7c/attachment.html>


More information about the arm-gnu mailing list