1*3d8817e4Smiod#!/bin/sh 2*3d8817e4Smiod 3*3d8817e4SmiodHEAP_SECTION_MSP430=" " 4*3d8817e4SmiodHEAP_MEMORY_MSP430=" " 5*3d8817e4Smiod 6*3d8817e4Smiodif test ${GOT_HEAP_MSP-0} -ne 0 7*3d8817e4Smiodthen 8*3d8817e4SmiodHEAP_SECTION_MSP430=".heap ${RELOCATING-0} : 9*3d8817e4Smiod { 10*3d8817e4Smiod ${RELOCATING+ PROVIDE (__heap_data_start = .) ; } 11*3d8817e4Smiod *(.heap*) 12*3d8817e4Smiod ${RELOCATING+ PROVIDE (_heap_data_end = .) ; } 13*3d8817e4Smiod ${RELOCATING+. = ALIGN(2);} 14*3d8817e4Smiod ${RELOCATING+ PROVIDE (__heap_bottom = .) ; } 15*3d8817e4Smiod ${RELOCATING+ PROVIDE (__heap_top = ${HEAP_START} + ${HEAP_LENGTH}) ; } 16*3d8817e4Smiod } ${RELOCATING+ > heap}" 17*3d8817e4SmiodHEAP_MEMORY_MSP430="heap(rwx) : ORIGIN = $HEAP_START, LENGTH = $HEAP_LENGTH" 18*3d8817e4Smiodfi 19*3d8817e4Smiod 20*3d8817e4Smiod 21*3d8817e4Smiodcat <<EOF 22*3d8817e4SmiodOUTPUT_FORMAT("${OUTPUT_FORMAT}","${OUTPUT_FORMAT}","${OUTPUT_FORMAT}") 23*3d8817e4SmiodOUTPUT_ARCH(${ARCH}) 24*3d8817e4Smiod 25*3d8817e4SmiodMEMORY 26*3d8817e4Smiod{ 27*3d8817e4Smiod text (rx) : ORIGIN = $ROM_START, LENGTH = $ROM_SIZE 28*3d8817e4Smiod data (rwx) : ORIGIN = $RAM_START, LENGTH = $RAM_SIZE 29*3d8817e4Smiod vectors (rw) : ORIGIN = 0xffe0, LENGTH = 0x20 30*3d8817e4Smiod bootloader(rx) : ORIGIN = 0x0c00, LENGTH = 1K 31*3d8817e4Smiod infomem(rx) : ORIGIN = 0x1000, LENGTH = 256 32*3d8817e4Smiod infomemnobits(rx) : ORIGIN = 0x1000, LENGTH = 256 33*3d8817e4Smiod ${HEAP_MEMORY_MSP430} 34*3d8817e4Smiod} 35*3d8817e4Smiod 36*3d8817e4SmiodSECTIONS 37*3d8817e4Smiod{ 38*3d8817e4Smiod /* Read-only sections, merged into text segment. */ 39*3d8817e4Smiod ${TEXT_DYNAMIC+${DYNAMIC}} 40*3d8817e4Smiod .hash ${RELOCATING-0} : { *(.hash) } 41*3d8817e4Smiod .dynsym ${RELOCATING-0} : { *(.dynsym) } 42*3d8817e4Smiod .dynstr ${RELOCATING-0} : { *(.dynstr) } 43*3d8817e4Smiod .gnu.version ${RELOCATING-0} : { *(.gnu.version) } 44*3d8817e4Smiod .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) } 45*3d8817e4Smiod .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) } 46*3d8817e4Smiod 47*3d8817e4Smiod .rel.init ${RELOCATING-0} : { *(.rel.init) } 48*3d8817e4Smiod .rela.init ${RELOCATING-0} : { *(.rela.init) } 49*3d8817e4Smiod .rel.text ${RELOCATING-0} : 50*3d8817e4Smiod { 51*3d8817e4Smiod *(.rel.text) 52*3d8817e4Smiod ${RELOCATING+*(.rel.text.*)} 53*3d8817e4Smiod ${RELOCATING+*(.rel.gnu.linkonce.t*)} 54*3d8817e4Smiod } 55*3d8817e4Smiod .rela.text ${RELOCATING-0} : 56*3d8817e4Smiod { 57*3d8817e4Smiod *(.rela.text) 58*3d8817e4Smiod ${RELOCATING+*(.rela.text.*)} 59*3d8817e4Smiod ${RELOCATING+*(.rela.gnu.linkonce.t*)} 60*3d8817e4Smiod } 61*3d8817e4Smiod .rel.fini ${RELOCATING-0} : { *(.rel.fini) } 62*3d8817e4Smiod .rela.fini ${RELOCATING-0} : { *(.rela.fini) } 63*3d8817e4Smiod .rel.rodata ${RELOCATING-0} : 64*3d8817e4Smiod { 65*3d8817e4Smiod *(.rel.rodata) 66*3d8817e4Smiod ${RELOCATING+*(.rel.rodata.*)} 67*3d8817e4Smiod ${RELOCATING+*(.rel.gnu.linkonce.r*)} 68*3d8817e4Smiod } 69*3d8817e4Smiod .rela.rodata ${RELOCATING-0} : 70*3d8817e4Smiod { 71*3d8817e4Smiod *(.rela.rodata) 72*3d8817e4Smiod ${RELOCATING+*(.rela.rodata.*)} 73*3d8817e4Smiod ${RELOCATING+*(.rela.gnu.linkonce.r*)} 74*3d8817e4Smiod } 75*3d8817e4Smiod .rel.data ${RELOCATING-0} : 76*3d8817e4Smiod { 77*3d8817e4Smiod *(.rel.data) 78*3d8817e4Smiod ${RELOCATING+*(.rel.data.*)} 79*3d8817e4Smiod ${RELOCATING+*(.rel.gnu.linkonce.d*)} 80*3d8817e4Smiod } 81*3d8817e4Smiod .rela.data ${RELOCATING-0} : 82*3d8817e4Smiod { 83*3d8817e4Smiod *(.rela.data) 84*3d8817e4Smiod ${RELOCATING+*(.rela.data.*)} 85*3d8817e4Smiod ${RELOCATING+*(.rela.gnu.linkonce.d*)} 86*3d8817e4Smiod } 87*3d8817e4Smiod .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) } 88*3d8817e4Smiod .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } 89*3d8817e4Smiod .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) } 90*3d8817e4Smiod .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) } 91*3d8817e4Smiod .rel.got ${RELOCATING-0} : { *(.rel.got) } 92*3d8817e4Smiod .rela.got ${RELOCATING-0} : { *(.rela.got) } 93*3d8817e4Smiod .rel.bss ${RELOCATING-0} : { *(.rel.bss) } 94*3d8817e4Smiod .rela.bss ${RELOCATING-0} : { *(.rela.bss) } 95*3d8817e4Smiod .rel.plt ${RELOCATING-0} : { *(.rel.plt) } 96*3d8817e4Smiod .rela.plt ${RELOCATING-0} : { *(.rela.plt) } 97*3d8817e4Smiod 98*3d8817e4Smiod /* Internal text space. */ 99*3d8817e4Smiod .text : 100*3d8817e4Smiod { 101*3d8817e4Smiod ${RELOCATING+. = ALIGN(2);} 102*3d8817e4Smiod *(.init) 103*3d8817e4Smiod *(.init0) /* Start here after reset. */ 104*3d8817e4Smiod *(.init1) 105*3d8817e4Smiod *(.init2) /* Copy data loop */ 106*3d8817e4Smiod *(.init3) 107*3d8817e4Smiod *(.init4) /* Clear bss */ 108*3d8817e4Smiod *(.init5) 109*3d8817e4Smiod *(.init6) /* C++ constructors. */ 110*3d8817e4Smiod *(.init7) 111*3d8817e4Smiod *(.init8) 112*3d8817e4Smiod *(.init9) /* Call main(). */ 113*3d8817e4Smiod 114*3d8817e4Smiod ${CONSTRUCTING+ __ctors_start = . ; } 115*3d8817e4Smiod ${CONSTRUCTING+ *(.ctors) } 116*3d8817e4Smiod ${CONSTRUCTING+ __ctors_end = . ; } 117*3d8817e4Smiod ${CONSTRUCTING+ __dtors_start = . ; } 118*3d8817e4Smiod ${CONSTRUCTING+ *(.dtors) } 119*3d8817e4Smiod ${CONSTRUCTING+ __dtors_end = . ; } 120*3d8817e4Smiod 121*3d8817e4Smiod ${RELOCATING+. = ALIGN(2);} 122*3d8817e4Smiod *(.text) 123*3d8817e4Smiod ${RELOCATING+. = ALIGN(2);} 124*3d8817e4Smiod *(.text.*) 125*3d8817e4Smiod 126*3d8817e4Smiod ${RELOCATING+. = ALIGN(2);} 127*3d8817e4Smiod *(.fini9) /* */ 128*3d8817e4Smiod *(.fini8) 129*3d8817e4Smiod *(.fini7) 130*3d8817e4Smiod *(.fini6) /* C++ destructors. */ 131*3d8817e4Smiod *(.fini5) 132*3d8817e4Smiod *(.fini4) 133*3d8817e4Smiod *(.fini3) 134*3d8817e4Smiod *(.fini2) 135*3d8817e4Smiod *(.fini1) 136*3d8817e4Smiod *(.fini0) /* Infinite loop after program termination. */ 137*3d8817e4Smiod *(.fini) 138*3d8817e4Smiod 139*3d8817e4Smiod _etext = .; 140*3d8817e4Smiod } ${RELOCATING+ > text} 141*3d8817e4Smiod 142*3d8817e4Smiod .data ${RELOCATING-0} : ${RELOCATING+AT (ADDR (.text) + SIZEOF (.text))} 143*3d8817e4Smiod { 144*3d8817e4Smiod ${RELOCATING+ PROVIDE (__data_start = .) ; } 145*3d8817e4Smiod ${RELOCATING+. = ALIGN(2);} 146*3d8817e4Smiod *(.data) 147*3d8817e4Smiod ${RELOCATING+. = ALIGN(2);} 148*3d8817e4Smiod *(.gnu.linkonce.d*) 149*3d8817e4Smiod ${RELOCATING+. = ALIGN(2);} 150*3d8817e4Smiod ${RELOCATING+ _edata = . ; } 151*3d8817e4Smiod } ${RELOCATING+ > data} 152*3d8817e4Smiod 153*3d8817e4Smiod /* Bootloader. */ 154*3d8817e4Smiod .bootloader ${RELOCATING-0} : 155*3d8817e4Smiod { 156*3d8817e4Smiod ${RELOCATING+ PROVIDE (__boot_start = .) ; } 157*3d8817e4Smiod *(.bootloader) 158*3d8817e4Smiod ${RELOCATING+. = ALIGN(2);} 159*3d8817e4Smiod *(.bootloader.*) 160*3d8817e4Smiod } ${RELOCATING+ > bootloader} 161*3d8817e4Smiod 162*3d8817e4Smiod /* Information memory. */ 163*3d8817e4Smiod .infomem ${RELOCATING-0} : 164*3d8817e4Smiod { 165*3d8817e4Smiod *(.infomem) 166*3d8817e4Smiod ${RELOCATING+. = ALIGN(2);} 167*3d8817e4Smiod *(.infomem.*) 168*3d8817e4Smiod } ${RELOCATING+ > infomem} 169*3d8817e4Smiod 170*3d8817e4Smiod /* Information memory (not loaded into MPU). */ 171*3d8817e4Smiod .infomemnobits ${RELOCATING-0} : 172*3d8817e4Smiod { 173*3d8817e4Smiod *(.infomemnobits) 174*3d8817e4Smiod ${RELOCATING+. = ALIGN(2);} 175*3d8817e4Smiod *(.infomemnobits.*) 176*3d8817e4Smiod } ${RELOCATING+ > infomemnobits} 177*3d8817e4Smiod 178*3d8817e4Smiod .bss ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} : 179*3d8817e4Smiod { 180*3d8817e4Smiod ${RELOCATING+ PROVIDE (__bss_start = .) ; } 181*3d8817e4Smiod *(.bss) 182*3d8817e4Smiod *(COMMON) 183*3d8817e4Smiod ${RELOCATING+ PROVIDE (__bss_end = .) ; } 184*3d8817e4Smiod ${RELOCATING+ _end = . ; } 185*3d8817e4Smiod } ${RELOCATING+ > data} 186*3d8817e4Smiod 187*3d8817e4Smiod .noinit ${RELOCATING+ SIZEOF(.bss) + ADDR(.bss)} : 188*3d8817e4Smiod { 189*3d8817e4Smiod ${RELOCATING+ PROVIDE (__noinit_start = .) ; } 190*3d8817e4Smiod *(.noinit) 191*3d8817e4Smiod *(COMMON) 192*3d8817e4Smiod ${RELOCATING+ PROVIDE (__noinit_end = .) ; } 193*3d8817e4Smiod ${RELOCATING+ _end = . ; } 194*3d8817e4Smiod } ${RELOCATING+ > data} 195*3d8817e4Smiod 196*3d8817e4Smiod .vectors ${RELOCATING-0}: 197*3d8817e4Smiod { 198*3d8817e4Smiod ${RELOCATING+ PROVIDE (__vectors_start = .) ; } 199*3d8817e4Smiod *(.vectors*) 200*3d8817e4Smiod ${RELOCATING+ _vectors_end = . ; } 201*3d8817e4Smiod } ${RELOCATING+ > vectors} 202*3d8817e4Smiod 203*3d8817e4Smiod ${HEAP_SECTION_MSP430} 204*3d8817e4Smiod 205*3d8817e4Smiod /* Stabs for profiling information*/ 206*3d8817e4Smiod .profiler 0 : { *(.profiler) } 207*3d8817e4Smiod 208*3d8817e4Smiod /* Stabs debugging sections. */ 209*3d8817e4Smiod .stab 0 : { *(.stab) } 210*3d8817e4Smiod .stabstr 0 : { *(.stabstr) } 211*3d8817e4Smiod .stab.excl 0 : { *(.stab.excl) } 212*3d8817e4Smiod .stab.exclstr 0 : { *(.stab.exclstr) } 213*3d8817e4Smiod .stab.index 0 : { *(.stab.index) } 214*3d8817e4Smiod .stab.indexstr 0 : { *(.stab.indexstr) } 215*3d8817e4Smiod .comment 0 : { *(.comment) } 216*3d8817e4Smiod 217*3d8817e4Smiod /* DWARF debug sections. 218*3d8817e4Smiod Symbols in the DWARF debugging sections are relative to the beginning 219*3d8817e4Smiod of the section so we begin them at 0. */ 220*3d8817e4Smiod 221*3d8817e4Smiod /* DWARF 1 */ 222*3d8817e4Smiod .debug 0 : { *(.debug) } 223*3d8817e4Smiod .line 0 : { *(.line) } 224*3d8817e4Smiod 225*3d8817e4Smiod /* GNU DWARF 1 extensions */ 226*3d8817e4Smiod .debug_srcinfo 0 : { *(.debug_srcinfo) } 227*3d8817e4Smiod .debug_sfnames 0 : { *(.debug_sfnames) } 228*3d8817e4Smiod 229*3d8817e4Smiod /* DWARF 1.1 and DWARF 2 */ 230*3d8817e4Smiod .debug_aranges 0 : { *(.debug_aranges) } 231*3d8817e4Smiod .debug_pubnames 0 : { *(.debug_pubnames) } 232*3d8817e4Smiod 233*3d8817e4Smiod /* DWARF 2 */ 234*3d8817e4Smiod .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) } 235*3d8817e4Smiod .debug_abbrev 0 : { *(.debug_abbrev) } 236*3d8817e4Smiod .debug_line 0 : { *(.debug_line) } 237*3d8817e4Smiod .debug_frame 0 : { *(.debug_frame) } 238*3d8817e4Smiod .debug_str 0 : { *(.debug_str) } 239*3d8817e4Smiod .debug_loc 0 : { *(.debug_loc) } 240*3d8817e4Smiod .debug_macinfo 0 : { *(.debug_macinfo) } 241*3d8817e4Smiod 242*3d8817e4Smiod PROVIDE (__stack = ${STACK}) ; 243*3d8817e4Smiod PROVIDE (__data_start_rom = _etext) ; 244*3d8817e4Smiod PROVIDE (__data_end_rom = _etext + SIZEOF (.data)) ; 245*3d8817e4Smiod PROVIDE (__noinit_start_rom = _etext + SIZEOF (.data)) ; 246*3d8817e4Smiod PROVIDE (__noinit_end_rom = _etext + SIZEOF (.data) + SIZEOF (.noinit)) ; 247*3d8817e4Smiod PROVIDE (__subdevice_has_heap = ${GOT_HEAP_MSP-0}) ; 248*3d8817e4Smiod} 249*3d8817e4SmiodEOF 250