blob: 2e327b4a4f7a8d899acee164cb5bfc358a9f1148 [file] [log] [blame]
Damien George075d5972014-11-27 20:30:33 +00001/* 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
Paul Sokolovsky8d2bcaf2016-04-03 15:40:53 +03008 irom0_0_seg : org = 0x40209000, len = 0x80000
Damien George075d5972014-11-27 20:30:33 +00009}
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(call_user_start)
Josef Gajdusek7d8edef2015-05-26 18:54:55 +020024EXTERN(_DebugExceptionVector)
25EXTERN(_DoubleExceptionVector)
26EXTERN(_KernelExceptionVector)
27EXTERN(_NMIExceptionVector)
28EXTERN(_UserExceptionVector)
Damien George075d5972014-11-27 20:30:33 +000029
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
Damien Georgefbea8102014-11-28 14:58:25 +000060
Damien George075d5972014-11-27 20:30:33 +000061 .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
Damien Georgefbea8102014-11-28 14:58:25 +000068
Damien George075d5972014-11-27 20:30:33 +000069 .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
Damien Georgefbea8102014-11-28 14:58:25 +000076
77 .irom0.text : ALIGN(4)
78 {
79 _irom0_text_start = ABSOLUTE(.);
80 *(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
Damien Georgee6362792014-11-29 14:36:18 +000081
82 /* we put some specific text in this section */
Damien George3fbbbec2015-12-28 17:38:40 +000083
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*)
91 *py/formatfloat.o*(.literal* .text*)
92 *py/frozenmod.o*(.literal* .text*)
93 *py/gc.o*(.literal* .text*)
94 *py/lexer*.o*(.literal* .text*)
95 *py/malloc*.o*(.literal* .text*)
96 *py/map*.o*(.literal* .text*)
97 *py/mod*.o*(.literal* .text*)
98 *py/mpprint.o*(.literal* .text*)
99 *py/mpstate.o*(.literal* .text*)
100 *py/mpz.o*(.literal* .text*)
101 *py/native*.o*(.literal* .text*)
102 *py/nlr*.o*(.literal* .text*)
103 *py/obj*.o*(.literal* .text*)
104 *py/opmethods.o*(.literal* .text*)
105 *py/parse*.o*(.literal* .text*)
106 *py/qstr.o*(.literal* .text*)
107 *py/repl.o*(.literal* .text*)
108 *py/runtime.o*(.literal* .text*)
109 *py/scope.o*(.literal* .text*)
110 *py/sequence.o*(.literal* .text*)
111 *py/showbc.o*(.literal* .text*)
112 *py/smallint.o*(.literal* .text*)
113 *py/stackctrl.o*(.literal* .text*)
114 *py/stream.o*(.literal* .text*)
115 *py/unicode.o*(.literal* .text*)
116 *py/vm.o*(.literal* .text*)
117 *py/vstr.o*(.literal* .text*)
118 *py/warning.o*(.literal* .text*)
119
120 *extmod/*.o*(.literal* .text*)
121
Paul Sokolovskycd6194a2016-03-27 17:15:25 +0300122 *lib/fatfs/*.o*(.literal*, .text*)
Paul Sokolovsky6afd6512016-04-27 00:45:09 +0300123 */libaxtls.a:(.literal*, .text*)
Paul Sokolovsky4d22ade2016-07-31 02:39:59 +0300124 *lib/berkeley-db-1.xx/*.o(.literal*, .text*)
Damien George6d0629b2015-12-18 21:07:58 +0000125 *lib/libm/*.o*(.literal*, .text*)
Damien George3fbbbec2015-12-28 17:38:40 +0000126 *lib/mp-readline/*.o(.literal*, .text*)
127 *lib/netutils/*.o*(.literal*, .text*)
128 *lib/timeutils/*.o*(.literal*, .text*)
129 *lib/utils/*.o*(.literal*, .text*)
130
131 *stmhal/pybstdio.o(.literal*, .text*)
132
Damien Georgee6362792014-11-29 14:36:18 +0000133 *gccollect.o(.literal* .text*)
134 *gchelper.o(.literal* .text*)
Paul Sokolovsky9c7e3352016-03-26 00:39:02 +0200135 *lexerstr32.o(.literal* .text*)
Paul Sokolovskyf71c0692016-03-26 00:39:51 +0200136 *utils.o(.literal* .text*)
Damien George304a96d2015-05-13 14:49:14 +0100137 *modpyb.o(.literal*, .text*)
138 *modpybpin.o(.literal*, .text*)
Damien George632d8ef2016-03-02 13:37:27 +0000139 *modpybpwm.o(.literal*, .text*)
Damien George304a96d2015-05-13 14:49:14 +0100140 *modpybrtc.o(.literal*, .text*)
Damien George3fbbbec2015-12-28 17:38:40 +0000141 *modpybadc.o(.literal*, .text*)
Damien George1a0a3232016-04-06 19:45:52 +0300142 *modpybuart.o(.literal*, .text*)
Paul Sokolovsky935e0212016-03-26 10:59:25 +0200143 *modpybi2c.o(.literal*, .text*)
Damien George82b95f62016-03-01 22:53:23 +0000144 *modpybspi.o(.literal*, .text*)
Josef Gajdusekb4793192015-05-11 15:05:59 +0200145 *modesp.o(.literal* .text*)
Damien Georgef09f8092015-10-20 22:59:31 +0100146 *modnetwork.o(.literal* .text*)
147 *moduos.o(.literal* .text*)
Damien George304a96d2015-05-13 14:49:14 +0100148 *modutime.o(.literal* .text*)
Damien George05dda0e2015-12-28 10:23:30 +0000149 *modlwip.o(.literal* .text*)
Damien George3fbbbec2015-12-28 17:38:40 +0000150 *modsocket.o(.literal* .text*)
Damien Georgedf3b1742016-04-14 12:33:54 +0100151 *modonewire.o(.literal* .text*)
Damien Georgee6362792014-11-29 14:36:18 +0000152
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)
Damien George3fbbbec2015-12-28 17:38:40 +0000156 *.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 */
Paul Sokolovsky9d7b8712016-03-17 23:06:47 +0800159 */frozen.o(.rodata.mp_frozen_sizes) /* frozen modules */
160 */frozen.o(.rodata.mp_frozen_content) /* frozen modules */
Damien Georgee6362792014-11-29 14:36:18 +0000161
Paul Sokolovskyef0c5db2016-04-03 00:51:51 +0300162 /* for -mforce-l32 */
163 build/*.o(.rodata*)
164
Damien Georgefbea8102014-11-28 14:58:25 +0000165 _irom0_text_end = ABSOLUTE(.);
166 } >irom0_0_seg :irom0_0_phdr
167
168 .text : ALIGN(4)
169 {
170 _stext = .;
171 _text_start = ABSOLUTE(.);
Josef Gajdusek7d8edef2015-05-26 18:54:55 +0200172 *(.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);
Damien Georgefbea8102014-11-28 14:58:25 +0000196 *(.entry.text)
197 *(.init.literal)
198 *(.init)
199 *(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
200 *(.fini.literal)
201 *(.fini)
202 *(.gnu.version)
Damien Georgefbea8102014-11-28 14:58:25 +0000203 _text_end = ABSOLUTE(.);
204 _etext = .;
205 } >iram1_0_seg :iram1_0_phdr
206
207 .lit4 : ALIGN(4)
208 {
209 _lit4_start = ABSOLUTE(.);
210 *(*.lit4)
211 *(.lit4.*)
212 *(.gnu.linkonce.lit4.*)
213 _lit4_end = ABSOLUTE(.);
214 } >iram1_0_seg :iram1_0_phdr
215
Damien George075d5972014-11-27 20:30:33 +0000216 .data : ALIGN(4)
217 {
218 _data_start = ABSOLUTE(.);
219 *(.data)
220 *(.data.*)
221 *(.gnu.linkonce.d.*)
222 *(.data1)
223 *(.sdata)
224 *(.sdata.*)
225 *(.gnu.linkonce.s.*)
226 *(.sdata2)
227 *(.sdata2.*)
228 *(.gnu.linkonce.s2.*)
229 *(.jcr)
230 _data_end = ABSOLUTE(.);
231 } >dram0_0_seg :dram0_0_phdr
Damien Georgefbea8102014-11-28 14:58:25 +0000232
Damien George075d5972014-11-27 20:30:33 +0000233 .rodata : ALIGN(4)
234 {
235 _rodata_start = ABSOLUTE(.);
Paul Sokolovsky259f1342015-12-27 18:23:11 +0200236 *(.sdk.version)
Damien George075d5972014-11-27 20:30:33 +0000237 *(.rodata)
238 *(.rodata.*)
239 *(.gnu.linkonce.r.*)
240 *(.rodata1)
241 __XT_EXCEPTION_TABLE__ = ABSOLUTE(.);
242 *(.xt_except_table)
243 *(.gcc_except_table)
244 *(.gnu.linkonce.e.*)
245 *(.gnu.version_r)
246 *(.eh_frame)
247 /* C++ constructor and destructor tables, properly ordered: */
248 KEEP (*crtbegin.o(.ctors))
249 KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
250 KEEP (*(SORT(.ctors.*)))
251 KEEP (*(.ctors))
252 KEEP (*crtbegin.o(.dtors))
253 KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
254 KEEP (*(SORT(.dtors.*)))
255 KEEP (*(.dtors))
256 /* C++ exception handlers table: */
257 __XT_EXCEPTION_DESCS__ = ABSOLUTE(.);
258 *(.xt_except_desc)
259 *(.gnu.linkonce.h.*)
260 __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
261 *(.xt_except_desc_end)
262 *(.dynamic)
263 *(.gnu.version_d)
264 . = ALIGN(4); /* this table MUST be 4-byte aligned */
265 _bss_table_start = ABSOLUTE(.);
266 LONG(_bss_start)
267 LONG(_bss_end)
268 _bss_table_end = ABSOLUTE(.);
269 _rodata_end = ABSOLUTE(.);
270 } >dram0_0_seg :dram0_0_phdr
Damien Georgefbea8102014-11-28 14:58:25 +0000271
Damien George075d5972014-11-27 20:30:33 +0000272 .bss ALIGN(8) (NOLOAD) : ALIGN(4)
273 {
274 . = ALIGN (8);
275 _bss_start = ABSOLUTE(.);
276 *(.dynsbss)
277 *(.sbss)
278 *(.sbss.*)
279 *(.gnu.linkonce.sb.*)
280 *(.scommon)
281 *(.sbss2)
282 *(.sbss2.*)
283 *(.gnu.linkonce.sb2.*)
284 *(.dynbss)
285 *(.bss)
286 *(.bss.*)
287 *(.gnu.linkonce.b.*)
288 *(COMMON)
289 . = ALIGN (8);
290 _bss_end = ABSOLUTE(.);
291 _heap_start = ABSOLUTE(.);
292 } >dram0_0_seg :dram0_0_bss_phdr
Damien George075d5972014-11-27 20:30:33 +0000293}
294
295/* get ROM code address */
296INCLUDE "eagle.rom.addr.v6.ld"