1/* 2 * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7/* Simplified memory map for the bootloader. 8 * 9 * The main purpose is to make sure the bootloader can load into main memory 10 * without overwriting itself. 11 */ 12 13MEMORY 14{ 15 iram_seg (RWX) : org = 0x403C8000, len = 0x8000 16 iram_loader_seg (RWX) : org = 0x403D0000, len = 0x4800 17 dram_seg (RW) : org = 0x3FCD5000, len = 0x8C00 18} 19 20/* Default entry point: */ 21ENTRY(main); 22 23SECTIONS 24{ 25 .iram_loader.text : 26 { 27 . = ALIGN (16); 28 _loader_text_start = ABSOLUTE(.); 29 *(.stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*) 30 *(.iram1 .iram1.*) /* catch stray IRAM_ATTR */ 31 *libhal.a:bootloader_flash.*(.literal .text .literal.* .text.*) 32 *libhal.a:bootloader_flash_config_esp32c3.*(.literal .text .literal.* .text.*) 33 *libhal.a:bootloader_clock_loader.*(.literal .text .literal.* .text.*) 34 *libhal.a:bootloader_common_loader.*(.literal .text .literal.* .text.*) 35 *libhal.a:bootloader_init_common.*(.literal .text .literal.* .text.*) 36 *libhal.a:bootloader_random.*(.literal .text .literal.* .text.*) 37 *libhal.a:bootloader_random*.*(.literal.bootloader_random_disable .text.bootloader_random_disable) 38 *libhal.a:bootloader_random*.*(.literal.bootloader_random_enable .text.bootloader_random_enable) 39 *libhal.a:bootloader_efuse_esp32c3.*(.literal .text .literal.* .text.*) 40 *libhal.a:bootloader_utility.*(.literal .text .literal.* .text.*) 41 *libhal.a:bootloader_sha.*(.literal .text .literal.* .text.*) 42 *libhal.a:bootloader_console.*(.literal .text .literal.* .text.*) 43 *libhal.a:bootloader_console_loader.*(.literal .text .literal.* .text.*) 44 *libhal.a:bootloader_panic.*(.literal .text .literal.* .text.*) 45 *libhal.a:bootloader_soc.*(.literal .text .literal.* .text.*) 46 *libhal.a:esp_image_format.*(.literal .text .literal.* .text.*) 47 *libhal.a:flash_encrypt.*(.literal .text .literal.* .text.*) 48 *libhal.a:flash_encryption_secure_features.*(.literal .text .literal.* .text.*) 49 *libhal.a:flash_partitions.*(.literal .text .literal.* .text.*) 50 *libhal.a:secure_boot.*(.literal .text .literal.* .text.*) 51 *libhal.a:secure_boot_secure_features.*(.literal .text .literal.* .text.*) 52 *libhal.a:secure_boot_signatures_bootloader.*(.literal .text .literal.* .text.*) 53 *libhal.a:wdt_hal_iram.*(.literal .text .literal.* .text.*) 54 *libhal.a:esp_efuse_table.*(.literal .text .literal.* .text.*) 55 *libhal.a:esp_efuse_fields.*(.literal .text .literal.* .text.*) 56 *libhal.a:esp_efuse_api.*(.literal .text .literal.* .text.*) 57 *libhal.a:esp_efuse_utility.*(.literal .text .literal.* .text.*) 58 *libhal.a:esp_efuse_api_key_esp32xx.*(.literal .text .literal.* .text.*) 59 *esp_mcuboot.*(.literal .text .literal.* .text.*) 60 *esp_loader.*(.literal .text .literal.* .text.*) 61 *(.fini.literal) 62 *(.fini) 63 *(.gnu.version) 64 _loader_text_end = ABSOLUTE(.); 65 } > iram_loader_seg 66 67 .iram.text : 68 { 69 . = ALIGN (16); 70 *(.entry.text) 71 *(.init.literal) 72 *(.init) 73 } > iram_seg 74 75 76 /* Shared RAM */ 77 .dram0.bss (NOLOAD) : 78 { 79 . = ALIGN (8); 80 _dram_start = ABSOLUTE(.); 81 _bss_start = ABSOLUTE(.); 82 *(.dynsbss) 83 *(.sbss) 84 *(.sbss.*) 85 *(.gnu.linkonce.sb.*) 86 *(.scommon) 87 *(.sbss2) 88 *(.sbss2.*) 89 *(.gnu.linkonce.sb2.*) 90 *(.dynbss) 91 *(.bss) 92 *(.bss.*) 93 *(.gnu.linkonce.b.*) 94 *(COMMON) 95 . = ALIGN (8); 96 _bss_end = ABSOLUTE(.); 97 } >dram_seg 98 99 .dram0.data : 100 { 101 _data_start = ABSOLUTE(.); 102 *(.data) 103 *(.data.*) 104 *(.gnu.linkonce.d.*) 105 *(.data1) 106 *(.sdata) 107 *(.sdata.*) 108 *(.gnu.linkonce.s.*) 109 *(.sdata2) 110 *(.sdata2.*) 111 *(.gnu.linkonce.s2.*) 112 *(.jcr) 113 _data_end = ABSOLUTE(.); 114 } >dram_seg 115 116 .dram0.rodata : 117 { 118 _rodata_start = ABSOLUTE(.); 119 *(.rodata) 120 *(.rodata.*) 121 *(.gnu.linkonce.r.*) 122 *(.rodata1) 123 __XT_EXCEPTION_TABLE_ = ABSOLUTE(.); 124 *(.xt_except_table) 125 *(.gcc_except_table) 126 *(.gnu.linkonce.e.*) 127 *(.gnu.version_r) 128 *(.eh_frame) 129 . = (. + 3) & ~ 3; 130 /* C++ constructor and destructor tables, properly ordered: */ 131 __init_array_start = ABSOLUTE(.); 132 KEEP (*crtbegin.*(.ctors)) 133 KEEP (*(EXCLUDE_FILE (*crtend.*) .ctors)) 134 KEEP (*(SORT(.ctors.*))) 135 KEEP (*(.ctors)) 136 __init_array_end = ABSOLUTE(.); 137 KEEP (*crtbegin.*(.dtors)) 138 KEEP (*(EXCLUDE_FILE (*crtend.*) .dtors)) 139 KEEP (*(SORT(.dtors.*))) 140 KEEP (*(.dtors)) 141 /* C++ exception handlers table: */ 142 __XT_EXCEPTION_DESCS_ = ABSOLUTE(.); 143 *(.xt_except_desc) 144 *(.gnu.linkonce.h.*) 145 __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.); 146 *(.xt_except_desc_end) 147 *(.dynamic) 148 *(.gnu.version_d) 149 _rodata_end = ABSOLUTE(.); 150 /* Literals are also RO data. */ 151 _lit4_start = ABSOLUTE(.); 152 *(*.lit4) 153 *(.lit4.*) 154 *(.gnu.linkonce.lit4.*) 155 _lit4_end = ABSOLUTE(.); 156 . = ALIGN(4); 157 _dram_end = ABSOLUTE(.); 158 } >dram_seg 159 160 .iram.text : 161 { 162 _stext = .; 163 _text_start = ABSOLUTE(.); 164 *(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*) 165 *(.iram .iram.*) /* catch stray IRAM_ATTR */ 166 *(.fini.literal) 167 *(.fini) 168 *(.gnu.version) 169 _text_end = ABSOLUTE(.); 170 _etext = .; 171 } > iram_seg 172 173} 174