1/****************************************************************************
2 * device/qemu/esp32/ESP32.ld
3 *
4 * Licensed to the Apache Software Foundation (ASF) under one or more
5 * contributor license agreements.  See the NOTICE file distributed with
6 * this work for additional information regarding copyright ownership.  The
7 * ASF licenses this file to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance with the
9 * License.  You may obtain a copy of the License at
10 *
11 *   http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
16 * License for the specific language governing permissions and limitations
17 * under the License.
18 *
19 ****************************************************************************/
20
21MEMORY {
22  drom   (r)    : ORIGIN = 0x3f400010, LENGTH = 0x800000
23  extmem (rwx)  : ORIGIN = 0x3f800000, LENGTH = 0x400000
24  dram   (rw)   : ORIGIN = 0x3ffb0000, LENGTH = 0x50000
25  iram_0  (rx)  : ORIGIN = 0x40080000, LENGTH = 0x20000
26  iram_1  (rx)  : ORIGIN = 0x400D0018, LENGTH = 0x330000
27}
28
29_eram = ORIGIN(dram) + LENGTH(dram);
30
31/* Default entry point: */
32ENTRY(main);
33
34SECTIONS
35{
36  /* Send .iram0 code to iram */
37
38  .iram0.vectors :
39  {
40    /* Vectors go to IRAM */
41
42    _init_start = ABSOLUTE(.);
43
44    /* Vectors according to builds/RF-2015.2-win32/esp108_v1_2_s5_512int_2/config.html */
45     . = 0x0;
46    KEEP(*(.WindowVectors.text));
47    . = 0x180;
48    KEEP(*(.InterruptEntry2.text));
49    . = 0x1c0;
50    KEEP(*(.InterruptEntry3.text));
51    . = 0x200;
52    KEEP(*(.InterruptEntry4.text));
53    . = 0x240;
54    KEEP(*(.InterruptEntry5.text));
55    . = 0x280;
56    KEEP(*(.DebugExceptionHandler.text));
57    . = 0x2c0;
58    KEEP(*(.NMIExceptionHandler.text));
59    . = 0x300;
60    KEEP(*(.KernelExceptionHandler.text));
61    . = 0x340;
62    KEEP(*(.UserExceptionHandler.text));
63    . = 0x3C0;
64    KEEP(*(.DoubleExceptionHandler.text));
65    . = 0x400;
66    *(.userVector)
67    *(.*_vector.literal)
68
69    . = ALIGN (16);
70    *(.entry.text)
71    *(.init.literal)
72    *(.init)
73    _init_end = ABSOLUTE(.);
74  } > iram_0
75
76  .iram0.text :
77  {
78    /* Code marked as running out of IRAM */
79
80    _iram_text_start = ABSOLUTE(.);
81    *(.iram1 .iram1.*)
82    *(.iram*)
83    *librtc.a:(.literal .text .literal.* .text.*)
84    *libarch.a:esp32_spiflash.*(.literal .text .literal.* .text.*)
85    *(.wifirxiram .wifirxiram.*)
86    *(.wifi0iram  .wifi0iram.*)
87    *(.wifislpiram .wifislpiram.*)
88    *(.wifislprxiram .wifislprxiram.*)
89    *(.phyiram .phyiram.*)
90
91    _iram_text_end = ABSOLUTE(.);
92
93    /* IRAM heap starts at the end of iram */
94
95    . = ALIGN (4);
96    _siramheap = ABSOLUTE(.);
97  } > iram_0
98
99  /* Shared RAM */
100
101  .dram0.bss (NOLOAD) :
102  {
103    /* .bss initialized on power-up */
104
105    . = ALIGN (8);
106    _sbss = ABSOLUTE(.);
107    *(.dynsbss)
108    *(.sbss)
109    *(.sbss.*)
110    *(.gnu.linkonce.sb.*)
111    *(.scommon)
112    *(.sbss2)
113    *(.sbss2.*)
114    *(.gnu.linkonce.sb2.*)
115    *(.dynbss)
116    KEEP (*(.bss))
117    *(.bss.*)
118    *(.share.mem)
119    *(.gnu.linkonce.b.*)
120    *(COMMON)
121    *libarch.a:esp32_spiflash.*(.bss  .bss.*  COMMON)
122    . = ALIGN(8);
123    __init_stack_s = ABSOLUTE(.);
124    . += 0x1000;
125    __init_stack_e = ABSOLUTE(.);
126    _ebss = .;
127    . = ALIGN(8);
128    _ebss = ABSOLUTE(.);
129  } >dram
130
131  .dram0.data :
132  {
133    /* .data initialized on power-up in ROMed configurations. */
134
135    _sdata = ABSOLUTE(.);
136    KEEP (*(.data))
137    KEEP (*(.data.*))
138    KEEP (*(.gnu.linkonce.d.*))
139    KEEP (*(.data1))
140    KEEP (*(.sdata))
141    KEEP (*(.sdata.*))
142    KEEP (*(.gnu.linkonce.s.*))
143    KEEP (*(.sdata2))
144    KEEP (*(.sdata2.*))
145    KEEP (*(.gnu.linkonce.s2.*))
146    KEEP (*(.jcr))
147    *(.dram1 .dram1.*)
148    *libphy.a:(.rodata  .rodata.*)
149    *libarch.a:esp32_spiflash.*(.rodata  .rodata.*)
150    . = ALIGN(4);
151    _edata = ABSOLUTE(.);
152
153    /* Heap starts at the end of .data */
154
155    __heap_start = ABSOLUTE(.);
156    . += 0x24000;
157    . = ALIGN(4);
158    __heap_end = ABSOLUTE(.);
159  } >dram
160
161  /* External memory bss, from any global variable with EXT_RAM_ATTR attribute */
162
163  .extmem.bss (NOLOAD) :
164  {
165    _sbss_extmem = ABSOLUTE(.);
166    *(.extmem.bss .extmem.bss.*)
167    . = ALIGN(4);
168    _ebss_extmem = ABSOLUTE(.);
169  } > extmem
170
171  .flash.rodata :
172  {
173    _srodata = ABSOLUTE(.);
174    *(.rodata)
175    *(.rodata.*)
176    *(.irom1.text) /* catch stray ICACHE_RODATA_ATTR */
177    *(.gnu.linkonce.r.*)
178    *(.rodata1)
179    __XT_EXCEPTION_TABLE_ = ABSOLUTE(.);
180    *(.xt_except_table)
181    *(.gcc_except_table)
182    *(.gcc_except_table.*)
183    *(.gnu.linkonce.e.*)
184    *(.gnu.version_r)
185    *(.eh_frame)
186
187    . = (. + 3) & ~ 3;
188
189    /* C++ constructor and destructor tables, properly ordered: */
190
191    _sinit = ABSOLUTE(.);
192    KEEP (*crtbegin.o(.ctors))
193    KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
194    KEEP (*(SORT(.ctors.*)))
195    KEEP (*(.ctors))
196    _einit = ABSOLUTE(.);
197    KEEP (*crtbegin.o(.dtors))
198    KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
199    KEEP (*(SORT(.dtors.*)))
200    KEEP (*(.dtors))
201
202    /* C++ exception handlers table: */
203
204    __XT_EXCEPTION_DESCS_ = ABSOLUTE(.);
205    *(.xt_except_desc)
206    *(.gnu.linkonce.h.*)
207    __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
208    *(.xt_except_desc_end)
209    *(.dynamic)
210    *(.gnu.version_d)
211    _erodata = ABSOLUTE(.);
212    /* Literals are also RO data. */
213    _lit4_start = ABSOLUTE(.);
214    *(*.lit4)
215    *(.lit4.*)
216    *(.gnu.linkonce.lit4.*)
217    _lit4_end = ABSOLUTE(.);
218    . = ALIGN(4);
219  } >drom
220
221  .flash.text :
222  {
223    _stext = .;
224    __text_start = ABSOLUTE(.);
225    *(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
226    *(.irom0.text) /* catch stray ICACHE_RODATA_ATTR */
227    *(.fini.literal)
228    *(.fini)
229    *(.gnu.version)
230    . = ALIGN(4);
231    __zinitcall_bsp_start = .;
232    KEEP (*(.zinitcall.bsp0.init))
233    KEEP (*(.zinitcall.bsp1.init))
234    KEEP (*(.zinitcall.bsp2.init))
235    KEEP (*(.zinitcall.bsp3.init))
236    KEEP (*(.zinitcall.bsp4.init))
237    __zinitcall_bsp_end = .;
238    __zinitcall_device_start = .;
239    KEEP (*(.zinitcall.device0.init))
240    KEEP (*(.zinitcall.device1.init))
241    KEEP (*(.zinitcall.device2.init))
242    KEEP (*(.zinitcall.device3.init))
243    KEEP (*(.zinitcall.device4.init))
244    __zinitcall_device_end = .;
245    __zinitcall_core_start = .;
246    KEEP (*(.zinitcall.core0.init))
247    KEEP (*(.zinitcall.core1.init))
248    KEEP (*(.zinitcall.core2.init))
249    KEEP (*(.zinitcall.core3.init))
250    KEEP (*(.zinitcall.core4.init))
251    __zinitcall_core_end = .;
252    __zinitcall_sys_service_start = .;
253    KEEP (*(.zinitcall.sys.service0.init))
254    KEEP (*(.zinitcall.sys.service1.init))
255    KEEP (*(.zinitcall.sys.service2.init))
256    KEEP (*(.zinitcall.sys.service3.init))
257    KEEP (*(.zinitcall.sys.service4.init))
258    __zinitcall_sys_service_end = .;
259    __zinitcall_sys_feature_start = .;
260    KEEP (*(.zinitcall.sys.feature0.init))
261    KEEP (*(.zinitcall.sys.feature1.init))
262    KEEP (*(.zinitcall.sys.feature2.init))
263    KEEP (*(.zinitcall.sys.feature3.init))
264    KEEP (*(.zinitcall.sys.feature4.init))
265    __zinitcall_sys_feature_end = .;
266    __zinitcall_run_start = .;
267    KEEP (*(.zinitcall.run0.init))
268    KEEP (*(.zinitcall.run1.init))
269    KEEP (*(.zinitcall.run2.init))
270    KEEP (*(.zinitcall.run3.init))
271    KEEP (*(.zinitcall.run4.init))
272    __zinitcall_run_end = .;
273    __zinitcall_app_service_start = .;
274    KEEP (*(.zinitcall.app.service0.init))
275    KEEP (*(.zinitcall.app.service1.init))
276    KEEP (*(.zinitcall.app.service2.init))
277    KEEP (*(.zinitcall.app.service3.init))
278    KEEP (*(.zinitcall.app.service4.init))
279    __zinitcall_app_service_end = .;
280    __zinitcall_app_feature_start = .;
281    KEEP (*(.zinitcall.app.feature0.init))
282    KEEP (*(.zinitcall.app.feature1.init))
283    KEEP (*(.zinitcall.app.feature2.init))
284    KEEP (*(.zinitcall.app.feature3.init))
285    KEEP (*(.zinitcall.app.feature4.init))
286    __zinitcall_app_feature_end = .;
287    __zinitcall_test_start = .;
288    KEEP (*(.zinitcall.test0.init))
289    KEEP (*(.zinitcall.test1.init))
290    KEEP (*(.zinitcall.test2.init))
291    KEEP (*(.zinitcall.test3.init))
292    KEEP (*(.zinitcall.test4.init))
293    __zinitcall_test_end = .;
294    __zinitcall_exit_start = .;
295    KEEP (*(.zinitcall.exit0.init))
296    KEEP (*(.zinitcall.exit1.init))
297    KEEP (*(.zinitcall.exit2.init))
298    KEEP (*(.zinitcall.exit3.init))
299    KEEP (*(.zinitcall.exit4.init))
300    __zinitcall_exit_end = .;
301
302    __text_end = ABSOLUTE(.);
303    _etext = .;
304  } >iram_1
305
306}
307
308PROVIDE ( uartAttach = 0x40008fd0 );
309PROVIDE ( uart_baudrate_detect = 0x40009034 );
310PROVIDE ( uart_buff_switch = 0x400093c0 );
311PROVIDE ( UartConnCheck = 0x40008738 );
312PROVIDE ( UartConnectProc = 0x40008a04 );
313PROVIDE ( UartDev = 0x3ffe019c );
314PROVIDE ( uart_div_modify = 0x400090cc );
315PROVIDE ( UartDwnLdProc = 0x40008ce8 );
316PROVIDE ( UartGetCmdLn = 0x40009564 );
317PROVIDE ( Uart_Init = 0x40009120 );
318PROVIDE ( UartRegReadProc = 0x40008a58 );
319PROVIDE ( UartRegWriteProc = 0x40008a14 );
320PROVIDE ( uart_rx_intr_handler = 0x40008f4c );
321PROVIDE ( uart_rx_one_char = 0x400092d0 );
322PROVIDE ( uart_rx_one_char_block = 0x400092a4 );
323PROVIDE ( uart_rx_readbuff = 0x40009394 );
324PROVIDE ( UartRxString = 0x400092fc );
325PROVIDE ( UartSetBaudProc = 0x40008aac );
326PROVIDE ( UartSpiAttachProc = 0x40008a6c );
327PROVIDE ( UartSpiReadProc = 0x40008a80 );
328PROVIDE ( uart_tx_flush = 0x40009258 );
329PROVIDE ( uart_tx_one_char = 0x40009200 );
330PROVIDE ( uart_tx_one_char2 = 0x4000922c );
331PROVIDE ( uart_tx_switch = 0x40009028 );
332PROVIDE ( uart_tx_wait_idle = 0x40009278 );
333