1 /* Linker script for Cortex-M0
3 * Version:CodeSourcery Sourcery G++ Lite 2007q3-53
4 * BugURL:https://support.codesourcery.com/GNUToolchain/
6 * Copyright 2007 CodeSourcery.
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
18 OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
21 GROUP(-lgcc -lc -lcs3 -lcs3unhosted -lcs3micro)
25 rom (rx) : ORIGIN = 0x00000000, LENGTH = 64K
26 ram (rwx) : ORIGIN = 0x20000000, LENGTH = 8K
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
33 EXTERN(__cs3_reset_cortex_m)
34 EXTERN(__cs3_interrupt_vector_cortex_m)
35 EXTERN(__cs3_start_c main __cs3_stack __cs3_stack_size __cs3_heap_end)
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);
39 PROVIDE(__cs3_heap_start = _end);
40 PROVIDE(__cs3_heap_end = __cs3_region_start_ram + __cs3_region_size_ram);
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");
56 __cs3_reset = __cs3_reset_cortex_m;
58 /* Make sure we pulled in some reset code. */
59 ASSERT (. != __cs3_reset, "No reset code");
61 *(.text .text.* .gnu.linkonce.t.*)
64 *(.glue_7t) *(.glue_7) *(.vfp11_veneer)
66 *(.rodata .rodata.* .gnu.linkonce.r.*)
68 *(.ARM.extab* .gnu.linkonce.armextab.*)
77 __preinit_array_start = .;
78 KEEP (*(.preinit_array))
79 __preinit_array_end = .;
82 __init_array_start = .;
83 KEEP (*(SORT(.init_array.*)))
88 KEEP (*crtbegin.o(.ctors))
89 KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
90 KEEP (*(SORT(.ctors.*)))
91 KEEP (*crtend.o(.ctors))
97 __fini_array_start = .;
99 KEEP (*(SORT(.fini_array.*)))
100 __fini_array_end = .;
102 KEEP (*crtbegin.o(.dtors))
103 KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
104 KEEP (*(SORT(.dtors.*)))
105 KEEP (*crtend.o(.dtors))
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)
116 /* .ARM.exidx is sorted, so has to go in its own output section. */
120 *(.ARM.exidx* .gnu.linkonce.armexidx.*)
128 __cs3_region_size_rom = LENGTH(rom);
129 __cs3_region_num = 1;
133 __cs3_region_start_ram = .;
134 *(.cs3.region-head.ram)
138 *(.data .data.* .gnu.linkonce.d.*)
146 *(.bss .bss.* .gnu.linkonce.b.*)
157 .stack (__cs3_stack - __cs3_stack_size) :
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;
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. */
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) }
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) }
195 .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
196 .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) }
197 /DISCARD/ : { *(.note.GNU-stack) }