/**
 ****************************************************************************************
 *
 * @file map.txt
 *
 * @brief MACSW map file for RefIp platform (aps-gcc).
 *
 * Copyright (C) RivieraWaves 2011-2019
 *
 * $Rev: 5769 $
 *
 ****************************************************************************************
 */
/**
 * @addtogroup PLATFORM_DRIVERS
 * @{
 */


/* Provide default definitions of various SIZE symbols if needed.
   These should normally be defined on the link command line with
        --defsym _STACK_SIZE=xx
   or linked in as part of the program (see memory.c example). */
/* This stack is only used from start until RTOS is started */
_STACK_SIZE = DEFINED(_STACK_SIZE) ? _STACK_SIZE : 300;

MEMORY
{
  program_memory (rx) : org = 0x80000000, len = 512K
  data_memory (!rx): org = 0x00000000, len = 512K
  shared_memory (!rx) : org = 0x60000000, len = 256K
  lamac_memory (!rx) : org = 0x61100000, len = 1024K
  machw_mib_memory (!rx) : org = 0x68300800, len = 4K
}

OUTPUT_FORMAT("aps")
ENTRY(rw_start)

SECTIONS
{
    /* shared RAM */
    SHARED (NOLOAD):
    {
        _sshram = . ;
        *(SHAREDRAMIPC)
        *(SHAREDRAM)
        _eshram = . ;
        _trace_start = .;
        _trace_end = ORIGIN(shared_memory) + LENGTH(shared_memory);
    } > shared_memory

    /* MAC logic analyzer RAM */
    LA (NOLOAD):
    {
        _slarammac = . ;
        *(LARAM)
        _elarammac = . ;
    } > lamac_memory

    /* MAC HW MIBs */
    HW_MIB (NOLOAD):
    {
        _smachw_mib = . ;
        *(MACHWMIB)
        _emachw_mib = . ;
    } > machw_mib_memory

    .text :
    {
       _svect = .;
       KEEP (*(.vectors));
       _evect = .;
     } > program_memory AT > data_memory

    .data :
    {
       _sdata = .;
       /* Space to save 18 registers for debugger */
       PROVIDE(_debugger_register_save_area = .);
       . = . + (18*4);
       *(.sdata*);
       *(.srodata*);
       . = ALIGN(4);
       *(.rodata*);
       . = ALIGN(4);
       *(.data*);
       _edata = .;
       . = ALIGN(0x4);
    } > data_memory

    .bss :
    {
       /* Space for variables not initialized at boot */
       PROVIDE(_unloaded_area_start = .);
       . = . + (1*4);
       PROVIDE(_unloaded_area_end = .);
       PROVIDE(_bss = .);
       *(.sbss*)
       *(.scommon*)
       *(.bss*)
       *(COMMON)
       . = ALIGN(0x4);
       PROVIDE(_ebss = .);
    } > data_memory

    /*********************************************************************************
     * Stack
     *********************************************************************************/
    .stack :
    {
       . = ALIGN(4);
       __stack_bottom = . ;
       . += _STACK_SIZE ;
       __stack_top = .;
       . = ALIGN(4);
       _edata = .;
    } > data_memory

    /*********************************************************************************
     * Code
     *********************************************************************************/
    /* dummy section to align current address in program_memory with current address in data_memory */
    .dummy :
    {
      . = . + SIZEOF(.data) + SIZEOF(.bss) + SIZEOF(.stack);
    } > program_memory

    CODE :
    {
       KEEP (*(.init));
       *boot.o(.text .text.*)
       *(.text .text.* .libgcc);
       . = ALIGN(0x4);
       _etext = .;
     } > program_memory AT > data_memory

     /*********************************************************************************
     * Heap
     *********************************************************************************/
    .heap :
    {
       . = ALIGN(0x4);
       __heap_bottom = . ;
       __heap_top = ORIGIN(data_memory) + LENGTH(data_memory);
    } > data_memory

    /* Stabs debugging sections.  */
    .stab            0 : { *(.stab) }
    .stabstr         0 : { *(.stabstr) }
    .stab.excl       0 : { *(.stab.excl) }
    .stab.exclstr    0 : { *(.stab.exclstr) }
    .stab.index      0 : { *(.stab.index) }
    .stab.indexstr   0 : { *(.stab.indexstr) }
    .comment         0 : { *(.comment) }
    /* DWARF debug sections. */
    .debug           0 : { *(.debug) }
    .line            0 : { *(.line) }
    .debug_srcinfo   0 : { *(.debug_srcinfo) }
    .debug_sfnames   0 : { *(.debug_sfnames) }
    .debug_aranges   0 : { *(.debug_aranges) }
    .debug_pubnames  0 : { *(.debug_pubnames) }
    .debug_info      0 : { *(.debug_info .gnu.linkonce.wi.*) }
    .debug_abbrev    0 : { *(.debug_abbrev) }
    .debug_line      0 : { *(.debug_line) }
    .debug_frame     0 : { *(.debug_frame) }
    .debug_str       0 : { *(.debug_str) }
    .debug_loc       0 : { *(.debug_loc) }
    .debug_macinfo   0 : { *(.debug_macinfo) }
    .debug_weaknames 0 : { *(.debug_weaknames) }
    .debug_funcnames 0 : { *(.debug_funcnames) }
    .debug_typenames 0 : { *(.debug_typenames) }
    .debug_varnames  0 : { *(.debug_varnames) }
    .debug_pubtypes  0 : { *(.debug_pubtypes) }
    .debug_ranges    0 : { *(.debug_ranges) }
    .gnu.attributes  0 : { KEEP (*(.gnu.attributes)) }
    /DISCARD/          : { *(.note.GNU-stack) *(.gnu_debuglink) }
}

