fdcba1b13ec09329372bc396e5c479f21737df6a
[goodfet] / firmware / ldscripts / 161x.x
1
2 /* Extra-neighborly linking script, targetting the MSP430F1611 and F1612.
3    by Travis Goodspeed
4    <travis at radiantmachines.com>
5 */
6 /* Space from 0x2500 to 0x4000 (5K) is RAM on the 1611, flash on the 1612.
7    It is unused here, but it might be used as a buffer or something through
8    pointer referencing.
9 */
10
11 OUTPUT_FORMAT("elf32-msp430","elf32-msp430","elf32-msp430")
12 OUTPUT_ARCH(msp:16)
13 MEMORY
14 {
15   text   (rx)           : ORIGIN = 0x4000,      LENGTH = 0xbfe0
16   data   (rwx)          : ORIGIN = 0x1100,      LENGTH = 0x1400
17   vectors (rw)          : ORIGIN = 0xffe0,      LENGTH = 0x20
18   bootloader(rx)        : ORIGIN = 0x0c00,      LENGTH = 1K
19   infomem(rx)           : ORIGIN = 0x1000,      LENGTH = 256
20   infomemnobits(rx)     : ORIGIN = 0x1000,      LENGTH = 256
21 }
22 SECTIONS
23 {
24   /* Read-only sections, merged into text segment.  */
25   .hash          : { *(.hash)             }
26   .dynsym        : { *(.dynsym)           }
27   .dynstr        : { *(.dynstr)           }
28   .gnu.version   : { *(.gnu.version)      }
29   .gnu.version_d   : { *(.gnu.version_d)  }
30   .gnu.version_r   : { *(.gnu.version_r)  }
31   .rel.init      : { *(.rel.init) }
32   .rela.init     : { *(.rela.init) }
33   .rel.text      :
34     {
35       *(.rel.text)
36       *(.rel.text.*)
37       *(.rel.gnu.linkonce.t*)
38     }
39   .rela.text     :
40     {
41       *(.rela.text)
42       *(.rela.text.*)
43       *(.rela.gnu.linkonce.t*)
44     }
45   .rel.fini      : { *(.rel.fini) }
46   .rela.fini     : { *(.rela.fini) }
47   .rel.rodata    :
48     {
49       *(.rel.rodata)
50       *(.rel.rodata.*)
51       *(.rel.gnu.linkonce.r*)
52     }
53   .rela.rodata   :
54     {
55       *(.rela.rodata)
56       *(.rela.rodata.*)
57       *(.rela.gnu.linkonce.r*)
58     }
59   .rel.data      :
60     {
61       *(.rel.data)
62       *(.rel.data.*)
63       *(.rel.gnu.linkonce.d*)
64     }
65   .rela.data     :
66     {
67       *(.rela.data)
68       *(.rela.data.*)
69       *(.rela.gnu.linkonce.d*)
70     }
71   .rel.ctors     : { *(.rel.ctors)        }
72   .rela.ctors    : { *(.rela.ctors)       }
73   .rel.dtors     : { *(.rel.dtors)        }
74   .rela.dtors    : { *(.rela.dtors)       }
75   .rel.got       : { *(.rel.got)          }
76   .rela.got      : { *(.rela.got)         }
77   .rel.bss       : { *(.rel.bss)          }
78   .rela.bss      : { *(.rela.bss)         }
79   .rel.plt       : { *(.rel.plt)          }
80   .rela.plt      : { *(.rela.plt)         }
81   /* Internal text space.  */
82   .text :
83   {
84     . = ALIGN(2);
85     *(.init)
86     *(.init0)  /* Start here after reset.  */
87     *(.init1)
88     *(.init2)  /* Copy data loop  */
89     *(.init3)
90     *(.init4)  /* Clear bss  */
91     *(.init5)
92     *(.init6)  /* C++ constructors.  */
93     *(.init7)
94     *(.init8)
95     *(.init9)  /* Call main().  */
96      __ctors_start = . ;
97      *(.ctors)
98      __ctors_end = . ;
99      __dtors_start = . ;
100      *(.dtors)
101      __dtors_end = . ;
102     . = ALIGN(2);
103     *(.text)
104     . = ALIGN(2);
105     *(.text.*)
106     . = ALIGN(2);
107     *(.fini9)  /*   */
108     *(.fini8)
109     *(.fini7)
110     *(.fini6)  /* C++ destructors.  */
111     *(.fini5)
112     *(.fini4)
113     *(.fini3)
114     *(.fini2)
115     *(.fini1)
116     *(.fini0)  /* Infinite loop after program termination.  */
117     *(.fini)
118     _etext = .;
119   }  > text
120   .data   : AT (ADDR (.text) + SIZEOF (.text))
121   {
122      PROVIDE (__data_start = .) ;
123     . = ALIGN(2);
124     *(.data)
125     . = ALIGN(2);
126     *(.gnu.linkonce.d*)
127     . = ALIGN(2);
128      _edata = . ;
129   }  > data
130   /* Bootloader.  */
131   .bootloader   :
132   {
133      PROVIDE (__boot_start = .) ;
134     *(.bootloader)
135     . = ALIGN(2);
136     *(.bootloader.*)
137   }  > bootloader
138   /* Information memory.  */
139   .infomem   :
140   {
141     *(.infomem)
142     . = ALIGN(2);
143     *(.infomem.*)
144   }  > infomem
145   /* Information memory (not loaded into MPU).  */
146   .infomemnobits   :
147   {
148     *(.infomemnobits)
149     . = ALIGN(2);
150     *(.infomemnobits.*)
151   }  > infomemnobits
152   .bss  SIZEOF(.data) + ADDR(.data) :
153   {
154      PROVIDE (__bss_start = .) ;
155     *(.bss)
156     *(COMMON)
157      PROVIDE (__bss_end = .) ;
158      _end = . ;
159   }  > data
160   .noinit  SIZEOF(.bss) + ADDR(.bss) :
161   {
162      PROVIDE (__noinit_start = .) ;
163     *(.noinit)
164     *(COMMON)
165      PROVIDE (__noinit_end = .) ;
166      _end = . ;
167   }  > data
168   .vectors  :
169   {
170      PROVIDE (__vectors_start = .) ;
171     *(.vectors*)
172      _vectors_end = . ;
173   }  > vectors
174   /* Stabs for profiling information*/
175   .profiler 0 : { *(.profiler) }
176   /* Stabs debugging sections.  */
177   .stab 0 : { *(.stab) }
178   .stabstr 0 : { *(.stabstr) }
179   .stab.excl 0 : { *(.stab.excl) }
180   .stab.exclstr 0 : { *(.stab.exclstr) }
181   .stab.index 0 : { *(.stab.index) }
182   .stab.indexstr 0 : { *(.stab.indexstr) }
183   .comment 0 : { *(.comment) }
184   /* DWARF debug sections.
185      Symbols in the DWARF debugging sections are relative to the beginning
186      of the section so we begin them at 0.  */
187   /* DWARF 1 */
188   .debug          0 : { *(.debug) }
189   .line           0 : { *(.line) }
190   /* GNU DWARF 1 extensions */
191   .debug_srcinfo  0 : { *(.debug_srcinfo) }
192   .debug_sfnames  0 : { *(.debug_sfnames) }
193   /* DWARF 1.1 and DWARF 2 */
194   .debug_aranges  0 : { *(.debug_aranges) }
195   .debug_pubnames 0 : { *(.debug_pubnames) }
196   /* DWARF 2 */
197   .debug_info     0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
198   .debug_abbrev   0 : { *(.debug_abbrev) }
199   .debug_line     0 : { *(.debug_line) }
200   .debug_frame    0 : { *(.debug_frame) }
201   .debug_str      0 : { *(.debug_str) }
202   .debug_loc      0 : { *(.debug_loc) }
203   .debug_macinfo  0 : { *(.debug_macinfo) }
204   PROVIDE (__stack = 0x2500) ;
205   PROVIDE (__data_start_rom = _etext) ;
206   PROVIDE (__data_end_rom   = _etext + SIZEOF (.data)) ;
207   PROVIDE (__noinit_start_rom = _etext + SIZEOF (.data)) ;
208   PROVIDE (__noinit_end_rom = _etext + SIZEOF (.data) + SIZEOF (.noinit)) ;
209   PROVIDE (__subdevice_has_heap = 0) ;
210 }