1 | /* SPDX-License-Identifier: BSD-2-Clause */ |
---|
2 | |
---|
3 | /* |
---|
4 | * This file contains directives for the GNU linker which are specific |
---|
5 | * to the Freescale ColdFire mcf52235 |
---|
6 | * |
---|
7 | * COPYRIGHT (c) 1989-1999. |
---|
8 | * On-Line Applications Research Corporation (OAR). |
---|
9 | * |
---|
10 | * Redistribution and use in source and binary forms, with or without |
---|
11 | * modification, are permitted provided that the following conditions |
---|
12 | * are met: |
---|
13 | * 1. Redistributions of source code must retain the above copyright |
---|
14 | * notice, this list of conditions and the following disclaimer. |
---|
15 | * 2. Redistributions in binary form must reproduce the above copyright |
---|
16 | * notice, this list of conditions and the following disclaimer in the |
---|
17 | * documentation and/or other materials provided with the distribution. |
---|
18 | * |
---|
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
---|
23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
29 | * POSSIBILITY OF SUCH DAMAGE.e |
---|
30 | */ |
---|
31 | |
---|
32 | /* |
---|
33 | * Declare some sizes. |
---|
34 | */ |
---|
35 | _CoreSRamBase = DEFINED(RamBase) ? RamBase : 0x80000000; |
---|
36 | _CoreSRamSize = DEFINED(RamSize) ? RamSize : 32K; |
---|
37 | |
---|
38 | RamBase = DEFINED(RamBase) ? RamBase : 0x40000000; |
---|
39 | RamSize = DEFINED(RamSize) ? RamSize : 32M; |
---|
40 | RamEnd = RamBase + RamSize; |
---|
41 | |
---|
42 | _BootFlashBase = DEFINED(_FlashBase) ? _FlashBase : 0x00000000; |
---|
43 | _BootFlashSize = DEFINED(_FlashBase) ? _FlashBase : 2M; |
---|
44 | |
---|
45 | HeapSize = DEFINED(HeapSize) ? HeapSize : 0; |
---|
46 | |
---|
47 | _VBR = 0x40000000; |
---|
48 | |
---|
49 | ENTRY(start) |
---|
50 | STARTUP(start.o) |
---|
51 | |
---|
52 | MEMORY |
---|
53 | { |
---|
54 | core_sram : ORIGIN = 0x80000000, LENGTH = 32K |
---|
55 | boot_flash : ORIGIN = 0x00000000, LENGTH = 2M |
---|
56 | dram : ORIGIN = 0x40000000, LENGTH = 32M |
---|
57 | } |
---|
58 | |
---|
59 | SECTIONS |
---|
60 | { |
---|
61 | .ram_code : |
---|
62 | { |
---|
63 | *(.ram_code) |
---|
64 | } > core_sram |
---|
65 | |
---|
66 | /* |
---|
67 | * Text, data and bss segments |
---|
68 | */ |
---|
69 | .text 0x40000500 : { |
---|
70 | |
---|
71 | *(.text*) |
---|
72 | |
---|
73 | /* |
---|
74 | * C++ constructors/destructors |
---|
75 | */ |
---|
76 | *(.gnu.linkonce.t.*) |
---|
77 | |
---|
78 | /* |
---|
79 | * Initialization and finalization code. |
---|
80 | * |
---|
81 | * Various files can provide initialization and finalization |
---|
82 | * functions. crtbegin.o and crtend.o are two instances. The |
---|
83 | * body of these functions are in .init and .fini sections. We |
---|
84 | * accumulate the bodies here, and prepend function prologues |
---|
85 | * from crti.o and function epilogues from crtn.o. crti.o must |
---|
86 | * be linked first; crtn.o must be linked last. Because these |
---|
87 | * are wildcards, it doesn't matter if the user does not |
---|
88 | * actually link against crti.o and crtn.o; the linker won't |
---|
89 | * look for a file to match a wildcard. The wildcard also |
---|
90 | * means that it doesn't matter which directory crti.o and |
---|
91 | * crtn.o are in. |
---|
92 | */ |
---|
93 | PROVIDE (_init = .); |
---|
94 | *crti.o(.init) |
---|
95 | *(.init) |
---|
96 | *crtn.o(.init) |
---|
97 | PROVIDE (_fini = .); |
---|
98 | *crti.o(.fini) |
---|
99 | *(.fini) |
---|
100 | *crtn.o(.fini) |
---|
101 | |
---|
102 | /* |
---|
103 | * Special FreeBSD sysctl sections. |
---|
104 | */ |
---|
105 | . = ALIGN (16); |
---|
106 | __start_set_sysctl_set = .; |
---|
107 | *(set_sysctl_*); |
---|
108 | __stop_set_sysctl_set = ABSOLUTE(.); |
---|
109 | *(set_domain_*); |
---|
110 | *(set_pseudo_*); |
---|
111 | |
---|
112 | /* |
---|
113 | * C++ constructors/destructors |
---|
114 | * |
---|
115 | * gcc uses crtbegin.o to find the start of the constructors |
---|
116 | * and destructors so we make sure it is first. Because this |
---|
117 | * is a wildcard, it doesn't matter if the user does not |
---|
118 | * actually link against crtbegin.o; the linker won't look for |
---|
119 | * a file to match a wildcard. The wildcard also means that |
---|
120 | * it doesn't matter which directory crtbegin.o is in. The |
---|
121 | * constructor and destructor list are terminated in |
---|
122 | * crtend.o. The same comments apply to it. |
---|
123 | */ |
---|
124 | . = ALIGN (16); |
---|
125 | *crtbegin.o(.ctors) |
---|
126 | *(.ctors) |
---|
127 | *crtend.o(.ctors) |
---|
128 | *crtbegin.o(.dtors) |
---|
129 | *(.dtors) |
---|
130 | *crtend.o(.dtors) |
---|
131 | |
---|
132 | /* |
---|
133 | * Exception frame info |
---|
134 | */ |
---|
135 | . = ALIGN (16); |
---|
136 | *(.eh_frame) |
---|
137 | |
---|
138 | /* |
---|
139 | * Read-only data |
---|
140 | */ |
---|
141 | . = ALIGN (16); |
---|
142 | _rodata_start = . ; |
---|
143 | *(.rodata*) |
---|
144 | KEEP (*(SORT(.rtemsroset.*))) |
---|
145 | *(.gnu.linkonce.r*) |
---|
146 | |
---|
147 | . = ALIGN (16); |
---|
148 | |
---|
149 | *(.console_gdb_xfer) |
---|
150 | *(.bootstrap_data) |
---|
151 | . = ALIGN(16); |
---|
152 | _estuff = .; |
---|
153 | PROVIDE (_etext = .); |
---|
154 | } > dram |
---|
155 | |
---|
156 | .tdata : { |
---|
157 | _TLS_Data_begin = .; |
---|
158 | *(.tdata .tdata.* .gnu.linkonce.td.*) |
---|
159 | _TLS_Data_end = .; |
---|
160 | } > dram |
---|
161 | |
---|
162 | .tbss : { |
---|
163 | _TLS_BSS_begin = .; |
---|
164 | *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) |
---|
165 | _TLS_BSS_end = .; |
---|
166 | } > dram |
---|
167 | |
---|
168 | _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin; |
---|
169 | _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin; |
---|
170 | _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin; |
---|
171 | _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin; |
---|
172 | _TLS_Size = _TLS_BSS_end - _TLS_Data_begin; |
---|
173 | _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss)); |
---|
174 | |
---|
175 | .data : |
---|
176 | { |
---|
177 | PROVIDE( _data_dest_start = . ); |
---|
178 | PROVIDE( _copy_start = .); |
---|
179 | *(.data*) |
---|
180 | KEEP (*(SORT(.rtemsrwset.*))) |
---|
181 | *(.gnu.linkonce.d*) |
---|
182 | *(.gcc_except_table*) |
---|
183 | *(.jcr) |
---|
184 | . = ALIGN (16); |
---|
185 | PROVIDE (_edata = .); |
---|
186 | PROVIDE (_copy_end = .); |
---|
187 | PROVIDE (_data_dest_end = . ); |
---|
188 | } > dram |
---|
189 | |
---|
190 | _data_src_start = _estuff; |
---|
191 | _data_src_end = _data_dest_start + SIZEOF(.data); |
---|
192 | |
---|
193 | .bss : |
---|
194 | { |
---|
195 | _clear_start = .; |
---|
196 | *(.bss*) |
---|
197 | *(COMMON) |
---|
198 | . = ALIGN (16); |
---|
199 | PROVIDE (_end = .); |
---|
200 | _clear_end = .; |
---|
201 | } > dram |
---|
202 | |
---|
203 | .noinit (NOLOAD) : { |
---|
204 | *(SORT_BY_NAME (SORT_BY_ALIGNMENT (.noinit*))) |
---|
205 | WorkAreaBase = .; |
---|
206 | } > dram |
---|
207 | |
---|
208 | .rtemsstack (NOLOAD) : { |
---|
209 | *(SORT(.rtemsstack.*)) |
---|
210 | } > core_sram |
---|
211 | |
---|
212 | /* Stabs debugging sections. */ |
---|
213 | .stab 0 : { *(.stab) } |
---|
214 | .stabstr 0 : { *(.stabstr) } |
---|
215 | .stab.excl 0 : { *(.stab.excl) } |
---|
216 | .stab.exclstr 0 : { *(.stab.exclstr) } |
---|
217 | .stab.index 0 : { *(.stab.index) } |
---|
218 | .stab.indexstr 0 : { *(.stab.indexstr) } |
---|
219 | .comment 0 : { *(.comment) } |
---|
220 | |
---|
221 | PROVIDE (end_of_all = .); |
---|
222 | } |
---|