blob: f721c28b038bf9c51f0fdeffd78ca679b299b0e0 [file] [log] [blame]
Damien Georgeb32a38e2017-01-25 09:49:55 +11001/* GNU linker script for ESP8266, common sections and symbols */
2
3/* define the top of RAM */
4_heap_end = ORIGIN(dram0_0_seg) + LENGTH(dram0_0_seg);
5
6PHDRS
7{
8 dport0_0_phdr PT_LOAD;
9 dram0_0_phdr PT_LOAD;
10 dram0_0_bss_phdr PT_LOAD;
11 iram1_0_phdr PT_LOAD;
12 irom0_0_phdr PT_LOAD;
13}
14
15ENTRY(firmware_start)
16EXTERN(_DebugExceptionVector)
17EXTERN(_DoubleExceptionVector)
18EXTERN(_KernelExceptionVector)
19EXTERN(_NMIExceptionVector)
20EXTERN(_UserExceptionVector)
21
22PROVIDE(_memmap_vecbase_reset = 0x40000000);
23
24/* Various memory-map dependent cache attribute settings: */
25_memmap_cacheattr_wb_base = 0x00000110;
26_memmap_cacheattr_wt_base = 0x00000110;
27_memmap_cacheattr_bp_base = 0x00000220;
28_memmap_cacheattr_unused_mask = 0xFFFFF00F;
29_memmap_cacheattr_wb_trapnull = 0x2222211F;
30_memmap_cacheattr_wba_trapnull = 0x2222211F;
31_memmap_cacheattr_wbna_trapnull = 0x2222211F;
32_memmap_cacheattr_wt_trapnull = 0x2222211F;
33_memmap_cacheattr_bp_trapnull = 0x2222222F;
34_memmap_cacheattr_wb_strict = 0xFFFFF11F;
35_memmap_cacheattr_wt_strict = 0xFFFFF11F;
36_memmap_cacheattr_bp_strict = 0xFFFFF22F;
37_memmap_cacheattr_wb_allvalid = 0x22222112;
38_memmap_cacheattr_wt_allvalid = 0x22222112;
39_memmap_cacheattr_bp_allvalid = 0x22222222;
40PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wb_trapnull);
41
42SECTIONS
43{
44
45 .dport0.rodata : ALIGN(4)
46 {
47 _dport0_rodata_start = ABSOLUTE(.);
48 *(.dport0.rodata)
49 *(.dport.rodata)
50 _dport0_rodata_end = ABSOLUTE(.);
51 } >dport0_0_seg :dport0_0_phdr
52
53 .dport0.literal : ALIGN(4)
54 {
55 _dport0_literal_start = ABSOLUTE(.);
56 *(.dport0.literal)
57 *(.dport.literal)
58 _dport0_literal_end = ABSOLUTE(.);
59 } >dport0_0_seg :dport0_0_phdr
60
61 .dport0.data : ALIGN(4)
62 {
63 _dport0_data_start = ABSOLUTE(.);
64 *(.dport0.data)
65 *(.dport.data)
66 _dport0_data_end = ABSOLUTE(.);
67 } >dport0_0_seg :dport0_0_phdr
68
69 .irom0.text : ALIGN(4)
70 {
71 _irom0_text_start = ABSOLUTE(.);
72 *(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
73
74 /* we put some specific text in this section */
75
76 *py/argcheck.o*(.literal* .text*)
77 *py/asm*.o*(.literal* .text*)
78 *py/bc.o*(.literal* .text*)
79 *py/binary.o*(.literal* .text*)
80 *py/builtin*.o*(.literal* .text*)
81 *py/compile.o*(.literal* .text*)
82 *py/emit*.o*(.literal* .text*)
83 *py/persistentcode*.o*(.literal* .text*)
84 *py/formatfloat.o*(.literal* .text*)
85 *py/frozenmod.o*(.literal* .text*)
86 *py/gc.o*(.literal* .text*)
87 *py/reader*.o*(.literal* .text*)
88 *py/lexer*.o*(.literal* .text*)
89 *py/malloc*.o*(.literal* .text*)
90 *py/map*.o*(.literal* .text*)
91 *py/mod*.o*(.literal* .text*)
92 *py/mpprint.o*(.literal* .text*)
93 *py/mpstate.o*(.literal* .text*)
94 *py/mpz.o*(.literal* .text*)
95 *py/native*.o*(.literal* .text*)
96 *py/nlr*.o*(.literal* .text*)
97 *py/obj*.o*(.literal* .text*)
98 *py/opmethods.o*(.literal* .text*)
99 *py/parse*.o*(.literal* .text*)
100 *py/qstr.o*(.literal* .text*)
101 *py/repl.o*(.literal* .text*)
102 *py/runtime.o*(.literal* .text*)
103 *py/scope.o*(.literal* .text*)
104 *py/sequence.o*(.literal* .text*)
105 *py/showbc.o*(.literal* .text*)
106 *py/smallint.o*(.literal* .text*)
107 *py/stackctrl.o*(.literal* .text*)
108 *py/stream.o*(.literal* .text*)
109 *py/unicode.o*(.literal* .text*)
110 *py/vm.o*(.literal* .text*)
111 *py/vstr.o*(.literal* .text*)
112 *py/warning.o*(.literal* .text*)
113
114 *extmod/*.o*(.literal* .text*)
115
Damien George8d5c6332017-01-24 23:53:53 +1100116 *lib/oofatfs/*.o*(.literal*, .text*)
Damien Georgeb32a38e2017-01-25 09:49:55 +1100117 */libaxtls.a:(.literal*, .text*)
118 *lib/berkeley-db-1.xx/*.o(.literal*, .text*)
119 *lib/libm/*.o*(.literal*, .text*)
120 *lib/mp-readline/*.o(.literal*, .text*)
121 *lib/netutils/*.o*(.literal*, .text*)
122 *lib/timeutils/*.o*(.literal*, .text*)
123 *lib/utils/*.o*(.literal*, .text*)
124
125 *stmhal/pybstdio.o(.literal*, .text*)
126
127 build/main.o(.literal* .text*)
128 *gccollect.o(.literal* .text*)
129 *gchelper.o(.literal* .text*)
130 *help.o(.literal* .text*)
131 *lexerstr32.o(.literal* .text*)
132 *utils.o(.literal* .text*)
133 *modpyb.o(.literal*, .text*)
134 *machine_pin.o(.literal*, .text*)
135 *machine_pwm.o(.literal*, .text*)
136 *machine_rtc.o(.literal*, .text*)
137 *machine_adc.o(.literal*, .text*)
138 *machine_uart.o(.literal*, .text*)
139 *modpybi2c.o(.literal*, .text*)
140 *modmachine.o(.literal*, .text*)
141 *machine_wdt.o(.literal*, .text*)
142 *machine_spi.o(.literal*, .text*)
143 *machine_hspi.o(.literal*, .text*)
144 *hspi.o(.literal*, .text*)
145 *modesp.o(.literal* .text*)
146 *modnetwork.o(.literal* .text*)
147 *moduos.o(.literal* .text*)
148 *modutime.o(.literal* .text*)
149 *modlwip.o(.literal* .text*)
150 *modsocket.o(.literal* .text*)
151 *modonewire.o(.literal* .text*)
152
153 /* we put as much rodata as possible in this section */
154 /* note that only rodata accessed as a machine word is allowed here */
155 *py/qstr.o(.rodata.const_pool)
156 *.o(.rodata.mp_type_*) /* catches type: mp_obj_type_t */
157 *.o(.rodata.*_locals_dict*) /* catches types: mp_obj_dict_t, mp_map_elem_t */
158 *.o(.rodata.mp_module_*) /* catches types: mp_obj_module_t, mp_obj_dict_t, mp_map_elem_t */
159 */frozen.o(.rodata.mp_frozen_sizes) /* frozen modules */
160 */frozen.o(.rodata.mp_frozen_content) /* frozen modules */
161
162 /* for -mforce-l32 */
163 build/*.o(.rodata*)
164
165 _irom0_text_end = ABSOLUTE(.);
166 } >irom0_0_seg :irom0_0_phdr
167
168 .text : ALIGN(4)
169 {
170 _stext = .;
171 _text_start = ABSOLUTE(.);
172 *(.UserEnter.text)
173 . = ALIGN(16);
174 *(.DebugExceptionVector.text)
175 . = ALIGN(16);
176 *(.NMIExceptionVector.text)
177 . = ALIGN(16);
178 *(.KernelExceptionVector.text)
179 LONG(0)
180 LONG(0)
181 LONG(0)
182 LONG(0)
183 . = ALIGN(16);
184 *(.UserExceptionVector.text)
185 LONG(0)
186 LONG(0)
187 LONG(0)
188 LONG(0)
189 . = ALIGN(16);
190 *(.DoubleExceptionVector.text)
191 LONG(0)
192 LONG(0)
193 LONG(0)
194 LONG(0)
195 . = ALIGN (16);
196 *(.entry.text)
197 *(.init.literal)
198 *(.init)
199 *(.literal .text .literal.* .text.* .iram0.literal .iram0.text .iram0.text.*.literal .iram0.text.*)
200 *(.stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
201 *(.fini.literal)
202 *(.fini)
203 *(.gnu.version)
204 _text_end = ABSOLUTE(.);
205 _etext = .;
206 } >iram1_0_seg :iram1_0_phdr
207
208 .lit4 : ALIGN(4)
209 {
210 _lit4_start = ABSOLUTE(.);
211 *(*.lit4)
212 *(.lit4.*)
213 *(.gnu.linkonce.lit4.*)
214 _lit4_end = ABSOLUTE(.);
215 } >iram1_0_seg :iram1_0_phdr
216
217 .data : ALIGN(4)
218 {
219 _data_start = ABSOLUTE(.);
220 *(.data)
221 *(.data.*)
222 *(.gnu.linkonce.d.*)
223 *(.data1)
224 *(.sdata)
225 *(.sdata.*)
226 *(.gnu.linkonce.s.*)
227 *(.sdata2)
228 *(.sdata2.*)
229 *(.gnu.linkonce.s2.*)
230 *(.jcr)
231 _data_end = ABSOLUTE(.);
232 } >dram0_0_seg :dram0_0_phdr
233
234 .rodata : ALIGN(4)
235 {
236 _rodata_start = ABSOLUTE(.);
237 *(.sdk.version)
238 *(.rodata)
239 *(.rodata.*)
240 *(.gnu.linkonce.r.*)
241 *(.rodata1)
242 __XT_EXCEPTION_TABLE__ = ABSOLUTE(.);
243 *(.xt_except_table)
244 *(.gcc_except_table)
245 *(.gnu.linkonce.e.*)
246 *(.gnu.version_r)
247 *(.eh_frame)
248 /* C++ constructor and destructor tables, properly ordered: */
249 KEEP (*crtbegin.o(.ctors))
250 KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
251 KEEP (*(SORT(.ctors.*)))
252 KEEP (*(.ctors))
253 KEEP (*crtbegin.o(.dtors))
254 KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
255 KEEP (*(SORT(.dtors.*)))
256 KEEP (*(.dtors))
257 /* C++ exception handlers table: */
258 __XT_EXCEPTION_DESCS__ = ABSOLUTE(.);
259 *(.xt_except_desc)
260 *(.gnu.linkonce.h.*)
261 __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
262 *(.xt_except_desc_end)
263 *(.dynamic)
264 *(.gnu.version_d)
265 . = ALIGN(4); /* this table MUST be 4-byte aligned */
266 _bss_table_start = ABSOLUTE(.);
267 LONG(_bss_start)
268 LONG(_bss_end)
269 _bss_table_end = ABSOLUTE(.);
270 _rodata_end = ABSOLUTE(.);
271 } >dram0_0_seg :dram0_0_phdr
272
273 .bss ALIGN(8) (NOLOAD) : ALIGN(4)
274 {
275 . = ALIGN (8);
276 _bss_start = ABSOLUTE(.);
277 *(.dynsbss)
278 *(.sbss)
279 *(.sbss.*)
280 *(.gnu.linkonce.sb.*)
281 *(.scommon)
282 *(.sbss2)
283 *(.sbss2.*)
284 *(.gnu.linkonce.sb2.*)
285 *(.dynbss)
286 *(.bss)
287 *(.bss.*)
288 *(.gnu.linkonce.b.*)
289 *(COMMON)
290 . = ALIGN (8);
291 _bss_end = ABSOLUTE(.);
292 _heap_start = ABSOLUTE(.);
293 } >dram0_0_seg :dram0_0_bss_phdr
294}
295
296/* get ROM code address */
297INCLUDE "eagle.rom.addr.v6.ld"