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

4.104.114.84.95
Last change on this file since 2732040d was 3c7ed6b, checked in by Joel Sherrill <joel.sherrill@…>, on 07/06/05 at 18:46:04

2005-07-06 Markku Puro <markku.puro@…>

  • .cvsignore, ChangeLog?, Makefile.am, README, bsp_specs, configure.ac, clock/clockdrv.c, console/conio.c, console/console.c, console/defaultfont.c, include/arm_mode_bits.h, include/asm_macros.h, include/bsp.h, include/bspopts.h.in, include/conio.h, include/gba.h, include/gba_registers.h, include/tm27.h, irq/bsp_irq_asm.S, irq/bsp_irq_init.c, irq/irq.c, irq/irq.h, irq/irq_asm.S, irq/irq_init.c, start/logo.S, start/start.S, startup/bspstart.c, startup/cpu.c, startup/cpu_asm.S, startup/exit.c, startup/linkcmds, timer/timer.c: New files.
  • Property mode set to 100644
File size: 11.0 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/*************************************************************************
196  calculate __ro_end
197 *************************************************************************/
198  __ro_end =
199        ADDR(.text) +
200        SIZEOF(.text) +
201        SIZEOF(.init) +
202        SIZEOF(.fini) +
203        SIZEOF(.rodata) +
204        SIZEOF(.eh_frame) +
205        SIZEOF(.gcc_except_table) +
206        SIZEOF(.ctors) +
207        SIZEOF(.dtors) +
208        SIZEOF(.jcr);
209  PROVIDE(__text_end__ = __ro_end );
210
211/*** IWRAM ***/
212/*************************************************************************
213  allocate iwram in __gba_iwram_start (0x03000000-0x03003FFF)
214 *************************************************************************/
215  __load_start_iwram = __ro_end;
216  . = __gba_iwram_start ;
217  __iwram_start = . ;
218  PROVIDE(__iwram_start__ = . );
219  .iwram : AT(__load_start_iwram)
220  {
221    /* put irq_vector_table in stat of iwram  */
222    CREATE_OBJECT_SYMBOLS
223    _irq_vector_table = .;
224    PROVIDE(irq_vector_table = .);
225    . += 4;
226    . = ALIGN(16 * 4);
227    PROVIDE(irq_vector_table_end = .);
228    _irq_vector_table_end = .;
229    *(.iwram .iwram.*)
230    *.iwram.o (.text .rodata .data)
231    . = ALIGN(4);
232  } =0xFF
233  __iwram_end = . ;
234  PROVIDE(__iwram_end__ = . );
235  __load_stop_iwram = __load_start_iwram + SIZEOF(.iwram);
236
237 _irq_vector_table_size = _irq_vector_table_end - _irq_vector_table;
238 PROVIDE(_irq_max_vector = _irq_vector_table_size / 4 );
239
240
241/*** EWRAM ***/
242/*************************************************************************
243  if 'multiboot' allocate prog+ewram in __gba_ewram
244  else allocate only ewram in __gba_ewram_start
245 *************************************************************************/
246  . = DEFINED(__gba_multiboot) ? __load_stop_iwram : __gba_ewram_start ;
247  __load_start_ewram = __load_stop_iwram;
248  __ewram_start = . ;
249  PROVIDE(__ewram_start__ = . );
250  .ewram : AT(__load_start_ewram)
251  {
252    *(.ewram .ewram.*)
253    *.ewram.o (.text .rodata .data)
254    . = ALIGN(4);
255  } =0xFF
256  __ewram_end = . ;
257  PROVIDE(__ewram_end__ = . );
258  __load_stop_ewram = __load_start_ewram + SIZEOF(.ewram) ;
259
260/*************************************************************************
261    if 'multiboot' allocate prog+ewram+data+bss in __gba_ewram
262    else if 'iwram_data' allocate data in __gba_iwram
263    else allocate data in __gba_ewram
264 *************************************************************************/
265  . = DEFINED(__gba_multiboot) ? __load_stop_ewram : (DEFINED(__gba_iwram_data) ? __iwram_end : __ewram_end) ;
266  __load_start_data = __load_stop_ewram;
267  __data_start = . ;
268  PROVIDE(__data_start__ = . );
269  .data : AT(__load_start_data)
270  {
271    *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
272    *(EXCLUDE_FILE(*.rodata.* *.ewram.o *.iwram.o) .data)
273    *(.data.* .gnu.linkonce.d.*)
274    *(.data1)
275    *(.tdata .tdata.* .gnu.linkonce.td.*)
276    *(.sdata .sdata.* .gnu.linkonce.s.*)
277    . = ALIGN(4);
278  } =0xFF
279  __data_end = . ;
280  PROVIDE(__data_end__ = . );
281  __load_stop_data = __load_start_data + SIZEOF(.data);
282
283/*** BSS ***/
284/*************************************************************************
285    if 'multiboot' allocate prog+ewram+data+bss in __gba_ewram
286    else if 'iwram_data' and 'iwram_bss' allocate iwram+data+bss in __gba_iwram
287    else if !'iwram_data' and 'iwram_bss' allocate iwram+bss in __gba_iwram
288    else allocate data+ewram+bss in  __gba_ewram
289 *************************************************************************/
290  . = 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) ) ;
291  __bss_start = . ;
292  PROVIDE(__bss_start__ = . );
293  .bss :
294  {
295    *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
296    *(.tbss .tbss.* .gnu.linkonce.tb.*)
297    *(.tcommon)
298    *(.sbss .sbss.* .gnu.linkonce.sb.*)
299    *(.scommon)
300    *(.bss .bss.* .gnu.linkonce.b*)
301    *(COMMON)
302    . = ALIGN(4);
303  }
304  __bss_end = . ;
305  PROVIDE(__bss_end__ = . );
306  PROVIDE(_bss_end__ = . );
307
308  PROVIDE(_end = . );
309  PROVIDE(__end__ = _end);
310  PROVIDE(end = _end);
311
312
313/*** debugging info ***/
314  /* Stabs debugging sections.  */
315  .stab 0 : { *(.stab) }
316  .stabstr 0 : { *(.stabstr) }
317  .stab.excl 0 : { *(.stab.excl) }
318  .stab.exclstr 0 : { *(.stab.exclstr) }
319  .stab.index 0 : { *(.stab.index) }
320  .stab.indexstr 0 : { *(.stab.indexstr) }
321  /* DWARF debug sections.
322   Symbols in the DWARF debugging sections are relative to the beginning
323   of the section so we begin them at 0.  */
324  /* DWARF 1 */
325  .debug          0 : { *(.debug) }
326  .line           0 : { *(.line) }
327  /* GNU DWARF 1 extensions */
328  .debug_srcinfo  0 : { *(.debug_srcinfo) }
329  .debug_sfnames  0 : { *(.debug_sfnames) }
330  /* DWARF 1.1 and DWARF 2 */
331  .debug_aranges  0 : { *(.debug_aranges) }
332  .debug_pubnames 0 : { *(.debug_pubnames) }
333  /* DWARF 2 */
334  .debug_info     0 : { *(.debug_info) }
335  .debug_abbrev   0 : { *(.debug_abbrev) }
336  .debug_line     0 : { *(.debug_line) }
337  .debug_frame    0 : { *(.debug_frame) }
338  .debug_str      0 : { *(.debug_str) }
339  .debug_loc      0 : { *(.debug_loc) }
340  .debug_macinfo  0 : { *(.debug_macinfo) }
341  .comment        0 : { *(.comment) }
342  /* SGI/MIPS DWARF 2 extensions */
343  .debug_weaknames 0 : { *(.debug_weaknames) }
344  .debug_funcnames 0 : { *(.debug_funcnames) }
345  .debug_typenames 0 : { *(.debug_typenames) }
346  .debug_varnames  0 : { *(.debug_varnames) }
347}
348/* @endcond */
Note: See TracBrowser for help on using the repository browser.