summaryrefslogblamecommitdiffstats
path: root/c/src/lib/libbsp/m68k/genmcf548x/startup/linkcmds.COBRA5475
blob: 468c41abb4be650b73a5c4197734e36933c98c90 (plain) (tree)





































































































































































































































                                                                                          
/*===============================================================*\
| Project: RTEMS generic mcf548x BSP                              |
+-----------------------------------------------------------------+
| File: linkcmds.COBRA5475                                        |
+-----------------------------------------------------------------+
| The file contains the linker directives for the generic MCF548x |
| BSP to be used with an COBRA5475 board to load and execute      |
| code in the RAM.                                                |
+-----------------------------------------------------------------+
|                    Copyright (c) 2007                           |
|                    Embedded Brains GmbH                         |
|                    Obere Lagerstr. 30                           |
|                    D-82178 Puchheim                             |
|                    Germany                                      |
|                    rtems@embedded-brains.de                     |
+-----------------------------------------------------------------+
|                                                                 |
| Parts of the code has been derived from the "dBUG source code"  |
| package Freescale is providing for M548X EVBs. The usage of     |
| the modified or unmodified code and it's integration into the   |
| generic mcf548x BSP has been done according to the Freescale    |
| license terms.                                                  |
|                                                                 |
| The Freescale license terms can be reviewed in the file         |
|                                                                 |
|    Freescale_license.txt                                        |
|                                                                 |
+-----------------------------------------------------------------+
|                                                                 |
| The generic mcf548x BSP has been developed on the basic         |
| structures and modules of the av5282 BSP.                       |
|                                                                 |
+-----------------------------------------------------------------+
|                                                                 |
| The license and distribution terms for this file may be         |
| found in the file LICENSE in this distribution or at            |
|                                                                 |
| http://www.rtems.com/license/LICENSE.                           |
|                                                                 |
+-----------------------------------------------------------------+
|                                                                 |
|   date                      history                        ID   |
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 12.11.07                    1.0                            ras  |
| 15.10.09                    1.1, adapted to COBRA5475      doe  |
|                                                                 |
\*===============================================================*/

/* 
 * Location and size of on-chip devices
 */
_SdramBase      = DEFINED(_SdramBase)      ? _SdramBase   : 0xf0000000;
_SdramSize      = DEFINED(_SdramSize)      ? _SdramSize   : (128 * 1024*1024);
_SysSramBase    = DEFINED(_SysSramBase)    ? _SysSramBase : __MBAR + 0x00010000;
_SysSramSize    = DEFINED(_SysSramSize)    ? _SysSramSize : (32 * 1024);
_McdapiBase     = DEFINED(_McdapiBase)     ? _McdapiBase  : _SysSramBase;                 
_McdapiSize     = DEFINED(_McdapiSize)     ? _McdapiSize  : (12 * 1024);                  
_CoreSramBase0  = DEFINED(_CoreSramBase0)  ? _CoreSramBase0 : 0xFF000000;
_CoreSramBase1  = DEFINED(_CoreSramBase1)  ? _CoreSramBase1 : 0xFF001000;
_CoreSramSize0  = DEFINED(_CoreSramSize0)  ? _CoreSramSize0 : (4 * 1024);
_CoreSramSize1  = DEFINED(_CoreSramSize1)  ? _CoreSramSize1 : (4 * 1024);
_BootFlashBase  = DEFINED(_BootFlashBase)  ? _BootFlashBase : 0xFC000000;
_BootFlashSize  = DEFINED(_BootFlashSize)  ? _BootFlashSize : (32 * 1024*1024);

_VectorRam      = DEFINED(_VectorRam)      ? _VectorRam : _SdramBase;
_DataRam        = DEFINED(_DataRam)        ? _DataRam   : _data_dest_start;
_DataRom        = DEFINED(_DataRom)        ? _DataRom   : _data_src_start;
_DataEnd        = DEFINED(_DataEnd)        ? _DataEnd   : _data_dest_end;
_BssStart       = DEFINED(_BssStart)       ? _BssStart  : _clear_start;
_BssEnd         = DEFINED(_BssEnd)         ? _BssEnd    : _clear_end;
_SpInit         = DEFINED(_SpInit)         ? _SpInit    : _EndInitStackSpace;

_InitStackSize  = DEFINED(StackSize)       ? StackSize  : 0x800;  /* 2 kB   */
_TopRamReserved = DEFINED(_TopRamReserved) ? _TopRamReserved : 0;

