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