source: rtems/c/src/lib/libbsp/arm/gba/startup/linkcmds @ df6818f9

4.115
Last change on this file since df6818f9 was df6818f9, checked in by Sebastian Huber <sebastian.huber@…>, on Mar 18, 2013 at 2:24:00 PM

bsps: Support DWARF extension

  • Property mode set to 100644
File size: 12.1 KB
Line 
1/**
2 *  @file linkcmds
3 *
4 *  GBA BSP linker script
5 */
6/*
7 *  RTEMS GBA BSP
8 *
9 *  Copyright (c) Jeff Frohwein
10 *
11 *  Copyright (c) 2003  Jason Wilkins
12 *
13 *  Copyright (c) 2004  Markku Puro <markku.puro@kopteri.net>
14 *
15 *  The license and distribution terms for this file may be
16 *  found in the file LICENSE in this distribution or at
17 *
18 *  http://www.rtems.com/license/LICENSE.
19 */
20
21/*****************************************************************************
22 * This Linker Script is based on work by Jeff Frohwein and Jason Wilkins
23 *****************************************************************************
24 * Linker Script v1.3 by Jeff Frohwein
25 * :
26 * This file is released into the public domain
27 * for commercial or non-commercial use with no
28 * restrictions placed upon it.
29 *****************************************************************************
30 * Copyright 2003, Jason Wilkins.  This source code is free for any use except
31 * that this copyright notice and the following disclaimers remain intact when
32 * the source is distributed.  There are absolutely no restrictions on use of
33 * object code generated from this source, but the disclaimers remain in force.
34 *
35 * THIS CODE WAS NOT MADE IN ASSOCIATION WITH NINTENDO AND DOES NOT MAKE USE OF
36 * ANY INTELLECTUAL PROPERTY CLAIMED BY NINTENDO.
37 *
38 * GAMEBOY ADVANCE IS A TRADEMARK OF NINTENDO.
39 *
40 * THIS CODE HAS BEEN PROVIDED "AS-IS" WITHOUT A WARRANTY OF ANY KIND, EITHER
41 * EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO IMPLIED WARRANTIES OF
42 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  THE ENTIRE RISK AS TO THE
43 * QUALITY OR PERFORMANCE OF THE CODE IS WITH YOU.
44 *
45 * IN NO EVENT, UNLESS AGREED TO IN WRITING, WILL ANY COPYRIGHT HOLDER, OR ANY
46 * OTHER PARTY, BE HELD LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OR
47 * INABILITY TO USE THIS CODE.
48 *
49 *****************************************************************************/
50/* @cond  INCLUDE_ASM */
51
52OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
53OUTPUT_ARCH(arm)
54ENTRY(_start)
55
56/*************************************************************************
57  The linker script MEMORY directive is not used here due to the fact
58  that  __ro_start is not always a fixed value.
59 *************************************************************************
60MEMORY
61{
62  rom       : ORIGIN = 0x08000000 , LENGTH = 96M
63  iwram     : ORIGIN = 0x03000000 , LENGTH = 32K
64  ewram     : ORIGIN = 0x02000000 , LENGTH = 256K
65  sram      : ORIGIN = 0x0E000000 , LENGTH = 64K
66}
67 *************************************************************************/
68__gba_ewram_start = 0x02000000;
69__gba_ewram_end   = 0x02040000;
70__gba_iwram_start = 0x03000000;
71__gba_iwram_end   = 0x03008000;
72__gba_rom_start   = 0x08000000;
73__gba_rom_end     = 0x0E000000;
74__gba_sram_start  = 0x0E000000;
75__gba_sram_end    = 0x0E010000;
76
77__sp_irq_size     = 0x2A0;
78_stack_size       = 0xA00;
79__irq_vector      = __gba_iwram_end - 0x0004; /* 0x03007FFC */
80__sp_svc          = __gba_iwram_end - 0x0020; /* 0x03007FE0 */
81__sp_irq          = __gba_iwram_end - 0x0060; /* 0x03007FA0 */
82__sp_usr          = __sp_irq - __sp_irq_size; /* 0x03007D00 */
83__sp_limit        = __sp_usr - _stack_size;   /* 0x03007300 */
84__heap_limit      = DEFINED(__gba_multiboot) ? __gba_ewram_end : ( DEFINED(__gba_iwram_bss) ? __sp_limit :  __gba_ewram_end ) ;
85
86
87SECTIONS
88{
89/*** read-only sections ***/
90/*************************************************************************
91  if 'multiboot' allocate prog in __gba_ewram_start (0x02000000-0x0207FFFF)
92  else allocate prog in __gba_rom_start (0x08000000-0x0DFFFFFF)
93 *************************************************************************/
94  __ro_start = DEFINED(__gba_multiboot) ? __gba_ewram_start : __gba_rom_start ;
95  PROVIDE(__text_start__ = __ro_start );
96  .text  __ro_start :
97  {
98    CREATE_OBJECT_SYMBOLS
99    */start.o(.text)
100    *(EXCLUDE_FILE(*.rodata.* *.ewram.o *.iwram.o) .text)
101    *(.stub .text.* .gnu.linkonce.t*)
102
103    /*
104     * Special FreeBSD sysctl sections.
105     */
106    . = ALIGN (16);
107    __start_set_sysctl_set = .;
108    *(set_sysctl_*);
109    __stop_set_sysctl_set = ABSOLUTE(.);
110    *(set_domain_*);
111    *(set_pseudo_*);
112
113    /* .gnu.warning sections are handled specially by elf32.em. */
114    *(.gnu.warning)
115    *(.glue_7)
116    *(.glue_7t)
117    . = ALIGN(4);
118  } =0xFF
119
120  .init :
121  {
122    *(.init)
123    . = ALIGN(4);
124  } =0xFF
125
126  .fini :
127  {
128    *(.fini)
129    . = ALIGN(4);
130  } =0xFF
131
132  __rodata_start = . ;
133  .rodata :
134  {
135    *(.rodata1)
136    *(EXCLUDE_FILE(*.rodata.* *.ewram.o *.iwram.o) .rodata)
137    *(.rodata.* .gnu.linkonce.r*)
138    *(.roda) /* deprecated: for compatibility with objcopyroda */
139    SORT(CONSTRUCTORS)
140    . = ALIGN(4);
141  } =0xFF
142  __rodata_end = . ;
143
144  .eh_frame :
145  {
146    KEEP(*(.eh_frame))
147    . = ALIGN(4);
148  } =0xFF
149
150  .gcc_except_table :
151  {
152    *(.gcc_except_table*)
153    . = ALIGN(4);
154  } =0xFF
155
156  .ctors :
157  {
158    /* gcc uses crtbegin.o to find the start of
159       the constructors, so we make sure it is first.
160       Because this is a wildcard, it doesn't matter
161       if the user does not actually link against crtbegin.o;
162       the linker won't look for a file to match a wildcard.
163       The wildcard also means that it doesn't matter which
164       directory crtbegin.o is in.
165     */
166    KEEP(*crtbegin.o(.ctors))
167    /* We don't want to include the .ctor section from
168       the crtend.o file until after the sorted ctors.
169       The .ctor section from the crtend file contains the
170       end of ctors marker and it must be last
171     */
172     KEEP(*(EXCLUDE_FILE (*crtend.o) .ctors))
173     KEEP(*(SORT(.ctors.*)))
174     KEEP(*(.ctors))
175    . = ALIGN(4);
176  } =0xFF
177
178  .dtors :
179  {
180    KEEP(*crtbegin.o(.dtors))
181    KEEP(*(EXCLUDE_FILE (*crtend.o ) .dtors))
182    KEEP(*(SORT(.dtors.*)))
183    KEEP(*(.dtors))
184    . = ALIGN(4);
185  } =0xFF
186
187  .jcr :
188  {
189    *(.jcr)
190    . = ALIGN(4);
191  } =0xFF
192
193  .ARM.extab : {
194    *(.ARM.extab* .gnu.linkonce.armextab.*)
195  } =0xff
196   __exidx_start = .;
197  .ARM.exidx : {
198    *(.ARM.exidx* .gnu.linkonce.armexidx.*)
199  } =0xff
200   __exidx_end = .;
201  .preinit_array : {
202    PROVIDE_HIDDEN (__preinit_array_start = .);
203    KEEP (*(.preinit_array))
204    PROVIDE_HIDDEN (__preinit_array_end = .);
205  } =0xFF
206  .init_array : {
207     PROVIDE_HIDDEN (__init_array_start = .);
208     KEEP (*(SORT(.init_array.*)))
209     KEEP (*(.init_array))
210     PROVIDE_HIDDEN (__init_array_end = .);
211  } =0xFF
212  .fini_array : {
213    PROVIDE_HIDDEN (__fini_array_start = .);
214    KEEP (*(.fini_array))
215    KEEP (*(SORT(.fini_array.*)))
216    PROVIDE_HIDDEN (__fini_array_end = .);
217  } =0xFF
218
219/*************************************************************************
220  calculate __ro_end
221 *************************************************************************/
222  __ro_end =
223        ADDR(.text) +
224        SIZEOF(.text) +
225        SIZEOF(.init) +
226        SIZEOF(.fini) +
227        SIZEOF(.rodata) +
228        SIZEOF(.eh_frame) +
229        SIZEOF(.gcc_except_table) +
230        SIZEOF(.ctors) +
231        SIZEOF(.dtors) +
232        SIZEOF(.jcr) +
233        SIZEOF(.ARM.extab) +
234        SIZEOF(.ARM.exidx) +
235        SIZEOF(.preinit_array) +
236        SIZEOF(.init_array) +
237        SIZEOF(.fini_array);
238  PROVIDE(__text_end__ = __ro_end );
239
240/*** IWRAM ***/
241/*************************************************************************
242  allocate iwram in __gba_iwram_start (0x03000000-0x03003FFF)
243 *************************************************************************/
244  __load_start_iwram = __ro_end;
245  . = __gba_iwram_start ;
246  __iwram_start = . ;
247  PROVIDE(__iwram_start__ = . );
248  .iwram : AT(__load_start_iwram)
249  {
250    /* put irq_vector_table in stat of iwram  */
251    CREATE_OBJECT_SYMBOLS
252    _irq_vector_table = .;
253    PROVIDE(irq_vector_table = .);
254    . += 4;
255    . = ALIGN(16 * 4);
256    PROVIDE(irq_vector_table_end = .);
257    _irq_vector_table_end = .;
258    *(.iwram .iwram.*)
259    *.iwram.o (.text .rodata .data)
260    . = ALIGN(4);
261  } =0xFF
262  __iwram_end = . ;
263  PROVIDE(__iwram_end__ = . );
264  __load_stop_iwram = __load_start_iwram + SIZEOF(.iwram);
265
266 _irq_vector_table_size = _irq_vector_table_end - _irq_vector_table;
267 PROVIDE(_irq_max_vector = _irq_vector_table_size / 4 );
268
269
270/*** EWRAM ***/
271/*************************************************************************
272  if 'multiboot' allocate prog+ewram in __gba_ewram
273  else allocate only ewram in __gba_ewram_start
274 *************************************************************************/
275  . = DEFINED(__gba_multiboot) ? __load_stop_iwram : __gba_ewram_start ;
276  __load_start_ewram = __load_stop_iwram;
277  __ewram_start = . ;
278  PROVIDE(__ewram_start__ = . );
279  .ewram : AT(__load_start_ewram)
280  {
281    *(.ewram .ewram.*)
282    *.ewram.o (.text .rodata .data)
283    . = ALIGN(4);
284  } =0xFF
285  __ewram_end = . ;
286  PROVIDE(__ewram_end__ = . );
287  __load_stop_ewram = __load_start_ewram + SIZEOF(.ewram) ;
288
289/*************************************************************************
290    if 'multiboot' allocate prog+ewram+data+bss in __gba_ewram
291    else if 'iwram_data' allocate data in __gba_iwram
292    else allocate data in __gba_ewram
293 *************************************************************************/
294  . = DEFINED(__gba_multiboot) ? __load_stop_ewram : (DEFINED(__gba_iwram_data) ? __iwram_end : __ewram_end) ;
295  __load_start_data = __load_stop_ewram;
296  __data_start = . ;
297  PROVIDE(__data_start__ = . );
298  .data : AT(__load_start_data)
299  {
300    *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
301    *(EXCLUDE_FILE(*.rodata.* *.ewram.o *.iwram.o) .data)
302    *(.data.* .gnu.linkonce.d.*)
303    *(.data1)
304    *(.tdata .tdata.* .gnu.linkonce.td.*)
305    *(.sdata .sdata.* .gnu.linkonce.s.*)
306    . = ALIGN(4);
307  } =0xFF
308  __data_end = . ;
309  PROVIDE(__data_end__ = . );
310  __load_stop_data = __load_start_data + SIZEOF(.data);
311
312/*** BSS ***/
313/*************************************************************************
314    if 'multiboot' allocate prog+ewram+data+bss in __gba_ewram
315    else if 'iwram_data' and 'iwram_bss' allocate iwram+data+bss in __gba_iwram
316    else if !'iwram_data' and 'iwram_bss' allocate iwram+bss in __gba_iwram
317    else allocate data+ewram+bss in  __gba_ewram
318 *************************************************************************/
319  . = DEFINED(__gba_multiboot) ? __load_stop_data : ( DEFINED(__gba_iwram_data) ? (DEFINED(__gba_iwram_bss) ? __data_end :  __ewram_end) : (DEFINED(__gba_iwram_bss) ? __iwram_end : __data_end) ) ;
320  __bss_start = . ;
321  PROVIDE(__bss_start__ = . );
322  .bss :
323  {
324    *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
325    *(.tbss .tbss.* .gnu.linkonce.tb.*)
326    *(.tcommon)
327    *(.sbss .sbss.* .gnu.linkonce.sb.*)
328    *(.scommon)
329    *(.bss .bss.* .gnu.linkonce.b*)
330    *(COMMON)
331    . = ALIGN(4);
332  }
333  __bss_end = . ;
334  PROVIDE(__bss_end__ = . );
335  PROVIDE(_bss_end__ = . );
336
337  PROVIDE(_end = . );
338  PROVIDE(__end__ = _end);
339  PROVIDE(end = _end);
340
341
342/*** debugging info ***/
343  /* Stabs debugging sections.  */
344  .stab 0 : { *(.stab) }
345  .stabstr 0 : { *(.stabstr) }
346  .stab.excl 0 : { *(.stab.excl) }
347  .stab.exclstr 0 : { *(.stab.exclstr) }
348  .stab.index 0 : { *(.stab.index) }
349  .stab.indexstr 0 : { *(.stab.indexstr) }
350  /* DWARF debug sections.
351   Symbols in the DWARF debugging sections are relative to the beginning
352   of the section so we begin them at 0.  */
353  /* DWARF 1 */
354  .debug          0 : { *(.debug) }
355  .line           0 : { *(.line) }
356  /* GNU DWARF 1 extensions */
357  .debug_srcinfo  0 : { *(.debug_srcinfo) }
358  .debug_sfnames  0 : { *(.debug_sfnames) }
359  /* DWARF 1.1 and DWARF 2 */
360  .debug_aranges  0 : { *(.debug_aranges) }
361  .debug_pubnames 0 : { *(.debug_pubnames) }
362  /* DWARF 2 */
363  .debug_info     0 : { *(.debug_info) }
364  .debug_abbrev   0 : { *(.debug_abbrev) }
365  .debug_line     0 : { *(.debug_line) }
366  .debug_frame    0 : { *(.debug_frame) }
367  .debug_str      0 : { *(.debug_str) }
368  .debug_loc      0 : { *(.debug_loc) }
369  .debug_macinfo  0 : { *(.debug_macinfo) }
370  .comment        0 : { *(.comment) }
371  /* SGI/MIPS DWARF 2 extensions */
372  .debug_weaknames 0 : { *(.debug_weaknames) }
373  .debug_funcnames 0 : { *(.debug_funcnames) }
374  .debug_typenames 0 : { *(.debug_typenames) }
375  .debug_varnames  0 : { *(.debug_varnames) }
376  /* DWARF 3 */
377  .debug_pubtypes 0 : { *(.debug_pubtypes) }
378  .debug_ranges   0 : { *(.debug_ranges) }
379  /* DWARF extension */
380  .debug_macro    0 : { *(.debug_macro) }
381  .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) }
382  .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
383  /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
384}
385/* @endcond */
Note: See TracBrowser for help on using the repository browser.