MEMORY {

// 20KB of 32 bit internal RAM starting at 0x20000000

    dram_rsvd1   : ORIGIN = 0x20000000, LENGTH = 0
    dram_memory  : ORIGIN = .,	        LENGTH = 20k
    dram_rsvd2   : ORIGIN = ., 	        LENGTH = 0

// 128KB flash starting at 0x08000000

    flash_rsvd1  : ORIGIN = 0x08000000, LENGTH = 0
    flash_memory : ORIGIN = .,          LENGTH = 128k
    flash_rsvd2  : ORIGIN = .,          LENGTH = 0

}
DEFAULTS {

    stack_reserve = 1K
    heap_reserve = 1K

}
//
// Program layout for running out of RAM.
//
//

SECTIONS
{
// The M3vectorTable symbol used here is defined in the 
// Board initialization library and contains the reset vector
// telling the processor where to begin executing code after reset.
// This reset vector needs to be written to the base address of flash.
    M3vectorTable 					: > dram_memory
//
// The text segment
//

    .picbase                                            : > .
    .text                                               : > .
    .syscall                                            : > .
    .intercall                                          : > .
    .interfunc                                          : > .
    .fixaddr                                            : > .
    .fixtype                                            : > .
    .rodata                                             : > .
    .secinfo                                            : > .

//
// The data segment
//

    .pidbase                                  ALIGN(16) : > .
    .sdabase                                            : > .
    .sbss                                               : > .
    .sdata                                              : > .
    .data                                               : > .
    .bss                                                : > .
    .ghcovfz                                      CLEAR : > .
    .ghcovcz                                      CLEAR : > .
    .ghcovdz                                      CLEAR : > .
    .heap                   ALIGN(16) PAD( heap_reserve +
	    // Add space for call-graph profiling if used:
	    (isdefined(__ghs_indgcount)?(2000+(sizeof(.text)/2)):0) +
	    // Add estimated space for call-count profiling if used:
	    (isdefined(__ghs_indmcount)?10000:0) )
	    						: > .
    .stack                 ALIGN(16) PAD(stack_reserve) : > .
//
// These special symbols mark the bounds of RAM and ROM memory.
// They are used by the MULTI debugger.
//
    __ghs_romstart  = MEMADDR(flash_rsvd1);
    __ghs_romend    = MEMENDADDR(flash_rsvd2);
    __ghs_ramstart  = MEMADDR(dram_rsvd1);
    __ghs_ramend    = MEMENDADDR(dram_rsvd2);

// This special symbol marks the fist THUMB mode instruction. 
// It is used in the board_initialization library.
    __ghs_rombootcodeTstart  = _start_T | 1;
    
}
