/*------------------------------------------------------------------------------
 *      Linker script for running in internal SRAM on the AT91SAM9260
 *----------------------------------------------------------------------------*/

OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(entry)

MEMORY
{
	flash (RX)   : ORIGIN = 0x00000000, LENGTH = 0xC0000
    sram0 (W!RX) : ORIGIN = 0x80000000, LENGTH = 0x8000
    sram1 (W!RX) : ORIGIN = 0x80008000, LENGTH = 0x4000
}

SECTIONS
{  
    .fixed0 :
    {
        . = ALIGN(4);
        _sfixed0 = .;
        *(.vectors)
        *(.text*)
        *(.rodata*)
        . = ALIGN(4);
        _efixed0 = .;
        _efixed = .;
    } >flash

	.fixed1 :
	{
        *(.ramfunc)
        *(.data)
	} >sram0

    .prerelocate : AT (_efixed)
    {
        . = ALIGN(4);
        _sprerelocate = .;
        . = ALIGN(4);
        _eprerelocate = .;
    }

    .postrelocate : AT (_efixed + SIZEOF(.prerelocate))
    {
        . = ALIGN(4);
        _spostrelocate = .;
        . = ALIGN(4);
        _epostrelocate = .;
    }

    .bss (NOLOAD) : {
        _szero = .;
        *(.bss)
        . = ALIGN(4);
        _ezero = .;
    } >sram1
    
    _sstack = 0x8000C000;
}
end = .;

