Back to home page

LXR

 
 

    


Warning, /bsps/m68k/mcf5235/start/linkcmdsflash is written in an unsupported language. File is not indexed.

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /*
0004  *  This file contains directives for the GNU linker which are specific
0005  *  to the Freescale ColdFire mcf5235
0006  *
0007  *  COPYRIGHT (c) 1989-1999.
0008  *  On-Line Applications Research Corporation (OAR).
0009  *
0010  * Redistribution and use in source and binary forms, with or without
0011  * modification, are permitted provided that the following conditions
0012  * are met:
0013  * 1. Redistributions of source code must retain the above copyright
0014  *    notice, this list of conditions and the following disclaimer.
0015  * 2. Redistributions in binary form must reproduce the above copyright
0016  *    notice, this list of conditions and the following disclaimer in the
0017  *    documentation and/or other materials provided with the distribution.
0018  *
0019  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0020  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0021  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0022  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0023  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0024  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0025  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0026  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0027  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0028  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0029  * POSSIBILITY OF SUCH DAMAGE.
0030  */
0031 
0032 /*
0033  * declare for the MCF5235_BSP_START_FROM_FLASH
0034  * 0 - use debug monitor to load to ram
0035  * 1 - load everything from flash from scratch
0036  */
0037 MCF5235_BSP_START_FROM_FLASH = 1;
0038 
0039 /*
0040  * Declare some sizes.
0041  */
0042 RamBase = DEFINED(RamBase) ? RamBase : 0x0;
0043 RamSize = DEFINED(RamSize) ? RamSize : 16M;
0044 RamEnd = RamBase + RamSize;
0045 HeapSize = DEFINED(HeapSize) ? HeapSize : 0;
0046 
0047 
0048 /*
0049  * System clock speed
0050  */
0051 _CPUClockSpeed = DEFINED(_CPUClockSpeed) ? _CPUClockSpeed : 150000000 ;
0052 
0053 /*
0054  * Location of on-chip devices
0055  */
0056 __IPSBAR = DEFINED(__IPSBAR) ? __IPSBAR : 0x40000000 ;
0057 __SRAMBASE = DEFINED(__SRAMBASE) ? __SRAMBASE : 0x20000000 ;
0058 _VBR = 0x0;
0059 
0060 ENTRY(start)
0061 STARTUP(start.o)
0062 
0063 /*
0064  *  NOTE: If loading to flash with dBUG remember to change the origin to 0xFFF00000 because that's where user flash is
0065  *  located.
0066  */
0067 MEMORY
0068 {
0069     ram : ORIGIN = 0, LENGTH = 16M
0070     sram : ORIGIN = 0x20000000, LENGTH = 64K
0071     flash : ORIGIN = 0xFFE00000, LENGTH = 2M
0072 }
0073 
0074 SECTIONS
0075 {
0076     
0077     _header_offset = 0;
0078     
0079     /*
0080      * Text, data and bss segments
0081      */
0082     .text : {
0083        
0084        *(.text*)
0085         *(.ram_code)
0086 
0087         /*
0088          * C++ constructors/destructors
0089          */
0090         *(.gnu.linkonce.t.*)
0091 
0092         /*
0093          * Initialization and finalization code.
0094          *
0095          * Various files can provide initialization and finalization
0096          * functions.  crtbegin.o and crtend.o are two instances. The
0097          * body of these functions are in .init and .fini sections. We
0098          * accumulate the bodies here, and prepend function prologues
0099          * from crti.o and function epilogues from crtn.o. crti.o must
0100          * be linked first; crtn.o must be linked last.  Because these
0101          * are wildcards, it doesn't matter if the user does not
0102          * actually link against crti.o and crtn.o; the linker won't
0103          * look for a file to match a wildcard.  The wildcard also
0104          * means that it doesn't matter which directory crti.o and
0105          * crtn.o are in. 
0106          */
0107         PROVIDE (_init = .);
0108         *crti.o(.init)
0109         *(.init)
0110         *crtn.o(.init)
0111         PROVIDE (_fini = .);
0112         *crti.o(.fini)
0113         *(.fini)
0114         *crtn.o(.fini)
0115 
0116         /*
0117          * Special FreeBSD sysctl sections.
0118          */
0119         . = ALIGN (16);
0120         __start_set_sysctl_set = .;
0121         *(set_sysctl_*);
0122         __stop_set_sysctl_set = ABSOLUTE(.);
0123         *(set_domain_*);
0124         *(set_pseudo_*);
0125 
0126 
0127         /*
0128          * C++ constructors/destructors
0129          *
0130          * gcc uses crtbegin.o to find the start of the constructors
0131          * and destructors so we make sure it is first.  Because this
0132          * is a wildcard, it doesn't matter if the user does not
0133          * actually link against crtbegin.o; the linker won't look for
0134          * a file to match a wildcard.  The wildcard also means that
0135          * it doesn't matter which directory crtbegin.o is in. The
0136          * constructor and destructor list are terminated in
0137          * crtend.o.  The same comments apply to it.
0138          */
0139         . = ALIGN (16);
0140         *crtbegin.o(.ctors)
0141         *(.ctors)
0142         *crtend.o(.ctors)
0143         *crtbegin.o(.dtors)
0144         *(.dtors)
0145         *crtend.o(.dtors)
0146 
0147         /*
0148          * Exception frame info
0149          */
0150         . = ALIGN (16);
0151         *(.eh_frame)
0152 
0153         /*
0154          * Read-only data
0155          */
0156         . = ALIGN (16);
0157         _rodata_start = . ;
0158         *(.rodata*)
0159         KEEP (*(SORT(.rtemsroset.*)))
0160         *(.gnu.linkonce.r*)
0161         
0162         . = ALIGN (16);
0163 
0164         *(.console_gdb_xfer)
0165         *(.bootstrap_data)
0166         . = ALIGN(16);
0167         _estuff = .;
0168     PROVIDE (_etext = .);
0169     } >flash
0170 
0171     .tdata : {
0172         _TLS_Data_begin = .;
0173         *(.tdata .tdata.* .gnu.linkonce.td.*)
0174         _TLS_Data_end = .;
0175     } >flash
0176 
0177     .tbss : {
0178         _TLS_BSS_begin = .;
0179         *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
0180         _TLS_BSS_end = .;
0181     } >flash
0182 
0183     _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
0184     _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
0185     _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
0186     _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
0187     _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
0188     _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
0189         
0190         .data 0x4000 : AT ( ADDR(.tdata) + SIZEOF ( .tdata ) )
0191         {
0192             PROVIDE( _data_dest_start = . );
0193             PROVIDE( _copy_start = .);
0194             *(.data)
0195             KEEP (*(SORT(.rtemsrwset.*)))
0196             *(.gnu.linkonce.d*)
0197             *(.gcc_except_table*)
0198             *(.jcr)
0199             . = ALIGN (16);
0200             PROVIDE (_edata = .);
0201         PROVIDE (_copy_end = .);
0202         PROVIDE (_data_dest_end = . );
0203         } >ram
0204 
0205         _data_src_start = _estuff;
0206         _data_src_end = _data_dest_start + SIZEOF(.data);        
0207         
0208         .bss : {
0209                 _clear_start = .;
0210                 *(.bss*)
0211                 *(COMMON)
0212                 . = ALIGN (16);
0213                 PROVIDE (end = .);
0214                 _clear_end = .;
0215         } >ram
0216 
0217         .noinit (NOLOAD) : {
0218                 *(SORT_BY_NAME (SORT_BY_ALIGNMENT (.noinit*)))
0219         } > ram
0220 
0221         .rtemsstack (NOLOAD) : {
0222                 *(SORT(.rtemsstack.*))
0223                 WorkAreaBase = .;
0224         } >ram
0225   /* Stabs debugging sections.  */
0226   .stab 0 : { *(.stab) }
0227   .stabstr 0 : { *(.stabstr) }
0228   .stab.excl 0 : { *(.stab.excl) }
0229   .stab.exclstr 0 : { *(.stab.exclstr) }
0230   .stab.index 0 : { *(.stab.index) }
0231   .stab.indexstr 0 : { *(.stab.indexstr) }
0232   .comment 0 : { *(.comment) }
0233 
0234 PROVIDE (end_of_all = .);  
0235 }