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

JM hondgm at yahoo.com
Wed Apr 4 16:33:56 UTC 2012


Hello

I've researched this, asked on other forums, and so far I'm no closer.  

I'm trying to place a variable at a specific address in RAM on a TI ARM Cortex-M3.  I have good reason for doing so, which I can explain briefly:

The micro I'm using, LM3S9B92 has a DMA controller.  There are 32 DMA channels and each channel requires a 16 byte struct in RAM for housekeeping.  These 32 structs are placed into an array, which is 512 bytes if you do the math, and must be placed on a 1024 byte boundary.  Now....the datasheet indicates that the RAM for unused DMA channels can be used for something else.  I'm using only one DMA channel, which is near the end of the list.  If it were near the beginning, this would be easier to recover at least some of the wasted RAM by simply not making the array 32 members long.

So what I want to do is reserve 16 bytes of RAM at a strategic location.  It must be 464 bytes from a 1024 byte boundary.  This I believe will allow the lone DMA channel to function and not allocate unused RAM.

I believe this will involve the linker script, and possibly Makefile.  I'm ok with Makefile modifications.  The linker file I'm almost clueless on.  Any ideas?  My current linker file is below:

MEMORY
{
    FLASH (rx) : ORIGIN = 0x00001000, LENGTH = 252K
    SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 96K
}

SECTIONS
{
    .text :
    {
        KEEP(*(.isr_vector))
        *(.text*)
        *(.rodata*)
        _etext = .;
    } > FLASH

    .data : AT (ADDR(.text) + SIZEOF(.text))
    {
        _data = .;
        *(vtable)
        *(.data*)
        _edata = .;
    } > SRAM

    .bss(NOLOAD) :
    {
        _bss = .;
        *(.bss*)
        *(COMMON)
        _ebss = .;
        . = ALIGN (8);
       _end = .;
    } > SRAM
}

/* end of allocated ram _end */
PROVIDE( _HEAP_START = _end );

/* end of the heap -> align 8 byte */ 
PROVIDE ( _HEAP_END = ALIGN(ORIGIN(SRAM) + LENGTH(SRAM),8) );
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sourcerytools.com/pipermail/arm-gnu/attachments/20120404/f704b899/attachment.html>


More information about the arm-gnu mailing list