blob: 68939f6f55a9a957e2703fd64cf1d7c964c84b64 [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
Josef Gajdusekb4793192015-05-11 15:05:59 +02008 irom0_0_seg : org = 0x40210000, len = 0x5A000
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
Damien George6d0629b2015-12-18 21:07:58 +0000122 *lib/libm/*.o*(.literal*, .text*)
Damien George3fbbbec2015-12-28 17:38:40 +0000123 *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
128 *stmhal/pybstdio.o(.literal*, .text*)
129
Damien Georgee6362792014-11-29 14:36:18 +0000130 *gccollect.o(.literal* .text*)
131 *gchelper.o(.literal* .text*)
Paul Sokolovsky9c7e3352016-03-26 00:39:02 +0200132 *lexerstr32.o(.literal* .text*)
Paul Sokolovskyf71c0692016-03-26 00:39:51 +0200133 *utils.o(.literal* .text*)
Damien George304a96d2015-05-13 14:49:14 +0100134 *modpyb.o(.literal*, .text*)
135 *modpybpin.o(.literal*, .text*)
Damien George632d8ef2016-03-02 13:37:27 +0000136 *modpybpwm.o(.literal*, .text*)
Damien George304a96d2015-05-13 14:49:14 +0100137 *modpybrtc.o(.literal*, .text*)
Damien George3fbbbec2015-12-28 17:38:40 +0000138 *modpybadc.o(.literal*, .text*)
Damien George82b95f62016-03-01 22:53:23 +0000139 *modpybspi.o(.literal*, .text*)
Josef Gajdusekb4793192015-05-11 15:05:59 +0200140 *modesp.o(.literal* .text*)
Damien Georgef09f8092015-10-20 22:59:31 +0100141 *modnetwork.o(.literal* .text*)
142 *moduos.o(.literal* .text*)
Damien George304a96d2015-05-13 14:49:14 +0100143 *modutime.o(.literal* .text*)
Damien George05dda0e2015-12-28 10:23:30 +0000144 *modlwip.o(.literal* .text*)
Damien George3fbbbec2015-12-28 17:38:40 +0000145 *modsocket.o(.literal* .text*)
Damien Georgee6362792014-11-29 14:36:18 +0000146
147 /* we put as much rodata as possible in this section */
148 /* note that only rodata accessed as a machine word is allowed here */
149 *py/qstr.o(.rodata.const_pool)
Damien George3fbbbec2015-12-28 17:38:40 +0000150 *.o(.rodata.mp_type_*) /* catches type: mp_obj_type_t */
151 *.o(.rodata.*_locals_dict*) /* catches types: mp_obj_dict_t, mp_map_elem_t */
152 *.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 +0800153 */frozen.o(.rodata.mp_frozen_sizes) /* frozen modules */
154 */frozen.o(.rodata.mp_frozen_content) /* frozen modules */
Damien Georgee6362792014-11-29 14:36:18 +0000155
Damien Georgefbea8102014-11-28 14:58:25 +0000156 _irom0_text_end = ABSOLUTE(.);
157 } >irom0_0_seg :irom0_0_phdr
158
159 .text : ALIGN(4)
160 {
161 _stext = .;
162 _text_start = ABSOLUTE(.);
Josef Gajdusek7d8edef2015-05-26 18:54:55 +0200163 *(.UserEnter.text)
164 . = ALIGN(16);
165 *(.DebugExceptionVector.text)
166 . = ALIGN(16);
167 *(.NMIExceptionVector.text)
168 . = ALIGN(16);
169 *(.KernelExceptionVector.text)
170 LONG(0)
171 LONG(0)
172 LONG(0)
173 LONG(0)
174 . = ALIGN(16);
175 *(.UserExceptionVector.text)
176 LONG(0)
177 LONG(0)
178 LONG(0)
179 LONG(0)
180 . = ALIGN(16);
181 *(.DoubleExceptionVector.text)
182 LONG(0)
183 LONG(0)
184 LONG(0)
185 LONG(0)
186 . = ALIGN (16);
Damien Georgefbea8102014-11-28 14:58:25 +0000187 *(.entry.text)
188 *(.init.literal)
189 *(.init)
190 *(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
191 *(.fini.literal)
192 *(.fini)
193 *(.gnu.version)
Damien Georgefbea8102014-11-28 14:58:25 +0000194 _text_end = ABSOLUTE(.);
195 _etext = .;
196 } >iram1_0_seg :iram1_0_phdr
197
198 .lit4 : ALIGN(4)
199 {
200 _lit4_start = ABSOLUTE(.);
201 *(*.lit4)
202 *(.lit4.*)
203 *(.gnu.linkonce.lit4.*)
204 _lit4_end = ABSOLUTE(.);
205 } >iram1_0_seg :iram1_0_phdr
206
Damien George075d5972014-11-27 20:30:33 +0000207 .data : ALIGN(4)
208 {
209 _data_start = ABSOLUTE(.);
210 *(.data)
211 *(.data.*)
212 *(.gnu.linkonce.d.*)
213 *(.data1)
214 *(.sdata)
215 *(.sdata.*)
216 *(.gnu.linkonce.s.*)
217 *(.sdata2)
218 *(.sdata2.*)
219 *(.gnu.linkonce.s2.*)
220 *(.jcr)
221 _data_end = ABSOLUTE(.);
222 } >dram0_0_seg :dram0_0_phdr
Damien Georgefbea8102014-11-28 14:58:25 +0000223
Damien George075d5972014-11-27 20:30:33 +0000224 .rodata : ALIGN(4)
225 {
226 _rodata_start = ABSOLUTE(.);
Paul Sokolovsky259f1342015-12-27 18:23:11 +0200227 *(.sdk.version)
Damien George075d5972014-11-27 20:30:33 +0000228 *(.rodata)
229 *(.rodata.*)
230 *(.gnu.linkonce.r.*)
231 *(.rodata1)
232 __XT_EXCEPTION_TABLE__ = ABSOLUTE(.);
233 *(.xt_except_table)
234 *(.gcc_except_table)
235 *(.gnu.linkonce.e.*)
236 *(.gnu.version_r)
237 *(.eh_frame)
238 /* C++ constructor and destructor tables, properly ordered: */
239 KEEP (*crtbegin.o(.ctors))
240 KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
241 KEEP (*(SORT(.ctors.*)))
242 KEEP (*(.ctors))
243 KEEP (*crtbegin.o(.dtors))
244 KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
245 KEEP (*(SORT(.dtors.*)))
246 KEEP (*(.dtors))
247 /* C++ exception handlers table: */
248 __XT_EXCEPTION_DESCS__ = ABSOLUTE(.);
249 *(.xt_except_desc)
250 *(.gnu.linkonce.h.*)
251 __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
252 *(.xt_except_desc_end)
253 *(.dynamic)
254 *(.gnu.version_d)
255 . = ALIGN(4); /* this table MUST be 4-byte aligned */
256 _bss_table_start = ABSOLUTE(.);
257 LONG(_bss_start)
258 LONG(_bss_end)
259 _bss_table_end = ABSOLUTE(.);
260 _rodata_end = ABSOLUTE(.);
261 } >dram0_0_seg :dram0_0_phdr
Damien Georgefbea8102014-11-28 14:58:25 +0000262
Damien George075d5972014-11-27 20:30:33 +0000263 .bss ALIGN(8) (NOLOAD) : ALIGN(4)
264 {
265 . = ALIGN (8);
266 _bss_start = ABSOLUTE(.);
267 *(.dynsbss)
268 *(.sbss)
269 *(.sbss.*)
270 *(.gnu.linkonce.sb.*)
271 *(.scommon)
272 *(.sbss2)
273 *(.sbss2.*)
274 *(.gnu.linkonce.sb2.*)
275 *(.dynbss)
276 *(.bss)
277 *(.bss.*)
278 *(.gnu.linkonce.b.*)
279 *(COMMON)
280 . = ALIGN (8);
281 _bss_end = ABSOLUTE(.);
282 _heap_start = ABSOLUTE(.);
283 } >dram0_0_seg :dram0_0_bss_phdr
Damien George075d5972014-11-27 20:30:33 +0000284}
285
286/* get ROM code address */
287INCLUDE "eagle.rom.addr.v6.ld"