esp-idf-bootloader: Switch esp-idf bootloader entry point to apeos_boot()
[apeos.git] / components / bootloader / subproject / main / esp32.bootloader.ld
blob1e52427f56ac16f4e1c39b59a0d98bab8d4eda02
1 /* Copyright 2015-2018 Espressif Systems (Shanghai) PTE LTD
2  * Copyright 2018 apeos contributors
3  *
4  * Linker file used to link the bootloader.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License. */
18 /* Simplified memory map for the bootloader
20    The main purpose is to make sure the bootloader can load into main memory
21    without overwriting itself.
23 MEMORY
25   /* I/O */
26   dport0_seg (RW) :                     org = 0x3FF00000, len = 0x10
27   /* IRAM POOL1, used for APP CPU cache. We can abuse it in bootloader because APP CPU is still held in reset, the main app enables APP CPU cache */
28   iram_seg (RWX) :           org = 0x40078000, len = 0x8000
29   /* 64k at the end of DRAM, after ROM bootloader stack */
30   dram_seg (RW) :                       org = 0x3FFF0000, len = 0x10000
33 /*  Default entry point:  */
34 ENTRY(apeos_boot);
37 SECTIONS
39   .iram1.text :
40   {
41     . = ALIGN (16);
42     *(.entry.text)
43     *(.init.literal)
44     *(.init)
45   } > iram_seg
48   /* Shared RAM */
49   .dram0.bss (NOLOAD) :
50   {
51     . = ALIGN (8);
52     _bss_start = ABSOLUTE(.);
53     *(.dynsbss)
54     *(.sbss)
55     *(.sbss.*)
56     *(.gnu.linkonce.sb.*)
57     *(.scommon)
58     *(.sbss2)
59     *(.sbss2.*)
60     *(.gnu.linkonce.sb2.*)
61     *(.dynbss)
62     *(.bss)
63     *(.bss.*)
64     *(.gnu.linkonce.b.*)
65     *(COMMON)
66     . = ALIGN (8);
67     _bss_end = ABSOLUTE(.);
68   } >dram_seg
70   .dram0.data :
71   {
72     _data_start = ABSOLUTE(.);
73     *(.data)
74     *(.data.*)
75     *(.gnu.linkonce.d.*)
76     *(.data1)
77     *(.sdata)
78     *(.sdata.*)
79     *(.gnu.linkonce.s.*)
80     *(.sdata2)
81     *(.sdata2.*)
82     *(.gnu.linkonce.s2.*)
83     *(.jcr)
84     _data_end = ABSOLUTE(.);
85   } >dram_seg
87   .dram0.rodata :
88   {
89     _rodata_start = ABSOLUTE(.);
90     *(.rodata)
91     *(.rodata.*)
92     *(.gnu.linkonce.r.*)
93     *(.rodata1)
94     __XT_EXCEPTION_TABLE_ = ABSOLUTE(.);
95     *(.xt_except_table)
96     *(.gcc_except_table)
97     *(.gnu.linkonce.e.*)
98     *(.gnu.version_r)
99     *(.eh_frame)
100     . = (. + 3) & ~ 3;
101     /*  C++ constructor and destructor tables, properly ordered:  */
102     __init_array_start = ABSOLUTE(.);
103     KEEP (*crtbegin.o(.ctors))
104     KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
105     KEEP (*(SORT(.ctors.*)))
106     KEEP (*(.ctors))
107     __init_array_end = ABSOLUTE(.);
108     KEEP (*crtbegin.o(.dtors))
109     KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
110     KEEP (*(SORT(.dtors.*)))
111     KEEP (*(.dtors))
112     /*  C++ exception handlers table:  */
113     __XT_EXCEPTION_DESCS_ = ABSOLUTE(.);
114     *(.xt_except_desc)
115     *(.gnu.linkonce.h.*)
116     __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
117     *(.xt_except_desc_end)
118     *(.dynamic)
119     *(.gnu.version_d)
120     _rodata_end = ABSOLUTE(.);
121         /* Literals are also RO data. */
122     _lit4_start = ABSOLUTE(.);
123     *(*.lit4)
124     *(.lit4.*)
125     *(.gnu.linkonce.lit4.*)
126     _lit4_end = ABSOLUTE(.);
127     . = ALIGN(4);
128     _heap_start = ABSOLUTE(.);
129   } >dram_seg
131   .iram.text :
132   {
133     _stext = .;
134     _text_start = ABSOLUTE(.);
135     *(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
136     *(.iram1 .iram1.*) /* catch stray IRAM_ATTR */
137     *(.fini.literal)
138     *(.fini)
139     *(.gnu.version)
140     _text_end = ABSOLUTE(.);
141     _etext = .;
142   } > iram_seg