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