CMSIS2000  0.0.7
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
gcc_cs.ld
Go to the documentation of this file.
1 /* Linker script to configure memory regions
2  *
3  * Version:CodeSourcery Sourcery G++ Lite 2007q3-53
4  * BugURL:https://support.codesourcery.com/GNUToolchain/
5  *
6  * Copyright 2007 CodeSourcery.
7  *
8  * The authors hereby grant permission to use, copy, modify, distribute,
9  * and license this software and its documentation for any purpose, provided
10  * that existing copyright notices are retained in all copies and that this
11  * notice is included verbatim in any distributions. No written agreement,
12  * license, or royalty fee is required for any of the authorized uses.
13  * Modifications to this software may be copyrighted by their authors
14  * and need not follow the licensing terms described here, provided that
15  * the new terms are clearly indicated on the first page of each file where
16  * they apply. */
17 
18 OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
20 SEARCH_DIR(.)
21 GROUP(-lgcc -lc -lcs3 -lcs3unhosted -lcs3micro)
22 
23 MEMORY
24 {
25  rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x40000 /* 256k */
26  ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x08000 /* 32k */
27 }
28 
29 /* These force the linker to search for particular symbols from
30  * the start of the link process and thus ensure the user's
31  * overrides are picked up
32  */
35 EXTERN(__cs3_start_c main __cs3_stack __cs3_stack_size __cs3_heap_end)
36 
37 PROVIDE(__cs3_stack = __cs3_region_start_ram + __cs3_region_size_ram);
38 PROVIDE(__cs3_stack_size = __cs3_region_start_ram + __cs3_region_size_ram - _end);
40 PROVIDE(__cs3_heap_end = __cs3_region_start_ram + __cs3_region_size_ram);
41 
42 SECTIONS
43 {
44  .text :
45  {
46  CREATE_OBJECT_SYMBOLS
47  __cs3_region_start_rom = .;
48  *(.cs3.region-head.rom)
49  __cs3_interrupt_vector = __cs3_interrupt_vector_cortex_m;
50  *(.cs3.interrupt_vector)
51  /* Make sure we pulled in an interrupt vector. */
52  ASSERT (. != __cs3_interrupt_vector_cortex_m, "No interrupt vector");
53  *(.rom)
54  *(.rom.b)
55 
56  __cs3_reset = __cs3_reset_cortex_m;
57  *(.cs3.reset)
58  /* Make sure we pulled in some reset code. */
59  ASSERT (. != __cs3_reset, "No reset code");
60 
61  *(.text .text.* .gnu.linkonce.t.*)
62  *(.plt)
63  *(.gnu.warning)
64  *(.glue_7t) *(.glue_7) *(.vfp11_veneer)
65 
66  *(.rodata .rodata.* .gnu.linkonce.r.*)
67 
68  *(.ARM.extab* .gnu.linkonce.armextab.*)
69  *(.gcc_except_table)
70  *(.eh_frame_hdr)
71  *(.eh_frame)
72 
73  . = ALIGN(4);
74  KEEP(*(.init))
75 
76  . = ALIGN(4);
77  __preinit_array_start = .;
78  KEEP (*(.preinit_array))
79  __preinit_array_end = .;
80 
81  . = ALIGN(4);
82  __init_array_start = .;
83  KEEP (*(SORT(.init_array.*)))
84  KEEP (*(.init_array))
85  __init_array_end = .;
86 
87  . = ALIGN(0x4);
88  KEEP (*crtbegin.o(.ctors))
89  KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
90  KEEP (*(SORT(.ctors.*)))
91  KEEP (*crtend.o(.ctors))
92 
93  . = ALIGN(4);
94  KEEP(*(.fini))
95 
96  . = ALIGN(4);
97  __fini_array_start = .;
98  KEEP (*(.fini_array))
99  KEEP (*(SORT(.fini_array.*)))
100  __fini_array_end = .;
101 
102  KEEP (*crtbegin.o(.dtors))
103  KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
104  KEEP (*(SORT(.dtors.*)))
105  KEEP (*crtend.o(.dtors))
106 
107  . = ALIGN(4);
108  __cs3_regions = .;
109  LONG (0)
110  LONG (__cs3_region_init_ram)
111  LONG (__cs3_region_start_ram)
112  LONG (__cs3_region_init_size_ram)
113  LONG (__cs3_region_zero_size_ram)
114  }
115 
116  /* .ARM.exidx is sorted, so has to go in its own output section. */
117  __exidx_start = .;
118  .ARM.exidx :
119  {
120  *(.ARM.exidx* .gnu.linkonce.armexidx.*)
121  } >rom
122  __exidx_end = .;
123  .text.align :
124  {
125  . = ALIGN(8);
126  _etext = .;
127  } >rom
128  __cs3_region_size_rom = LENGTH(rom);
129  __cs3_region_num = 1;
130 
131  .data :
132  {
133  __cs3_region_start_ram = .;
134  *(.cs3.region-head.ram)
135  KEEP(*(.jcr))
136  *(.got.plt) *(.got)
137  *(.shdata)
138  *(.data .data.* .gnu.linkonce.d.*)
139  *(.ram)
140  . = ALIGN (8);
141  _edata = .;
142  } >ram AT>rom
143  .bss :
144  {
145  *(.shbss)
146  *(.bss .bss.* .gnu.linkonce.b.*)
147  *(COMMON)
148  *(.ram.b)
149  . = ALIGN (8);
150  _end = .;
151  __end = .;
152  } >ram AT>rom
153  .heap :
154  {
155  *(.heap)
156  } >ram
157  .stack (__cs3_stack - __cs3_stack_size) :
158  {
159  *(.stack)
160  } >ram
161  __cs3_region_init_ram = LOADADDR (.data);
162  __cs3_region_init_size_ram = _edata - __cs3_region_start_ram;
163  __cs3_region_zero_size_ram = _end - _edata;
164  __cs3_region_size_ram = LENGTH(ram);
165  __cs3_region_num = 1;
166 
167  .stab 0 (NOLOAD) : { *(.stab) }
168  .stabstr 0 (NOLOAD) : { *(.stabstr) }
169  /* DWARF debug sections.
170  * Symbols in the DWARF debugging sections are relative to the beginning
171  * of the section so we begin them at 0. */
172  /* DWARF 1 */
173  .debug 0 : { *(.debug) }
174  .line 0 : { *(.line) }
175  /* GNU DWARF 1 extensions */
176  .debug_srcinfo 0 : { *(.debug_srcinfo) }
177  .debug_sfnames 0 : { *(.debug_sfnames) }
178  /* DWARF 1.1 and DWARF 2 */
179  .debug_aranges 0 : { *(.debug_aranges) }
180  .debug_pubnames 0 : { *(.debug_pubnames) }
181  /* DWARF 2 */
182  .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
183  .debug_abbrev 0 : { *(.debug_abbrev) }
184  .debug_line 0 : { *(.debug_line) }
185  .debug_frame 0 : { *(.debug_frame) }
186  .debug_str 0 : { *(.debug_str) }
187  .debug_loc 0 : { *(.debug_loc) }
188  .debug_macinfo 0 : { *(.debug_macinfo) }
189  /* SGI/MIPS DWARF 2 extensions */
190  .debug_weaknames 0 : { *(.debug_weaknames) }
191  .debug_funcnames 0 : { *(.debug_funcnames) }
192  .debug_typenames 0 : { *(.debug_typenames) }
193  .debug_varnames 0 : { *(.debug_varnames) }
194 
195  .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
196  .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) }
197  /DISCARD/ : { *(.note.GNU-stack) }
198 }