RamBase        = DEFINED(_SdramBase)      ? _SdramBase : _SdramBase;
RamSize        = DEFINED(_SdramSize)      ? _SdramSize : _SdramSize;
HeapSize       = DEFINED(HeapSize)       ? HeapSize   : 0x0;
_VBR            = DEFINED(_VBR)            ? _VBR       : RamBase;

__MBAR          = DEFINED(__MBAR)          ? __MBAR     : 0xFE000000;

ENTRY(start)
MEMORY
{
    sdram      : ORIGIN = 0xF0040000, LENGTH = 128M - 256K
    boot_flash : ORIGIN = 0xFC000000, LENGTH = 32M
}

SECTIONS
{
     
    _header_offset = 0;
    
    /*
     * Text, data and bss segments .vectors          
     */    
    .vectors : {
                 *(.vectors*)
               } >sdram
    .text : {
       
        *(.text*)
        *(.ram_code)

        /*
         * C++ constructors/destructors
         */
        *(.gnu.linkonce.t.*)

        /*
         * Initialization and finalization code.
              *
              * Various files can provide initialization and finalization
         * functions.  crtbegin.o and crtend.o are two instances. The
         * body of these functions are in .init and .fini sections. We
         * accumulate the bodies here, and prepend function prologues
         * from crti.o and function epilogues from crtn.o. crti.o must
         * be linked first; crtn.o must be linked last.  Because these
         * are wildcards, it doesn't matter if the user does not
         * actually link against crti.o and crtn.o; the linker won't
         * look for a file to match a wildcard.  The wildcard also
         * means that it doesn't matter which directory crti.o and
         * crtn.o are in. 
         */
        PROVIDE (_init = .);
        *crti.o(.init)
        *(.init)
        *crtn.o(.init)
        PROVIDE (_fini = .);
        *crti.o(.fini)
        *(.fini)
        *crtn.o(.fini)

        /*
         * Special FreeBSD sysctl sections.
         */
        . = ALIGN (16);
        __start_set_sysctl_set = .;
        *(set_sysctl_*);
        __stop_set_sysctl_set = ABSOLUTE(.);
        *(set_domain_*);
        *(set_pseudo_*);


        /*
         * C++ constructors/destructors
         *
         * gcc uses crtbegin.o to find the start of the constructors
         * and destructors so we make sure it is first.  Because this
         * is a wildcard, it doesn't matter if the user does not
         * actually link against crtbegin.o; the linker won't look for
         * a file to match a wildcard.  The wildcard also means that
         * it doesn't matter which directory crtbegin.o is in. The
         * constructor and destructor list are terminated in
         * crtend.o.  The same comments apply to it.
         */
        . = ALIGN (16);
        *crtbegin.o(.ctors)
        *(.ctors)
        *crtend.o(.ctors)
        *crtbegin.o(.dtors)
        *(.dtors)
        *crtend.o(.dtors)

        /*
         * Exception frame info
         */
        . = ALIGN (16);
        *(.eh_frame)

        /*
         * Read-only data
         */
        . = ALIGN (16);
        _rodata_start = . ;
        *(.rodata*)
        *(.gnu.linkonce.r*)
        
        . = ALIGN (16);

        *(.console_gdb_xfer)
        *(.bootstrap_data)
        . = ALIGN(16);
        _estuff = .;
    PROVIDE (_etext = .);
    } >sdram
        
        .data : {
        /*.data : {*/
            PROVIDE( _data_dest_start = . );
            PROVIDE( _copy_start = .);
            *(.data*)
            *(.gnu.linkonce.d*)
            *(.gcc_except_table*)
            *(.jcr)
            . = ALIGN (16);
            PROVIDE (_edata = .);
        PROVIDE (_copy_end = .);
        PROVIDE (_data_dest_end = . );
        } >sdram

        _data_src_start = _etext; /*LOADADDR(.data);*/
        _data_src_end = _data_src_start + SIZEOF(.data);        
        
        .bss : {
               PROVIDE (_clear_start = .);
                *(.bss*)
                *(COMMON)
                . = ALIGN (16);
                PROVIDE (end = .);
                PROVIDE (_clear_end = .);
                . = ALIGN (4);
                PROVIDE (_StartInitStackSpace = .);
                /*. = _StartInitStackSpace + _InitStackSize;*/
                . += _InitStackSize;
                PROVIDE (_EndInitStackSpace = .);
                PROVIDE (WorkAreaBase = .);
        } >sdram
  /* 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) }

PROVIDE (end_of_all = .);  
}