• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2Linker file used to link the bootloader.
3*/
4
5
6/* Simplified memory map for the bootloader
7
8   The main purpose is to make sure the bootloader can load into main memory
9   without overwriting itself.
10*/
11
12MEMORY
13{
14  /* IRAM POOL1, used for APP CPU cache. Bootloader runs from here during the final stage of loading the app because APP CPU is still held in reset, the main app enables APP CPU cache */
15  iram_loader_seg (RWX) :           org = 0x40078000, len = 0x8000  /* 32KB, APP CPU cache */
16  /* 63kB, IRAM. We skip the first 1k to prevent the entry point being
17     placed into the same range as exception vectors in the app.
18     This leads to idf_monitor decoding ROM bootloader "entry 0x40080xxx"
19     message as one of the exception vectors, which looks scary to users.
20  */
21  iram_seg (RWX) :                  org = 0x40080400, len = 0xfc00
22  /* 64k at the end of DRAM, after ROM bootloader stack */
23  dram_seg (RW) :                  	org = 0x3FFF0000, len = 0x10000
24}
25
26/*  Default entry point:  */
27ENTRY(call_start_cpu0);
28
29
30SECTIONS
31{
32
33  .iram_loader.text :
34  {
35    . = ALIGN (16);
36    _loader_text_start = ABSOLUTE(.);
37    *(.stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
38     *(.iram1 .iram1.*) /* catch stray IRAM_ATTR */
39    *log.a:(.literal .text .literal.* .text.*)
40    *libgcc.a:(.literal .text .literal.* .text.*)
41    *bootloader_support.a:*bootloader_clock_loader.*(.literal .text .literal.* .text.*)
42    *bootloader_support.a:*bootloader_common_loader.*(.literal .text .literal.* .text.*)
43    *bootloader_support.a:*bootloader_flash.*(.literal .text .literal.* .text.*)
44    *bootloader_support.a:*bootloader_random.*(.literal .text .literal.* .text.*)
45    *bootloader_support.a:*bootloader_random*.*(.literal.bootloader_random_disable .text.bootloader_random_disable)
46    *bootloader_support.a:*bootloader_efuse_esp32.*(.literal .text .literal.* .text.*)
47    *bootloader_support.a:*bootloader_utility.*(.literal .text .literal.* .text.*)
48    *bootloader_support.a:*bootloader_sha.*(.literal .text .literal.* .text.*)
49    *bootloader_support.a:*bootloader_console_loader.*(.literal .text .literal.* .text.*)
50    *bootloader_support.a:*bootloader_panic.*(.literal .text .literal.* .text.*)
51    *bootloader_support.a:*esp_image_format.*(.literal .text .literal.* .text.*)
52    *bootloader_support.a:*flash_encrypt.*(.literal .text .literal.* .text.*)
53    *bootloader_support.a:*flash_partitions.*(.literal .text .literal.* .text.*)
54    *bootloader_support.a:*secure_boot.*(.literal .text .literal.* .text.*)
55    *bootloader_support.a:*secure_boot_signatures_bootloader.*(.literal .text .literal.* .text.*)
56    *micro-ecc.a:*.*(.literal .text .literal.* .text.*)
57    *spi_flash.a:*.*(.literal .text .literal.* .text.*)
58    *hal.a:*wdt_hal_iram.*(.literal .text .literal.* .text.*)
59    *esp_hw_support.a:*rtc_clk.*(.literal .text .literal.* .text.*)
60    *esp_hw_support.a:*rtc_time.*(.literal .text .literal.* .text.*)
61    *efuse.a:*.*(.literal .text .literal.* .text.*)
62    *(.fini.literal)
63    *(.fini)
64    *(.gnu.version)
65    _loader_text_end = ABSOLUTE(.);
66  } > iram_loader_seg
67
68  .iram.text :
69  {
70    . = ALIGN (16);
71    *(.entry.text)
72    *(.init.literal)
73    *(.init)
74  } > iram_seg
75
76
77  /* Shared RAM */
78  .dram0.bss (NOLOAD) :
79  {
80    . = ALIGN (8);
81    _dram_start = ABSOLUTE(.);
82    _bss_start = ABSOLUTE(.);
83    *(.dynsbss)
84    *(.sbss)
85    *(.sbss.*)
86    *(.gnu.linkonce.sb.*)
87    *(.scommon)
88    *(.sbss2)
89    *(.sbss2.*)
90    *(.gnu.linkonce.sb2.*)
91    *(.dynbss)
92    *(.bss)
93    *(.bss.*)
94    *(.gnu.linkonce.b.*)
95    *(COMMON)
96    . = ALIGN (8);
97    _bss_end = ABSOLUTE(.);
98  } >dram_seg
99
100  .dram0.data :
101  {
102    _data_start = ABSOLUTE(.);
103    *(.data)
104    *(.data.*)
105    *(.gnu.linkonce.d.*)
106    *(.data1)
107    *(.sdata)
108    *(.sdata.*)
109    *(.gnu.linkonce.s.*)
110    *(.sdata2)
111    *(.sdata2.*)
112    *(.gnu.linkonce.s2.*)
113    *(.jcr)
114    _data_end = ABSOLUTE(.);
115  } >dram_seg
116
117  .dram0.rodata :
118  {
119    _rodata_start = ABSOLUTE(.);
120    *(.rodata)
121    *(.rodata.*)
122    *(.gnu.linkonce.r.*)
123    *(.rodata1)
124    __XT_EXCEPTION_TABLE_ = ABSOLUTE(.);
125    *(.xt_except_table)
126    *(.gcc_except_table)
127    *(.gnu.linkonce.e.*)
128    *(.gnu.version_r)
129    *(.eh_frame)
130    . = (. + 3) & ~ 3;
131    /*  C++ constructor and destructor tables, properly ordered:  */
132    __init_array_start = ABSOLUTE(.);
133    KEEP (*crtbegin.*(.ctors))
134    KEEP (*(EXCLUDE_FILE (*crtend.*) .ctors))
135    KEEP (*(SORT(.ctors.*)))
136    KEEP (*(.ctors))
137    __init_array_end = ABSOLUTE(.);
138    KEEP (*crtbegin.*(.dtors))
139    KEEP (*(EXCLUDE_FILE (*crtend.*) .dtors))
140    KEEP (*(SORT(.dtors.*)))
141    KEEP (*(.dtors))
142    /*  C++ exception handlers table:  */
143    __XT_EXCEPTION_DESCS_ = ABSOLUTE(.);
144    *(.xt_except_desc)
145    *(.gnu.linkonce.h.*)
146    __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
147    *(.xt_except_desc_end)
148    *(.dynamic)
149    *(.gnu.version_d)
150    _rodata_end = ABSOLUTE(.);
151	/* Literals are also RO data. */
152    _lit4_start = ABSOLUTE(.);
153    *(*.lit4)
154    *(.lit4.*)
155    *(.gnu.linkonce.lit4.*)
156    _lit4_end = ABSOLUTE(.);
157    . = ALIGN(4);
158    _dram_end = ABSOLUTE(.);
159  } >dram_seg
160
161  .iram.text :
162  {
163    _stext = .;
164    _text_start = ABSOLUTE(.);
165    *(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
166    *(.iram .iram.*) /* catch stray IRAM_ATTR */
167    *(.fini.literal)
168    *(.fini)
169    *(.gnu.version)
170
171    /** CPU will try to prefetch up to 16 bytes of
172      * of instructions. This means that any configuration (e.g. MMU, PMS) must allow
173      * safe access to up to 16 bytes after the last real instruction, add
174      * dummy bytes to ensure this
175      */
176    . += 16;
177
178    _text_end = ABSOLUTE(.);
179    _etext = .;
180  } > iram_seg
181
182}
183