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