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

4.115
Last change on this file since 183af89 was 4651508, checked in by Sebastian Huber <sebastian.huber@…>, on 12/03/10 at 10:51:22

2010-12-03 Sebastian Huber <sebastian.huber@…>

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