source: rtems/c/src/lib/libbsp/arm/shared/startup/linkcmds.base @ 8dcfc0a

4.104.115
Last change on this file since 8dcfc0a was 8dcfc0a, checked in by Thomas Doerfler <Thomas.Doerfler@…>, on 09/22/08 at 11:49:50

* empty log message *

  • Property mode set to 100644
File size: 9.2 KB
Line 
1/**
2 * @file
3 *
4 * @brief Linker command base file for configuration with internal and external
5 * RAM and optional ROM load.
6 *
7 * You need to add a linker command file to your board support package that
8 * includes this file at the end and provides the following definitions.
9 *
10 * Compulsory are the memory regions RAM_INT, RAM_EXT and NIRVANA.
11 * <pre>
12 * MEMORY {
13 *   RAM_INT (AIW) : ORIGIN = 0x40000000, LENGTH = 64k
14 *   RAM_EXT (AIW) : ORIGIN = 0xa0000000, LENGTH = 32M
15 *   NIRVANA : ORIGIN = 0, LENGTH = 0
16 * }
17 * </pre>
18 *
19 * You may optionally provide ROM start and size values.
20 * <pre>
21 * bsp_rom_start = 0x80000000;
22 * bsp_rom_size = 0x01000000;
23 * </pre>
24 *
25 * Optionally you can enable the load to ROM.  It is enabled then
26 * bsp_enable_rom_load is defined.  The value is arbitrary.
27 * <pre>
28 * bsp_enable_rom_load = 1;
29 * </pre>
30 *
31 * Include the linker command base file.  This file has to be installed in the
32 * same directory than your linker command file.
33 * <pre>
34 * INCLUDE linkcmds.base
35 * </pre>
36 *
37 * You may define optionally values for the following sizes:
38 *   - bsp_ram_int_size
39 *   - bsp_ram_ext_size
40 *   - bsp_stack_abt_size
41 *   - bsp_stack_fiq_size
42 *   - bsp_stack_irq_size
43 *   - bsp_stack_svc_size
44 *   - bsp_stack_undef_size
45 */
46
47/*
48 * Copyright (c) 2008
49 * Embedded Brains GmbH
50 * Obere Lagerstr. 30
51 * D-82178 Puchheim
52 * Germany
53 * rtems@embedded-brains.de
54 *
55 * The license and distribution terms for this file may be found in the file
56 * LICENSE in this distribution or at http://www.rtems.com/license/LICENSE.
57 */
58
59OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
60
61OUTPUT_ARCH (arm)
62
63ENTRY (start)
64
65/*
66 * BSP: Symbols that may be defined externally.  The minimum alignment
67 * requirement for regions is bsp_section_align.
68 */
69bsp_ram_int_size = DEFINED (bsp_ram_int_size) ? bsp_ram_int_size : LENGTH (RAM_INT);
70
71bsp_ram_ext_size = DEFINED (bsp_ram_ext_size) ? bsp_ram_ext_size : LENGTH (RAM_EXT);
72
73bsp_rom_start = DEFINED (bsp_rom_start) ? bsp_rom_start : 0;
74
75bsp_rom_size = DEFINED (bsp_rom_size) ? bsp_rom_size : 0;
76
77bsp_ram_ext_load_start = DEFINED (bsp_enable_rom_load) ? bsp_rom_start : bsp_ram_ext_start;
78
79bsp_stack_abt_size = DEFINED (bsp_stack_abt_size) ? bsp_stack_abt_size : 128;
80
81bsp_stack_fiq_size = DEFINED (bsp_stack_fiq_size) ? bsp_stack_fiq_size : 128;
82
83bsp_stack_irq_size = DEFINED (bsp_stack_irq_size) ? bsp_stack_irq_size : 256;
84
85bsp_stack_svc_size = DEFINED (bsp_stack_svc_size) ? bsp_stack_svc_size : 256;
86
87bsp_stack_undef_size = DEFINED (bsp_stack_undef_size) ? bsp_stack_undef_size : 128;
88
89/*
90 * BSP: Global symbols
91 */
92bsp_ram_int_start = ORIGIN (RAM_INT);
93bsp_ram_int_end = bsp_ram_int_start + bsp_ram_int_size;
94
95bsp_ram_ext_start = ORIGIN (RAM_EXT);
96bsp_ram_ext_end = bsp_ram_ext_start + bsp_ram_ext_size;
97
98bsp_rom_end = bsp_rom_start + bsp_rom_size;
99
100bsp_section_align = 16;
101
102bsp_stack_align = 16;
103
104SECTIONS {
105        .vector : {
106                /*
107                 * BSP: Start of vector section
108                 */
109                bsp_section_vector_start = .;
110
111                /*
112                 * BSP: Reserve space for the the exception vector table and
113                 * the pointers to the default exceptions handlers.
114                 */
115                . = . + 64;
116
117                . = ALIGN (bsp_section_align);
118
119                /*
120                 * BSP: End of vector section
121                 */
122                bsp_section_vector_end = .;
123        } > RAM_INT
124
125        bsp_section_vector_size = bsp_section_vector_end - bsp_section_vector_start;
126
127        .text : AT (bsp_ram_ext_load_start) {
128                /*
129                 * BSP: Start of text section
130                 */
131                bsp_section_text_start = .;
132
133                /*
134                 * BSP: System startup entry
135                 */
136                KEEP (*(.entry))
137
138                /*
139                 * BSP: Moved into .text from .init
140                 */
141                KEEP (*(.init))
142
143                *(.text .stub .text.* .gnu.linkonce.t.*)
144                KEEP (*(.text.*personality*))
145                /* .gnu.warning sections are handled specially by elf32.em.  */
146                *(.gnu.warning)
147
148                /*
149                 * BSP: Magic ARM stuff
150                 */
151                *(.ARM.*)
152                *(.glue_7)
153                *(.glue_7t)
154                *(.vfp11_veneer)
155               
156                /*
157                 * BSP: Special FreeBSD sysctl sections
158                 */
159                . = ALIGN (16);
160                __start_set_sysctl_set = .;
161                *(set_sysctl_*);
162                __stop_set_sysctl_set = ABSOLUTE(.);
163                *(set_domain_*);
164                *(set_pseudo_*);
165
166                /*
167                 * BSP: Moved into .text from .*
168                 */
169                *(.rodata .rodata.* .gnu.linkonce.r.*)
170                *(.rodata1)
171                *(.eh_frame_hdr)
172
173                /*
174                 * BSP: Required by cpukit/score/src/threadhandler.c
175                 */
176                PROVIDE (_fini = .);
177
178                /*
179                 * BSP: Moved into .text from .fini
180                 */
181                KEEP (*(.fini))
182
183                . = ALIGN (bsp_section_align);
184
185                /*
186                 * BSP: End of text section
187                 */
188                bsp_section_text_end = .;
189        } > RAM_EXT
190
191        bsp_section_text_size = bsp_section_text_end - bsp_section_text_start;
192
193        .data : {
194                /*
195                 * BSP: Start of data section
196                 */
197                bsp_section_data_start = .;
198
199                /*
200                 * BSP: Moved into .data from .ctors
201                 */
202                /* gcc uses crtbegin.o to find the start of
203                   the constructors, so we make sure it is
204                   first.  Because this is a wildcard, it
205                   doesn't matter if the user does not
206                   actually link against crtbegin.o; the
207                   linker won't look for a file to match a
208                   wildcard.  The wildcard also means that it
209                   doesn't matter which directory crtbegin.o
210                   is in.  */
211                KEEP (*crtbegin.o(.ctors))
212                KEEP (*crtbegin?.o(.ctors))
213                /* We don't want to include the .ctor section from
214                   the crtend.o file until after the sorted ctors.
215                   The .ctor section from the crtend file contains the
216                   end of ctors marker and it must be last */
217                KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
218                KEEP (*(SORT(.ctors.*)))
219                KEEP (*(.ctors))
220
221                /*
222                 * BSP: Moved into .data from .dtors
223                 */
224                KEEP (*crtbegin.o(.dtors))
225                KEEP (*crtbegin?.o(.dtors))
226                KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
227                KEEP (*(SORT(.dtors.*)))
228                KEEP (*(.dtors))
229
230                /*
231                 * BSP: Moved into .data from .*
232                 */
233                *(.data1)
234                KEEP (*(.eh_frame))
235                *(.gcc_except_table .gcc_except_table.*)
236                KEEP (*(.jcr))
237
238                *(.data .data.* .gnu.linkonce.d.*)
239                KEEP (*(.gnu.linkonce.d.*personality*))
240                SORT(CONSTRUCTORS)
241
242                . = ALIGN (bsp_section_align);
243
244                /*
245                 * BSP: End of data section
246                 */
247                bsp_section_data_end = .;
248        } > RAM_EXT
249
250        bsp_section_data_size = bsp_section_data_end - bsp_section_data_start;
251
252        .bss : {
253                /*
254                 * BSP: Start of bss section
255                 */
256                bsp_section_bss_start = .;
257
258                *(COMMON)
259                *(.dynbss)
260                *(.bss .bss.* .gnu.linkonce.b.*)
261
262                . = ALIGN (bsp_section_align);
263
264                /*
265                 * BSP: End of bss section
266                 */
267                bsp_section_bss_end = .;
268        } > RAM_EXT
269
270        bsp_section_bss_size = bsp_section_bss_end - bsp_section_bss_start;
271
272        .stack : {
273                /*
274                 * BSP: Start of stack section
275                 */
276                bsp_section_stack_start = .;
277
278                . = ALIGN (bsp_stack_align);
279                bsp_stack_abt_start = .;
280                . = . + bsp_stack_abt_size;
281
282                . = ALIGN (bsp_stack_align);
283                bsp_stack_fiq_start = .;
284                . = . + bsp_stack_fiq_size;
285
286                . = ALIGN (bsp_stack_align);
287                bsp_stack_irq_start = .;
288                . = . + bsp_stack_irq_size;
289
290                . = ALIGN (bsp_stack_align);
291                bsp_stack_svc_start = .;
292                . = . + bsp_stack_svc_size;
293
294                . = ALIGN (bsp_stack_align);
295                bsp_stack_undef_start = .;
296                . = . + bsp_stack_undef_size;
297
298                . = ALIGN (bsp_section_align);
299
300                /*
301                 * BSP: End of stack section
302                 */
303                bsp_section_stack_end = .;
304        } > RAM_INT
305
306        bsp_section_stack_size = bsp_section_stack_end - bsp_section_stack_start;
307
308        .work_area : {
309                /*
310                 * BSP: Start of work area.  The work area will occupy the remaining
311                 * RAM_EXT region and contains the RTEMS work space and heap.  We cannot
312                 * assign the region end directly since this leads to a region full
313                 * warning.
314                 */
315                bsp_section_work_area_start = .;
316
317                . = bsp_ram_ext_end - 4;
318
319                . = ALIGN (bsp_section_align);
320
321                /*
322                 * BSP: End of work area
323                 */
324                bsp_section_work_area_end = .;
325        } > RAM_EXT
326
327        bsp_section_work_area_size = bsp_section_work_area_end - bsp_section_work_area_start;
328
329        /*
330         * BSP: External symbols (FIXME)
331         */
332        RamBase = bsp_ram_ext_start;
333        RamSize = bsp_ram_ext_size;
334        WorkAreaBase = bsp_section_work_area_start;
335        HeapSize = 0;
336       
337        /* Stabs debugging sections.  */
338        .stab          0 : { *(.stab) }
339        .stabstr       0 : { *(.stabstr) }
340        .stab.excl     0 : { *(.stab.excl) }
341        .stab.exclstr  0 : { *(.stab.exclstr) }
342        .stab.index    0 : { *(.stab.index) }
343        .stab.indexstr 0 : { *(.stab.indexstr) }
344        .comment       0 : { *(.comment) }
345        /* DWARF debug sections.
346           Symbols in the DWARF debugging sections are relative to the beginning
347           of the section so we begin them at 0.  */
348        /* DWARF 1 */
349        .debug          0 : { *(.debug) }
350        .line           0 : { *(.line) }
351        /* GNU DWARF 1 extensions */
352        .debug_srcinfo  0 : { *(.debug_srcinfo) }
353        .debug_sfnames  0 : { *(.debug_sfnames) }
354        /* DWARF 1.1 and DWARF 2 */
355        .debug_aranges  0 : { *(.debug_aranges) }
356        .debug_pubnames 0 : { *(.debug_pubnames) }
357        /* DWARF 2 */
358        .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
359        .debug_abbrev   0 : { *(.debug_abbrev) }
360        .debug_line     0 : { *(.debug_line) }
361        .debug_frame    0 : { *(.debug_frame) }
362        .debug_str      0 : { *(.debug_str) }
363        .debug_loc      0 : { *(.debug_loc) }
364        .debug_macinfo  0 : { *(.debug_macinfo) }
365        /* SGI/MIPS DWARF 2 extensions */
366        .debug_weaknames 0 : { *(.debug_weaknames) }
367        .debug_funcnames 0 : { *(.debug_funcnames) }
368        .debug_typenames 0 : { *(.debug_typenames) }
369        .debug_varnames  0 : { *(.debug_varnames) }
370        /* DWARF 3 */
371        .debug_pubtypes 0 : { *(.debug_pubtypes) }
372        .debug_ranges   0 : { *(.debug_ranges) }
373        .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
374
375        /DISCARD/ : {
376                *(.note.GNU-stack) *(.gnu_debuglink)
377        }
378
379        /*
380         * BSP: Catch all unknown sections
381         */
382        .nirvana : {
383                *(*)
384        } > NIRVANA
385}
Note: See TracBrowser for help on using the repository browser.