blob: 998129156febe5b25735da79e2ff5066ac3aa6cb [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)
24
25PROVIDE(_memmap_vecbase_reset = 0x40000000);
26
27/* Various memory-map dependent cache attribute settings: */
28_memmap_cacheattr_wb_base = 0x00000110;
29_memmap_cacheattr_wt_base = 0x00000110;
30_memmap_cacheattr_bp_base = 0x00000220;
31_memmap_cacheattr_unused_mask = 0xFFFFF00F;
32_memmap_cacheattr_wb_trapnull = 0x2222211F;
33_memmap_cacheattr_wba_trapnull = 0x2222211F;
34_memmap_cacheattr_wbna_trapnull = 0x2222211F;
35_memmap_cacheattr_wt_trapnull = 0x2222211F;
36_memmap_cacheattr_bp_trapnull = 0x2222222F;
37_memmap_cacheattr_wb_strict = 0xFFFFF11F;
38_memmap_cacheattr_wt_strict = 0xFFFFF11F;
39_memmap_cacheattr_bp_strict = 0xFFFFF22F;
40_memmap_cacheattr_wb_allvalid = 0x22222112;
41_memmap_cacheattr_wt_allvalid = 0x22222112;
42_memmap_cacheattr_bp_allvalid = 0x22222222;
43PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wb_trapnull);
44
45SECTIONS
46{
47
48 .dport0.rodata : ALIGN(4)
49 {
50 _dport0_rodata_start = ABSOLUTE(.);
51 *(.dport0.rodata)
52 *(.dport.rodata)
53 _dport0_rodata_end = ABSOLUTE(.);
54 } >dport0_0_seg :dport0_0_phdr
Damien Georgefbea8102014-11-28 14:58:25 +000055
Damien George075d5972014-11-27 20:30:33 +000056 .dport0.literal : ALIGN(4)
57 {
58 _dport0_literal_start = ABSOLUTE(.);
59 *(.dport0.literal)
60 *(.dport.literal)
61 _dport0_literal_end = ABSOLUTE(.);
62 } >dport0_0_seg :dport0_0_phdr
Damien Georgefbea8102014-11-28 14:58:25 +000063
Damien George075d5972014-11-27 20:30:33 +000064 .dport0.data : ALIGN(4)
65 {
66 _dport0_data_start = ABSOLUTE(.);
67 *(.dport0.data)
68 *(.dport.data)
69 _dport0_data_end = ABSOLUTE(.);
70 } >dport0_0_seg :dport0_0_phdr
Damien Georgefbea8102014-11-28 14:58:25 +000071
72 .irom0.text : ALIGN(4)
73 {
74 _irom0_text_start = ABSOLUTE(.);
75 *(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
Damien Georgee6362792014-11-29 14:36:18 +000076
77 /* we put some specific text in this section */
78 *py/*.o*(.literal* .text*)
79 *pyexec.o(.literal*, .text*)
80 *readline.o(.literal*, .text*)
81 *pybstdio.o(.literal*, .text*)
Damien Georgee6362792014-11-29 14:36:18 +000082 *gccollect.o(.literal* .text*)
83 *gchelper.o(.literal* .text*)
Damien George304a96d2015-05-13 14:49:14 +010084 *modpyb.o(.literal*, .text*)
85 *modpybpin.o(.literal*, .text*)
86 *modpybrtc.o(.literal*, .text*)
Josef Gajdusekb4793192015-05-11 15:05:59 +020087 *modesp.o(.literal* .text*)
Damien George304a96d2015-05-13 14:49:14 +010088 *modutime.o(.literal* .text*)
Damien Georgee6362792014-11-29 14:36:18 +000089
90 /* we put as much rodata as possible in this section */
91 /* note that only rodata accessed as a machine word is allowed here */
92 *py/qstr.o(.rodata.const_pool)
93 *py/*.o(.rodata.mp_type_*) /* catches type: mp_obj_type_t */
94 *py/*.o(.rodata.*_locals_dict*) /* catches types: mp_obj_dict_t, mp_map_elem_t */
95 *py/*.o(.rodata.mp_module_*) /* catches types: mp_obj_module_t, mp_obj_dict_t, mp_map_elem_t */
96
Damien Georgefbea8102014-11-28 14:58:25 +000097 _irom0_text_end = ABSOLUTE(.);
98 } >irom0_0_seg :irom0_0_phdr
99
100 .text : ALIGN(4)
101 {
102 _stext = .;
103 _text_start = ABSOLUTE(.);
104 *(.entry.text)
105 *(.init.literal)
106 *(.init)
107 *(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
108 *(.fini.literal)
109 *(.fini)
110 *(.gnu.version)
Damien Georgefbea8102014-11-28 14:58:25 +0000111 _text_end = ABSOLUTE(.);
112 _etext = .;
113 } >iram1_0_seg :iram1_0_phdr
114
115 .lit4 : ALIGN(4)
116 {
117 _lit4_start = ABSOLUTE(.);
118 *(*.lit4)
119 *(.lit4.*)
120 *(.gnu.linkonce.lit4.*)
121 _lit4_end = ABSOLUTE(.);
122 } >iram1_0_seg :iram1_0_phdr
123
Damien George075d5972014-11-27 20:30:33 +0000124 .data : ALIGN(4)
125 {
126 _data_start = ABSOLUTE(.);
127 *(.data)
128 *(.data.*)
129 *(.gnu.linkonce.d.*)
130 *(.data1)
131 *(.sdata)
132 *(.sdata.*)
133 *(.gnu.linkonce.s.*)
134 *(.sdata2)
135 *(.sdata2.*)
136 *(.gnu.linkonce.s2.*)
137 *(.jcr)
138 _data_end = ABSOLUTE(.);
139 } >dram0_0_seg :dram0_0_phdr
Damien Georgefbea8102014-11-28 14:58:25 +0000140
Damien George075d5972014-11-27 20:30:33 +0000141 .rodata : ALIGN(4)
142 {
143 _rodata_start = ABSOLUTE(.);
144 *(.rodata)
145 *(.rodata.*)
146 *(.gnu.linkonce.r.*)
147 *(.rodata1)
148 __XT_EXCEPTION_TABLE__ = ABSOLUTE(.);
149 *(.xt_except_table)
150 *(.gcc_except_table)
151 *(.gnu.linkonce.e.*)
152 *(.gnu.version_r)
153 *(.eh_frame)
154 /* C++ constructor and destructor tables, properly ordered: */
155 KEEP (*crtbegin.o(.ctors))
156 KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
157 KEEP (*(SORT(.ctors.*)))
158 KEEP (*(.ctors))
159 KEEP (*crtbegin.o(.dtors))
160 KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
161 KEEP (*(SORT(.dtors.*)))
162 KEEP (*(.dtors))
163 /* C++ exception handlers table: */
164 __XT_EXCEPTION_DESCS__ = ABSOLUTE(.);
165 *(.xt_except_desc)
166 *(.gnu.linkonce.h.*)
167 __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
168 *(.xt_except_desc_end)
169 *(.dynamic)
170 *(.gnu.version_d)
171 . = ALIGN(4); /* this table MUST be 4-byte aligned */
172 _bss_table_start = ABSOLUTE(.);
173 LONG(_bss_start)
174 LONG(_bss_end)
175 _bss_table_end = ABSOLUTE(.);
176 _rodata_end = ABSOLUTE(.);
177 } >dram0_0_seg :dram0_0_phdr
Damien Georgefbea8102014-11-28 14:58:25 +0000178
Damien George075d5972014-11-27 20:30:33 +0000179 .bss ALIGN(8) (NOLOAD) : ALIGN(4)
180 {
181 . = ALIGN (8);
182 _bss_start = ABSOLUTE(.);
183 *(.dynsbss)
184 *(.sbss)
185 *(.sbss.*)
186 *(.gnu.linkonce.sb.*)
187 *(.scommon)
188 *(.sbss2)
189 *(.sbss2.*)
190 *(.gnu.linkonce.sb2.*)
191 *(.dynbss)
192 *(.bss)
193 *(.bss.*)
194 *(.gnu.linkonce.b.*)
195 *(COMMON)
196 . = ALIGN (8);
197 _bss_end = ABSOLUTE(.);
198 _heap_start = ABSOLUTE(.);
199 } >dram0_0_seg :dram0_0_bss_phdr
Damien George075d5972014-11-27 20:30:33 +0000200}
201
202/* get ROM code address */
203INCLUDE "eagle.rom.addr.v6.ld"