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

5
Last change on this file since b618d8c was b618d8c, checked in by Sebastian Huber <sebastian.huber@…>, on 09/16/15 at 05:13:58

Add RTEMS linker sets

Update #2408.

  • Property mode set to 100644
File size: 12.4 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.org/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    KEEP (*(SORT(.rtemsroset.*)))
139    *(.roda) /* deprecated: for compatibility with objcopyroda */
140    SORT(CONSTRUCTORS)
141    . = ALIGN(4);
142  } =0xFF
143  .tdata : {
144    _TLS_Data_begin = .;
145    *(.tdata .tdata.* .gnu.linkonce.td.*)
146    _TLS_Data_end = .;
147  } =0xFF
148  .tbss : {
149    _TLS_BSS_begin = .;
150    *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
151    _TLS_BSS_end = .;
152  }
153  _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
154  _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
155  _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
156  _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
157  _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
158  _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
159  __rodata_end = . ;
160
161  .eh_frame :
162  {
163    KEEP(*(.eh_frame))
164    . = ALIGN(4);
165  } =0xFF
166
167  .gcc_except_table :
168  {
169    *(.gcc_except_table*)
170    . = ALIGN(4);
171  } =0xFF
172
173  .ctors :
174  {
175    /* gcc uses crtbegin.o to find the start of
176       the constructors, so we make sure it is first.
177       Because this is a wildcard, it doesn't matter
178       if the user does not actually link against crtbegin.o;
179       the linker won't look for a file to match a wildcard.
180       The wildcard also means that it doesn't matter which
181       directory crtbegin.o is in.
182     */
183    KEEP(*crtbegin.o(.ctors))
184    /* We don't want to include the .ctor section from
185       the crtend.o file until after the sorted ctors.
186       The .ctor section from the crtend file contains the
187       end of ctors marker and it must be last
188     */
189     KEEP(*(EXCLUDE_FILE (*crtend.o) .ctors))
190     KEEP(*(SORT(.ctors.*)))
191     KEEP(*(.ctors))
192    . = ALIGN(4);
193  } =0xFF
194
195  .dtors :
196  {
197    KEEP(*crtbegin.o(.dtors))
198    KEEP(*(EXCLUDE_FILE (*crtend.o ) .dtors))
199    KEEP(*(SORT(.dtors.*)))
200    KEEP(*(.dtors))
201    . = ALIGN(4);
202  } =0xFF
203
204  .jcr :
205  {
206    *(.jcr)
207    . = ALIGN(4);
208  } =0xFF
209
210  .ARM.extab : {
211    *(.ARM.extab* .gnu.linkonce.armextab.*)
212  } =0xff
213   __exidx_start = .;
214  .ARM.exidx : {
215    *(.ARM.exidx* .gnu.linkonce.armexidx.*)
216  } =0xff
217   __exidx_end = .;
218  .preinit_array : {
219    PROVIDE_HIDDEN (__preinit_array_start = .);
220    KEEP (*(.preinit_array))
221    PROVIDE_HIDDEN (__preinit_array_end = .);
222  } =0xFF
223  .init_array : {
224     PROVIDE_HIDDEN (__init_array_start = .);
225     KEEP (*(SORT(.init_array.*)))
226     KEEP (*(.init_array))
227     PROVIDE_HIDDEN (__init_array_end = .);
228  } =0xFF
229  .fini_array : {
230    PROVIDE_HIDDEN (__fini_array_start = .);
231    KEEP (*(.fini_array))
232    KEEP (*(SORT(.fini_array.*)))
233    PROVIDE_HIDDEN (__fini_array_end = .);
234  } =0xFF
235
236/*************************************************************************
237  calculate __ro_end
238 *************************************************************************/
239  __ro_end = .;
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    KEEP (*(SORT(.rtemsrwset.*)))
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    *(.tcommon)
328    *(.sbss .sbss.* .gnu.linkonce.sb.*)
329    *(.scommon)
330    *(.bss .bss.* .gnu.linkonce.b*)
331    *(COMMON)
332    . = ALIGN(4);
333  }
334  __bss_end = . ;
335  PROVIDE(__bss_end__ = . );
336  PROVIDE(_bss_end__ = . );
337
338  PROVIDE(_end = . );
339  PROVIDE(__end__ = _end);
340  PROVIDE(end = _end);
341
342
343/*** debugging info ***/
344  /* Stabs debugging sections.  */
345  .stab 0 : { *(.stab) }
346  .stabstr 0 : { *(.stabstr) }
347  .stab.excl 0 : { *(.stab.excl) }
348  .stab.exclstr 0 : { *(.stab.exclstr) }
349  .stab.index 0 : { *(.stab.index) }
350  .stab.indexstr 0 : { *(.stab.indexstr) }
351  /* DWARF debug sections.
352   Symbols in the DWARF debugging sections are relative to the beginning
353   of the section so we begin them at 0.  */
354  /* DWARF 1 */
355  .debug          0 : { *(.debug) }
356  .line           0 : { *(.line) }
357  /* GNU DWARF 1 extensions */
358  .debug_srcinfo  0 : { *(.debug_srcinfo) }
359  .debug_sfnames  0 : { *(.debug_sfnames) }
360  /* DWARF 1.1 and DWARF 2 */
361  .debug_aranges  0 : { *(.debug_aranges) }
362  .debug_pubnames 0 : { *(.debug_pubnames) }
363  /* DWARF 2 */
364  .debug_info     0 : { *(.debug_info) }
365  .debug_abbrev   0 : { *(.debug_abbrev) }
366  .debug_line     0 : { *(.debug_line) }
367  .debug_frame    0 : { *(.debug_frame) }
368  .debug_str      0 : { *(.debug_str) }
369  .debug_loc      0 : { *(.debug_loc) }
370  .debug_macinfo  0 : { *(.debug_macinfo) }
371  .comment        0 : { *(.comment) }
372  /* SGI/MIPS DWARF 2 extensions */
373  .debug_weaknames 0 : { *(.debug_weaknames) }
374  .debug_funcnames 0 : { *(.debug_funcnames) }
375  .debug_typenames 0 : { *(.debug_typenames) }
376  .debug_varnames  0 : { *(.debug_varnames) }
377  /* DWARF 3 */
378  .debug_pubtypes 0 : { *(.debug_pubtypes) }
379  .debug_ranges   0 : { *(.debug_ranges) }
380  /* DWARF extension */
381  .debug_macro    0 : { *(.debug_macro) }
382  .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) }
383  .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
384  /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
385}
386/* @endcond */
Note: See TracBrowser for help on using the repository browser.