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#ifdef CONFIG_ESP_MULTI_PROCESSOR_BOOT 16 iram_loader_seg (RWX) : org = 0x400AB900, len = 0x6500 17#else 18 /* iram_loader_seg is currently placed on APP_CPU cache IRAM address range */ 19 iram_loader_seg (RWX) : org = 0x40078000, len = 0x6500 20#endif 21 iram_seg (RWX) : org = 0x40090000, len = 0x9000 22 dram_seg (RW) : org = 0x3FFF4700, len = 0xB900 23} 24 25/* Default entry point: */ 26ENTRY(main); 27 28SECTIONS 29{ 30 .iram_loader.text : 31 { 32 . = ALIGN (16); 33 _loader_text_start = ABSOLUTE(.); 34 *(.stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*) 35 *(.iram1 .iram1.*) /* catch stray IRAM_ATTR */ 36 *libhal.a:*.*(.literal .text .literal.* .text.*) 37 *esp_mcuboot.*(.literal .text .literal.* .text.*) 38 *esp_loader.*(.literal .text .literal.* .text.*) 39 *main.*(.literal .text .literal.* .text.*) 40 *(.fini.literal) 41 *(.fini) 42 *(.gnu.version) 43 _loader_text_end = ABSOLUTE(.); 44 } > iram_loader_seg 45 .iram.text : 46 { 47 . = ALIGN (16); 48 *(.entry.text) 49 *(.init.literal) 50 *(.init) 51 } > iram_seg 52 .dram0.bss (NOLOAD) : 53 { 54 . = ALIGN (8); 55 _dram_start = ABSOLUTE(.); 56 _bss_start = ABSOLUTE(.); 57 *(.dynsbss) 58 *(.sbss) 59 *(.sbss.*) 60 *(.gnu.linkonce.sb.*) 61 *(.scommon) 62 *(.sbss2) 63 *(.sbss2.*) 64 *(.gnu.linkonce.sb2.*) 65 *(.dynbss) 66 *(.bss) 67 *(.bss.*) 68 *(.gnu.linkonce.b.*) 69 *(COMMON) 70 . = ALIGN (8); 71 _bss_end = ABSOLUTE(.); 72 } >dram_seg 73 .dram0.data : 74 { 75 _data_start = ABSOLUTE(.); 76 *(.data) 77 *(.data.*) 78 *(.gnu.linkonce.d.*) 79 *(.data1) 80 *(.sdata) 81 *(.sdata.*) 82 *(.gnu.linkonce.s.*) 83 *(.sdata2) 84 *(.sdata2.*) 85 *(.gnu.linkonce.s2.*) 86 *(.jcr) 87 _data_end = ABSOLUTE(.); 88 } >dram_seg 89 .dram0.rodata : 90 { 91 _rodata_start = ABSOLUTE(.); 92 *(.rodata) 93 *(.rodata.*) 94 *(.gnu.linkonce.r.*) 95 *(.rodata1) 96 __XT_EXCEPTION_TABLE_ = ABSOLUTE(.); 97 *(.xt_except_table) 98 *(.gcc_except_table) 99 *(.gnu.linkonce.e.*) 100 *(.gnu.version_r) 101 *(.eh_frame) 102 . = (. + 3) & ~ 3; 103 /* C++ constructor and destructor tables, properly ordered: */ 104 __init_array_start = ABSOLUTE(.); 105 KEEP (*crtbegin.*(.ctors)) 106 KEEP (*(EXCLUDE_FILE (*crtend.*) .ctors)) 107 KEEP (*(SORT(.ctors.*))) 108 KEEP (*(.ctors)) 109 __init_array_end = ABSOLUTE(.); 110 KEEP (*crtbegin.*(.dtors)) 111 KEEP (*(EXCLUDE_FILE (*crtend.*) .dtors)) 112 KEEP (*(SORT(.dtors.*))) 113 KEEP (*(.dtors)) 114 /* C++ exception handlers table: */ 115 __XT_EXCEPTION_DESCS_ = ABSOLUTE(.); 116 *(.xt_except_desc) 117 *(.gnu.linkonce.h.*) 118 __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.); 119 *(.xt_except_desc_end) 120 *(.dynamic) 121 *(.gnu.version_d) 122 _rodata_end = ABSOLUTE(.); 123 /* Literals are also RO data. */ 124 _lit4_start = ABSOLUTE(.); 125 *(*.lit4) 126 *(.lit4.*) 127 *(.gnu.linkonce.lit4.*) 128 _lit4_end = ABSOLUTE(.); 129 . = ALIGN(4); 130 _dram_end = ABSOLUTE(.); 131 } >dram_seg 132 .iram.text : 133 { 134 _stext = .; 135 _text_start = ABSOLUTE(.); 136 *(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*) 137 *(.iram .iram.*) /* catch stray IRAM_ATTR */ 138 *(.fini.literal) 139 *(.fini) 140 *(.gnu.version) 141 _text_end = ABSOLUTE(.); 142 _etext = .; 143 } > iram_seg 144} 145