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

Mark Deneen mdeneen+arm at saucontech.com
Thu Apr 5 14:39:18 UTC 2012


Is it possible to define the symbol in the linker file?  I think I've seen that done before, but it might have been a Microchip modification to GCC/ld.

-M
----- Original Message -----
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 


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. 



More information about the arm-gnu mailing list