1# Copyright (C) 2014 Free Software Foundation, Inc. 2# 3# Copying and distribution of this file, with or without modification, 4# are permitted in any medium without royalty provided the copyright 5# notice and this notice are preserved. 6 7HEAP_SECTION_MSP430=" " 8HEAP_MEMORY_MSP430=" " 9 10if test ${GOT_HEAP_MSP-0} -ne 0 11then 12HEAP_SECTION_MSP430=".heap ${RELOCATING-0} : 13 { 14 ${RELOCATING+ PROVIDE (__heap_data_start = .) ; } 15 *(.heap*) 16 ${RELOCATING+ PROVIDE (_heap_data_end = .) ; } 17 ${RELOCATING+. = ALIGN(2);} 18 ${RELOCATING+ PROVIDE (__heap_bottom = .) ; } 19 ${RELOCATING+ PROVIDE (__heap_top = ${HEAP_START} + ${HEAP_LENGTH}) ; } 20 } ${RELOCATING+ > heap}" 21HEAP_MEMORY_MSP430="heap(rwx) : ORIGIN = $HEAP_START, LENGTH = $HEAP_LENGTH" 22fi 23 24 25cat <<EOF 26/* Copyright (C) 2014 Free Software Foundation, Inc. 27 28 Copying and distribution of this script, with or without modification, 29 are permitted in any medium without royalty provided the copyright 30 notice and this notice are preserved. */ 31 32OUTPUT_FORMAT("${OUTPUT_FORMAT}","${OUTPUT_FORMAT}","${OUTPUT_FORMAT}") 33OUTPUT_ARCH(${ARCH}) 34 35MEMORY 36{ 37 text (rx) : ORIGIN = $ROM_START, LENGTH = $ROM_SIZE 38 data (rwx) : ORIGIN = $RAM_START, LENGTH = $RAM_SIZE 39 vectors (rw) : ORIGIN = 0xffe0, LENGTH = 0x20 40 bootloader(rx) : ORIGIN = 0x0c00, LENGTH = 1K 41 infomem(rx) : ORIGIN = 0x1000, LENGTH = 256 42 infomemnobits(rx) : ORIGIN = 0x1000, LENGTH = 256 43 ${HEAP_MEMORY_MSP430} 44} 45 46SECTIONS 47{ 48 /* Bootloader. */ 49 .bootloader ${RELOCATING-0} : 50 { 51 ${RELOCATING+ PROVIDE (__boot_start = .) ; } 52 *(.bootloader) 53 ${RELOCATING+. = ALIGN(2);} 54 *(.bootloader.*) 55 } ${RELOCATING+ > bootloader} 56 57 /* Information memory. */ 58 .infomem ${RELOCATING-0} : 59 { 60 *(.infomem) 61 ${RELOCATING+. = ALIGN(2);} 62 *(.infomem.*) 63 } ${RELOCATING+ > infomem} 64 65 /* Information memory (not loaded into MPU). */ 66 .infomemnobits ${RELOCATING-0} : 67 { 68 *(.infomemnobits) 69 ${RELOCATING+. = ALIGN(2);} 70 *(.infomemnobits.*) 71 } ${RELOCATING+ > infomemnobits} 72 73 /* Read-only sections, merged into text segment. */ 74 ${TEXT_DYNAMIC+${DYNAMIC}} 75 .hash ${RELOCATING-0} : { *(.hash) } 76 .dynsym ${RELOCATING-0} : { *(.dynsym) } 77 .dynstr ${RELOCATING-0} : { *(.dynstr) } 78 .gnu.version ${RELOCATING-0} : { *(.gnu.version) } 79 .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) } 80 .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) } 81 82 .rel.init ${RELOCATING-0} : { *(.rel.init) } 83 .rela.init ${RELOCATING-0} : { *(.rela.init) } 84 .rel.text ${RELOCATING-0} : 85 { 86 *(.rel.text) 87 ${RELOCATING+*(.rel.text.*)} 88 ${RELOCATING+*(.rel.gnu.linkonce.t*)} 89 } 90 .rela.text ${RELOCATING-0} : 91 { 92 *(.rela.text) 93 ${RELOCATING+*(.rela.text.*)} 94 ${RELOCATING+*(.rela.gnu.linkonce.t*)} 95 } 96 .rel.fini ${RELOCATING-0} : { *(.rel.fini) } 97 .rela.fini ${RELOCATING-0} : { *(.rela.fini) } 98 .rel.rodata ${RELOCATING-0} : 99 { 100 *(.rel.rodata) 101 ${RELOCATING+*(.rel.rodata.*)} 102 ${RELOCATING+*(.rel.gnu.linkonce.r*)} 103 } 104 .rela.rodata ${RELOCATING-0} : 105 { 106 *(.rela.rodata) 107 ${RELOCATING+*(.rela.rodata.*)} 108 ${RELOCATING+*(.rela.gnu.linkonce.r*)} 109 } 110 .rel.data ${RELOCATING-0} : 111 { 112 *(.rel.data) 113 ${RELOCATING+*(.rel.data.*)} 114 ${RELOCATING+*(.rel.gnu.linkonce.d*)} 115 } 116 .rela.data ${RELOCATING-0} : 117 { 118 *(.rela.data) 119 ${RELOCATING+*(.rela.data.*)} 120 ${RELOCATING+*(.rela.gnu.linkonce.d*)} 121 } 122 .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) } 123 .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } 124 .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) } 125 .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) } 126 .rel.got ${RELOCATING-0} : { *(.rel.got) } 127 .rela.got ${RELOCATING-0} : { *(.rela.got) } 128 .rel.bss ${RELOCATING-0} : { *(.rel.bss) } 129 .rela.bss ${RELOCATING-0} : { *(.rela.bss) } 130 .rel.plt ${RELOCATING-0} : { *(.rel.plt) } 131 .rela.plt ${RELOCATING-0} : { *(.rela.plt) } 132 133 /* Internal text space. */ 134 .text : 135 { 136 ${RELOCATING+. = ALIGN(2);} 137 *(SORT_NONE(.init)) 138 *(SORT_NONE(.init0)) /* Start here after reset. */ 139 *(SORT_NONE(.init1)) 140 *(SORT_NONE(.init2)) /* Copy data loop */ 141 *(SORT_NONE(.init3)) 142 *(SORT_NONE(.init4)) /* Clear bss */ 143 *(SORT_NONE(.init5)) 144 *(SORT_NONE(.init6)) /* C++ constructors. */ 145 *(SORT_NONE(.init7)) 146 *(SORT_NONE(.init8)) 147 *(SORT_NONE(.init9)) /* Call main(). */ 148 149 ${CONSTRUCTING+ __ctors_start = . ; } 150 ${CONSTRUCTING+ *(.ctors) } 151 ${CONSTRUCTING+ __ctors_end = . ; } 152 ${CONSTRUCTING+ __dtors_start = . ; } 153 ${CONSTRUCTING+ *(.dtors) } 154 ${CONSTRUCTING+ __dtors_end = . ; } 155 156 ${RELOCATING+. = ALIGN(2);} 157 *(.text) 158 ${RELOCATING+. = ALIGN(2);} 159 *(.text.*) 160 ${RELOCATING+. = ALIGN(2);} 161 *(.text:*) 162 163 ${RELOCATING+. = ALIGN(2);} 164 *(SORT_NONE(.fini9)) 165 *(SORT_NONE(.fini8)) 166 *(SORT_NONE(.fini7)) 167 *(SORT_NONE(.fini6)) /* C++ destructors. */ 168 *(SORT_NONE(.fini5)) 169 *(SORT_NONE(.fini4)) 170 *(SORT_NONE(.fini3)) 171 *(SORT_NONE(.fini2)) 172 *(SORT_NONE(.fini1)) 173 *(SORT_NONE(.fini0)) /* Infinite loop after program termination. */ 174 *(SORT_NONE(.fini)) 175 176 _etext = .; 177 } ${RELOCATING+ > text} 178 179 .rodata : 180 { 181 . = ALIGN(2); 182 *(.plt) 183 *(.rodata .rodata.* .gnu.linkonce.r.* .const .const:*) 184 *(.rodata1) 185 186 *(.eh_frame_hdr) 187 KEEP (*(.eh_frame)) 188 189 KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) 190 191 PROVIDE (__preinit_array_start = .); 192 KEEP (*(.preinit_array)) 193 PROVIDE (__preinit_array_end = .); 194 195 PROVIDE (__init_array_start = .); 196 KEEP (*(SORT(.init_array.*))) 197 KEEP (*(.init_array)) 198 PROVIDE (__init_array_end = .); 199 200 PROVIDE (__fini_array_start = .); 201 KEEP (*(.fini_array)) 202 KEEP (*(SORT(.fini_array.*))) 203 PROVIDE (__fini_array_end = .); 204 LONG(0); /* Sentinel. */ 205 206 /* gcc uses crtbegin.o to find the start of the constructors, so 207 we make sure it is first. Because this is a wildcard, it 208 doesn't matter if the user does not actually link against 209 crtbegin.o; the linker won't look for a file to match a 210 wildcard. The wildcard also means that it doesn't matter which 211 directory crtbegin.o is in. */ 212 KEEP (*crtbegin*.o(.ctors)) 213 214 /* We don't want to include the .ctor section from from the 215 crtend.o file until after the sorted ctors. The .ctor section 216 from the crtend file contains the end of ctors marker and it 217 must be last */ 218 KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors)) 219 KEEP (*(SORT(.ctors.*))) 220 KEEP (*(.ctors)) 221 222 KEEP (*crtbegin*.o(.dtors)) 223 KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors)) 224 KEEP (*(SORT(.dtors.*))) 225 KEEP (*(.dtors)) 226 } ${RELOCATING+ > text} 227 228 .vectors ${RELOCATING-0}: 229 { 230 ${RELOCATING+ PROVIDE (__vectors_start = .) ; } 231 *(.vectors*) 232 ${RELOCATING+ _vectors_end = . ; } 233 } ${RELOCATING+ > vectors} 234 235 .data ${RELOCATING-0} : 236 { 237 ${RELOCATING+ PROVIDE (__data_start = .) ; } 238 ${RELOCATING+ PROVIDE (__datastart = .) ; } 239 ${RELOCATING+. = ALIGN(2);} 240 241 KEEP (*(.jcr)) 242 *(.data.rel.ro.local) *(.data.rel.ro*) 243 *(.dynamic) 244 245 *(.data) 246 *(.data.*) 247 *(.gnu.linkonce.d*) 248 KEEP (*(.gnu.linkonce.d.*personality*)) 249 *(.data1) 250 *(.got.plt) *(.got) 251 ${RELOCATING+. = ALIGN(2);} 252 *(.sdata .sdata.* .gnu.linkonce.s.*) 253 ${RELOCATING+. = ALIGN(2);} 254 ${RELOCATING+ _edata = . ; } 255 } ${RELOCATING+ > data ${RELOCATING+AT> text}} 256 257 .bss ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} : 258 { 259 ${RELOCATING+. = ALIGN(2);} 260 ${RELOCATING+ PROVIDE (__bss_start = .) ; } 261 *(.bss) 262 *(COMMON) 263 ${RELOCATING+ PROVIDE (__bss_end = .) ; } 264 ${RELOCATING+ _end = . ; } 265 } ${RELOCATING+ > data} 266 267 .noinit ${RELOCATING+ SIZEOF(.bss) + ADDR(.bss)} : 268 { 269 ${RELOCATING+ PROVIDE (__noinit_start = .) ; } 270 *(.noinit) 271 *(COMMON) 272 ${RELOCATING+ PROVIDE (__noinit_end = .) ; } 273 ${RELOCATING+ _end = . ; } 274 } ${RELOCATING+ > data} 275 276 ${HEAP_SECTION_MSP430} 277 278 /* Stabs for profiling information*/ 279 .profiler 0 : { *(.profiler) } 280 281 /* Stabs debugging sections. */ 282 .stab 0 : { *(.stab) } 283 .stabstr 0 : { *(.stabstr) } 284 .stab.excl 0 : { *(.stab.excl) } 285 .stab.exclstr 0 : { *(.stab.exclstr) } 286 .stab.index 0 : { *(.stab.index) } 287 .stab.indexstr 0 : { *(.stab.indexstr) } 288 .comment 0 : { *(.comment) } 289EOF 290 291source $srcdir/scripttempl/DWARF.sc 292 293cat <<EOF 294 .MP430.attributes 0 : 295 { 296 KEEP (*(.MSP430.attributes)) 297 KEEP (*(.gnu.attributes)) 298 KEEP (*(__TI_build_attributes)) 299 } 300 301 PROVIDE (__stack = ${STACK}) ; 302 PROVIDE (__data_start_rom = _etext) ; 303 PROVIDE (__data_end_rom = _etext + SIZEOF (.data)) ; 304 PROVIDE (__noinit_start_rom = _etext + SIZEOF (.data)) ; 305 PROVIDE (__noinit_end_rom = _etext + SIZEOF (.data) + SIZEOF (.noinit)) ; 306 PROVIDE (__subdevice_has_heap = ${GOT_HEAP_MSP-0}) ; 307} 308EOF 309