esp32.bootloader.ld
1 /* 2 Linker 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 12 MEMORY 13 { 14 /* I/O */ 15 dport0_seg (RW) : org = 0x3FF00000, len = 0x10 16 /* 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 */ 17 iram_loader_seg (RWX) : org = 0x40078000, len = 0x8000 /* 32KB, APP CPU cache */ 18 /* 63kB, IRAM. We skip the first 1k to prevent the entry point being 19 placed into the same range as exception vectors in the app. 20 This leads to idf_monitor decoding ROM bootloader "entry 0x40080xxx" 21 message as one of the exception vectors, which looks scary to users. 22 */ 23 iram_seg (RWX) : org = 0x40080400, len = 0xfc00 24 /* 64k at the end of DRAM, after ROM bootloader stack */ 25 dram_seg (RW) : org = 0x3FFF0000, len = 0x10000 26 } 27 28 /* Default entry point: */ 29 ENTRY(call_start_cpu0); 30 31 32 SECTIONS 33 { 34 35 .iram_loader.text : 36 { 37 . = ALIGN (16); 38 _loader_text_start = ABSOLUTE(.); 39 *(.stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*) 40 *(.iram1 .iram1.*) /* catch stray IRAM_ATTR */ 41 *liblog.a:(.literal .text .literal.* .text.*) 42 *libgcc.a:(.literal .text .literal.* .text.*) 43 *libbootloader_support.a:bootloader_common.*(.literal .text .literal.* .text.*) 44 *libbootloader_support.a:bootloader_flash.*(.literal .text .literal.* .text.*) 45 *libbootloader_support.a:bootloader_random.*(.literal .text .literal.* .text.*) 46 *libbootloader_support.a:bootloader_utility.*(.literal .text .literal.* .text.*) 47 *libbootloader_support.a:bootloader_sha.*(.literal .text .literal.* .text.*) 48 *libbootloader_support.a:efuse.*(.literal .text .literal.* .text.*) 49 *libbootloader_support.a:esp_image_format.*(.literal .text .literal.* .text.*) 50 *libbootloader_support.a:flash_encrypt.*(.literal .text .literal.* .text.*) 51 *libbootloader_support.a:flash_partitions.*(.literal .text .literal.* .text.*) 52 *libbootloader_support.a:secure_boot.*(.literal .text .literal.* .text.*) 53 *libbootloader_support.a:secure_boot_signatures.*(.literal .text .literal.* .text.*) 54 *libmicro-ecc.a:*.*(.literal .text .literal.* .text.*) 55 *libspi_flash.a:*.*(.literal .text .literal.* .text.*) 56 *libsoc.a:rtc_wdt.*(.literal .text .literal.* .text.*) 57 *(.fini.literal) 58 *(.fini) 59 *(.gnu.version) 60 _loader_text_end = ABSOLUTE(.); 61 } > iram_loader_seg 62 63 .iram.text : 64 { 65 . = ALIGN (16); 66 *(.entry.text) 67 *(.init.literal) 68 *(.init) 69 } > iram_seg 70 71 72 /* Shared RAM */ 73 .dram0.bss (NOLOAD) : 74 { 75 . = ALIGN (8); 76 _bss_start = ABSOLUTE(.); 77 *(.dynsbss) 78 *(.sbss) 79 *(.sbss.*) 80 *(.gnu.linkonce.sb.*) 81 *(.scommon) 82 *(.sbss2) 83 *(.sbss2.*) 84 *(.gnu.linkonce.sb2.*) 85 *(.dynbss) 86 *(.bss) 87 *(.bss.*) 88 *(.gnu.linkonce.b.*) 89 *(COMMON) 90 . = ALIGN (8); 91 _bss_end = ABSOLUTE(.); 92 } >dram_seg 93 94 .dram0.data : 95 { 96 _data_start = ABSOLUTE(.); 97 *(.data) 98 *(.data.*) 99 *(.gnu.linkonce.d.*) 100 *(.data1) 101 *(.sdata) 102 *(.sdata.*) 103 *(.gnu.linkonce.s.*) 104 *(.sdata2) 105 *(.sdata2.*) 106 *(.gnu.linkonce.s2.*) 107 *(.jcr) 108 _data_end = ABSOLUTE(.); 109 } >dram_seg 110 111 .dram0.rodata : 112 { 113 _rodata_start = ABSOLUTE(.); 114 *(.rodata) 115 *(.rodata.*) 116 *(.gnu.linkonce.r.*) 117 *(.rodata1) 118 __XT_EXCEPTION_TABLE_ = ABSOLUTE(.); 119 *(.xt_except_table) 120 *(.gcc_except_table) 121 *(.gnu.linkonce.e.*) 122 *(.gnu.version_r) 123 *(.eh_frame) 124 . = (. + 3) & ~ 3; 125 /* C++ constructor and destructor tables, properly ordered: */ 126 __init_array_start = ABSOLUTE(.); 127 KEEP (*crtbegin.*(.ctors)) 128 KEEP (*(EXCLUDE_FILE (*crtend.*) .ctors)) 129 KEEP (*(SORT(.ctors.*))) 130 KEEP (*(.ctors)) 131 __init_array_end = ABSOLUTE(.); 132 KEEP (*crtbegin.*(.dtors)) 133 KEEP (*(EXCLUDE_FILE (*crtend.*) .dtors)) 134 KEEP (*(SORT(.dtors.*))) 135 KEEP (*(.dtors)) 136 /* C++ exception handlers table: */ 137 __XT_EXCEPTION_DESCS_ = ABSOLUTE(.); 138 *(.xt_except_desc) 139 *(.gnu.linkonce.h.*) 140 __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.); 141 *(.xt_except_desc_end) 142 *(.dynamic) 143 *(.gnu.version_d) 144 _rodata_end = ABSOLUTE(.); 145 /* Literals are also RO data. */ 146 _lit4_start = ABSOLUTE(.); 147 *(*.lit4) 148 *(.lit4.*) 149 *(.gnu.linkonce.lit4.*) 150 _lit4_end = ABSOLUTE(.); 151 . = ALIGN(4); 152 _heap_start = ABSOLUTE(.); 153 } >dram_seg 154 155 .iram.text : 156 { 157 _stext = .; 158 _text_start = ABSOLUTE(.); 159 *(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*) 160 *(.iram .iram.*) /* catch stray IRAM_ATTR */ 161 *(.fini.literal) 162 *(.fini) 163 *(.gnu.version) 164 _text_end = ABSOLUTE(.); 165 _etext = .; 166 } > iram_seg 167 168 }