1/* Linker script for Energy Micro EFM32G 2 * 3 * Version: Sourcery CodeBench Lite 2011.09-69 4 * Support: https://support.codesourcery.com/GNUToolchain/ 5 * 6 * Copyright (c) 2007, 2008, 2009, 2010 CodeSourcery, Inc. 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 19OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") 20ENTRY(__cs3_reset) 21 22 23MEMORY 24{ 25 rom (rx) : ORIGIN = 0x00000000, LENGTH = 131072 26 ram (rwx) : ORIGIN = 0x20000000, LENGTH = 16384 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 */ 33 34EXTERN(__cs3_reset __cs3_reset_em) 35EXTERN(__cs3_start_asm _start) 36EXTERN(__cs3_stack) 37EXTERN(__cs3_reset) 38 39EXTERN(__cs3_interrupt_vector_em) 40EXTERN(__cs3_start_c main __cs3_stack __cs3_heap_end) 41 42/* Provide fall-back values */ 43PROVIDE(__cs3_heap_start = _end); 44PROVIDE(__cs3_heap_end = __cs3_region_start_ram + __cs3_region_size_ram); 45PROVIDE(__cs3_region_num = (__cs3_regions_end - __cs3_regions) / 20); 46PROVIDE(__cs3_stack = __cs3_region_start_ram + __cs3_region_size_ram); 47 48SECTIONS 49{ 50 .text : 51 { 52 CREATE_OBJECT_SYMBOLS 53 __cs3_region_start_rom = .; 54 *(.cs3.region-head.rom) 55 ASSERT (. == __cs3_region_start_rom, ".cs3.region-head.rom not permitted"); 56 __cs3_interrupt_vector = __cs3_interrupt_vector_em; 57 *(.cs3.interrupt_vector) 58 /* Make sure we pulled in an interrupt vector. */ 59 ASSERT (. != __cs3_interrupt_vector_em, "No interrupt vector"); 60 61 PROVIDE(__cs3_reset = __cs3_reset_em); 62 *(.cs3.reset) 63 PROVIDE(__cs3_start_asm = _start); 64 65 *(.text.cs3.init) 66 *(.text .text.* .gnu.linkonce.t.*) 67 *(.plt) 68 *(.gnu.warning) 69 *(.glue_7t) *(.glue_7) *(.vfp11_veneer) 70 71 *(.ARM.extab* .gnu.linkonce.armextab.*) 72 *(.gcc_except_table) 73 } >rom 74 .eh_frame_hdr : ALIGN (4) 75 { 76 KEEP (*(.eh_frame_hdr)) 77 } >rom 78 .eh_frame : ALIGN (4) 79 { 80 KEEP (*(.eh_frame)) 81 } >rom 82 /* .ARM.exidx is sorted, so has to go in its own output section. */ 83 PROVIDE_HIDDEN (__exidx_start = .); 84 .ARM.exidx : 85 { 86 *(.ARM.exidx* .gnu.linkonce.armexidx.*) 87 } >rom 88 PROVIDE_HIDDEN (__exidx_end = .); 89 .rodata : ALIGN (4) 90 { 91 *(.rodata .rodata.* .gnu.linkonce.r.*) 92 93 . = ALIGN(4); 94 KEEP(*(.init)) 95 96 . = ALIGN(4); 97 __preinit_array_start = .; 98 KEEP (*(.preinit_array)) 99 __preinit_array_end = .; 100 101 . = ALIGN(4); 102 __init_array_start = .; 103 KEEP (*(SORT(.init_array.*))) 104 KEEP (*(.init_array)) 105 __init_array_end = .; 106 107 . = ALIGN(4); 108 KEEP(*(.fini)) 109 110 . = ALIGN(4); 111 __fini_array_start = .; 112 KEEP (*(.fini_array)) 113 KEEP (*(SORT(.fini_array.*))) 114 __fini_array_end = .; 115 116 . = ALIGN(0x4); 117 KEEP (*crtbegin.o(.ctors)) 118 KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) 119 KEEP (*(SORT(.ctors.*))) 120 KEEP (*crtend.o(.ctors)) 121 122 . = ALIGN(0x4); 123 KEEP (*crtbegin.o(.dtors)) 124 KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) 125 KEEP (*(SORT(.dtors.*))) 126 KEEP (*crtend.o(.dtors)) 127 128 . = ALIGN(4); 129 __cs3_regions = .; 130 LONG (0) 131 LONG (__cs3_region_init_ram) 132 LONG (__cs3_region_start_ram) 133 LONG (__cs3_region_init_size_ram) 134 LONG (__cs3_region_zero_size_ram) 135 __cs3_regions_end = .; 136 . = ALIGN (8); 137 *(.rom) 138 *(.rom.b .bss.rom) 139 _etext = .; 140 } >rom 141 /* __cs3_region_end_rom is deprecated */ 142 __cs3_region_end_rom = __cs3_region_start_rom + LENGTH(rom); 143 __cs3_region_size_rom = LENGTH(rom); 144 145 .data : ALIGN (8) 146 { 147 __cs3_region_start_ram = .; 148 *(.cs3.region-head.ram) 149 KEEP(*(.jcr)) 150 *(.got.plt) *(.got) 151 *(.shdata) 152 *(.data .data.* .gnu.linkonce.d.*) 153 . = ALIGN (8); 154 *(.ram) 155 . = ALIGN (8); 156 _edata = .; 157 } >ram AT>rom 158 .bss : ALIGN (8) 159 { 160 *(.shbss) 161 *(.bss .bss.* .gnu.linkonce.b.*) 162 *(COMMON) 163 . = ALIGN (8); 164 *(.ram.b .bss.ram) 165 . = ALIGN (8); 166 _end = .; 167 __end = .; 168 } >ram 169 /* __cs3_region_end_ram is deprecated */ 170 __cs3_region_end_ram = __cs3_region_start_ram + LENGTH(ram); 171 __cs3_region_size_ram = LENGTH(ram); 172 __cs3_region_init_ram = LOADADDR (.data); 173 __cs3_region_init_size_ram = _edata - ADDR (.data); 174 __cs3_region_zero_size_ram = _end - _edata; 175 176 .stab 0 (NOLOAD) : { *(.stab) } 177 .stabstr 0 (NOLOAD) : { *(.stabstr) } 178 /* DWARF debug sections. 179 * Symbols in the DWARF debugging sections are relative to 180 * the beginning of the section so we begin them at 0. 181 */ 182 /* DWARF 1 */ 183 .debug 0 : { *(.debug) } 184 .line 0 : { *(.line) } 185 /* GNU DWARF 1 extensions */ 186 .debug_srcinfo 0 : { *(.debug_srcinfo) } 187 .debug_sfnames 0 : { *(.debug_sfnames) } 188 /* DWARF 1.1 and DWARF 2 */ 189 .debug_aranges 0 : { *(.debug_aranges) } 190 .debug_pubnames 0 : { *(.debug_pubnames) } 191 /* DWARF 2 */ 192 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 193 .debug_abbrev 0 : { *(.debug_abbrev) } 194 .debug_line 0 : { *(.debug_line) } 195 .debug_frame 0 : { *(.debug_frame) } 196 .debug_str 0 : { *(.debug_str) } 197 .debug_loc 0 : { *(.debug_loc) } 198 .debug_macinfo 0 : { *(.debug_macinfo) } 199 /* DWARF 2.1 */ 200 .debug_ranges 0 : { *(.debug_ranges) } 201 /* SGI/MIPS DWARF 2 extensions */ 202 .debug_weaknames 0 : { *(.debug_weaknames) } 203 .debug_funcnames 0 : { *(.debug_funcnames) } 204 .debug_typenames 0 : { *(.debug_typenames) } 205 .debug_varnames 0 : { *(.debug_varnames) } 206 207 .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) } 208 .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) } 209 /DISCARD/ : { *(.note.GNU-stack) } 210} 211