2021-12-22 14:18:43 +00:00
/*
2024-04-26 12:37:32 +00:00
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
2021-12-22 14:18:43 +00:00
*
* SPDX-License-Identifier: Apache-2.0
*/
2019-12-26 07:25:24 +00:00
/* Simplified memory map for the bootloader.
* Make sure the bootloader can load into main memory without overwriting itself.
*/
2016-08-17 15:08:22 +00:00
MEMORY
{
2023-10-06 11:47:05 +00:00
iram_seg (RWX) : org = 0x4004A000, len = 0x4000 /* SRAM part of block 12 and 13 */
iram_loader_seg (RWX) : org = 0x4004E000, len = 0x7000 /* SRAM part of block 13, Block 14 & part of 15 */
dram_seg (RW) : org = 0x3FFE5000, len = 0x5B00 /* Part SRAM Blocks 15 & 16, ROM static buffer starts at end of this region (reclaimed after app runs) */
2016-08-17 15:08:22 +00:00
}
/* Default entry point: */
ENTRY(call_start_cpu0);
SECTIONS
{
2018-04-19 04:42:26 +00:00
.iram_loader.text :
{
. = ALIGN (16);
2018-08-24 12:26:38 +00:00
_loader_text_start = ABSOLUTE(.);
2018-04-19 04:42:26 +00:00
*(.stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
*(.iram1 .iram1.*) /* catch stray IRAM_ATTR */
*liblog.a:(.literal .text .literal.* .text.*)
2022-11-23 12:00:11 +00:00
/* we use either libgcc or compiler-rt, so put similar entries for them here */
2018-04-19 04:42:26 +00:00
*libgcc.a:(.literal .text .literal.* .text.*)
2022-11-23 12:00:11 +00:00
*libclang_rt.builtins.a:(.literal .text .literal.* .text.*)
2020-07-08 08:42:50 +00:00
*libbootloader_support.a:bootloader_clock_loader.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:bootloader_common_loader.*(.literal .text .literal.* .text.*)
2018-08-16 05:01:43 +00:00
*libbootloader_support.a:bootloader_flash.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:bootloader_random.*(.literal .text .literal.* .text.*)
2020-05-21 07:09:27 +00:00
*libbootloader_support.a:bootloader_random*.*(.literal.bootloader_random_disable .text.bootloader_random_disable)
2020-12-03 16:12:54 +00:00
*libesp_common.a:fpga_overrides.*(.literal.bootloader_fill_random .text.bootloader_fill_random)
2021-12-22 14:18:43 +00:00
*libbootloader_support.a:bootloader_efuse.*(.literal .text .literal.* .text.*)
2018-08-16 05:01:43 +00:00
*libbootloader_support.a:bootloader_utility.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:bootloader_sha.*(.literal .text .literal.* .text.*)
2020-04-30 13:30:15 +00:00
*libbootloader_support.a:bootloader_console_loader.*(.literal .text .literal.* .text.*)
2020-07-08 08:42:50 +00:00
*libbootloader_support.a:bootloader_panic.*(.literal .text .literal.* .text.*)
2021-08-27 04:07:52 +00:00
*libbootloader_support.a:bootloader_soc.*(.literal .text .literal.* .text.*)
2018-08-16 05:01:43 +00:00
*libbootloader_support.a:esp_image_format.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:flash_encrypt.*(.literal .text .literal.* .text.*)
2021-06-16 23:21:36 +00:00
*libbootloader_support.a:flash_encryption_secure_features.*(.literal .text .literal.* .text.*)
2018-08-16 05:01:43 +00:00
*libbootloader_support.a:flash_partitions.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:secure_boot.*(.literal .text .literal.* .text.*)
2021-06-16 23:21:36 +00:00
*libbootloader_support.a:secure_boot_secure_features.*(.literal .text .literal.* .text.*)
2021-03-05 14:22:29 +00:00
*libbootloader_support.a:secure_boot_signatures_bootloader.*(.literal .text .literal.* .text.*)
2018-08-16 05:01:43 +00:00
*libmicro-ecc.a:*.*(.literal .text .literal.* .text.*)
*libspi_flash.a:*.*(.literal .text .literal.* .text.*)
2020-09-03 15:49:24 +00:00
*libhal.a:wdt_hal_iram.*(.literal .text .literal.* .text.*)
2022-02-11 07:30:54 +00:00
*libhal.a:mmu_hal.*(.literal .text .literal.* .text.*)
*libhal.a:cache_hal.*(.literal .text .literal.* .text.*)
2021-12-22 14:18:43 +00:00
*libhal.a:efuse_hal.*(.literal .text .literal.* .text.*)
2020-09-25 07:23:52 +00:00
*libesp_hw_support.a:rtc_clk.*(.literal .text .literal.* .text.*)
*libesp_hw_support.a:rtc_time.*(.literal .text .literal.* .text.*)
*libesp_hw_support.a:regi2c_ctrl.*(.literal .text .literal.* .text.*)
2018-11-19 03:36:19 +00:00
*libefuse.a:*.*(.literal .text .literal.* .text.*)
2022-01-05 06:08:37 +00:00
*libesp_rom.a:esp_rom_regi2c.*(.literal .text .literal.* .text.*)
2018-04-19 04:42:26 +00:00
*(.fini.literal)
*(.fini)
*(.gnu.version)
2018-08-24 12:26:38 +00:00
_loader_text_end = ABSOLUTE(.);
2018-04-19 04:42:26 +00:00
} > iram_loader_seg
2018-07-13 05:21:07 +00:00
2018-04-19 04:42:26 +00:00
.iram.text :
2016-08-17 15:08:22 +00:00
{
. = ALIGN (16);
*(.entry.text)
*(.init.literal)
*(.init)
} > iram_seg
/* Shared RAM */
.dram0.bss (NOLOAD) :
{
. = ALIGN (8);
2020-02-16 05:51:42 +00:00
_dram_start = ABSOLUTE(.);
2016-08-17 15:08:22 +00:00
_bss_start = ABSOLUTE(.);
*(.dynsbss)
*(.sbss)
*(.sbss.*)
*(.gnu.linkonce.sb.*)
*(.scommon)
*(.sbss2)
*(.sbss2.*)
*(.gnu.linkonce.sb2.*)
*(.dynbss)
2017-07-17 04:37:06 +00:00
*(.bss)
2016-08-17 15:08:22 +00:00
*(.bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
. = ALIGN (8);
_bss_end = ABSOLUTE(.);
} >dram_seg
2022-12-13 17:16:56 +00:00
.dram0.bootdesc : ALIGN(0x10)
2016-08-17 15:08:22 +00:00
{
_data_start = ABSOLUTE(.);
2022-12-13 17:16:56 +00:00
*(.data_bootloader_desc .data_bootloader_desc.*) /* Should be the first. Bootloader version info. DO NOT PUT ANYTHING BEFORE IT! */
} > dram_seg
.dram0.data :
{
2024-04-26 12:37:32 +00:00
*(.dram1 .dram1.*) /* catch stray DRAM_ATTR */
2017-07-17 04:37:06 +00:00
*(.data)
*(.data.*)
*(.gnu.linkonce.d.*)
*(.data1)
*(.sdata)
*(.sdata.*)
*(.gnu.linkonce.s.*)
*(.gnu.linkonce.s2.*)
*(.jcr)
2016-08-17 15:08:22 +00:00
_data_end = ABSOLUTE(.);
} >dram_seg
.dram0.rodata :
{
_rodata_start = ABSOLUTE(.);
*(.rodata)
*(.rodata.*)
*(.gnu.linkonce.r.*)
*(.rodata1)
2022-06-17 09:54:09 +00:00
*(.sdata2 .sdata2.*)
2016-08-17 15:08:22 +00:00
__XT_EXCEPTION_TABLE_ = ABSOLUTE(.);
*(.xt_except_table)
*(.gcc_except_table)
*(.gnu.linkonce.e.*)
*(.gnu.version_r)
2024-04-26 12:37:32 +00:00
*(.eh_frame_hdr)
2016-08-17 15:08:22 +00:00
*(.eh_frame)
. = (. + 3) & ~ 3;
/* C++ constructor and destructor tables, properly ordered: */
__init_array_start = ABSOLUTE(.);
2018-08-16 05:01:43 +00:00
KEEP (*crtbegin.*(.ctors))
KEEP (*(EXCLUDE_FILE (*crtend.*) .ctors))
2016-08-17 15:08:22 +00:00
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
__init_array_end = ABSOLUTE(.);
2018-08-16 05:01:43 +00:00
KEEP (*crtbegin.*(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.*) .dtors))
2016-08-17 15:08:22 +00:00
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
/* C++ exception handlers table: */
__XT_EXCEPTION_DESCS_ = ABSOLUTE(.);
*(.xt_except_desc)
*(.gnu.linkonce.h.*)
__XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
*(.xt_except_desc_end)
*(.dynamic)
*(.gnu.version_d)
_rodata_end = ABSOLUTE(.);
/* Literals are also RO data. */
_lit4_start = ABSOLUTE(.);
*(*.lit4)
*(.lit4.*)
*(.gnu.linkonce.lit4.*)
_lit4_end = ABSOLUTE(.);
. = ALIGN(4);
2020-02-16 05:51:42 +00:00
_dram_end = ABSOLUTE(.);
2016-08-17 15:08:22 +00:00
} >dram_seg
2017-06-16 06:30:21 +00:00
.iram.text :
2016-08-17 15:08:22 +00:00
{
_stext = .;
_text_start = ABSOLUTE(.);
*(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
2018-04-19 04:42:26 +00:00
*(.iram .iram.*) /* catch stray IRAM_ATTR */
2016-08-17 15:08:22 +00:00
*(.fini.literal)
*(.fini)
*(.gnu.version)
2021-03-29 04:18:25 +00:00
/** CPU will try to prefetch up to 16 bytes of
* of instructions. This means that any configuration (e.g. MMU, PMS) must allow
* safe access to up to 16 bytes after the last real instruction, add
* dummy bytes to ensure this
*/
. += 16;
2016-08-17 15:08:22 +00:00
_text_end = ABSOLUTE(.);
_etext = .;
2017-06-16 06:30:21 +00:00
} > iram_seg
2016-08-17 15:08:22 +00:00
2022-02-24 07:24:11 +00:00
/** This section will be used by the debugger and disassembler to get more information
* about raw data present in the code.
* Indeed, it may be required to add some padding at some points in the code
* in order to align a branch/jump destination on a particular bound.
* Padding these instructions will generate null bytes that shall be
* interpreted as data, and not code by the debugger or disassembler.
* This section will only be present in the ELF file, not in the final binary
* For more details, check GCC-212
*/
.xt.prop 0 :
{
KEEP (*(.xt.prop .gnu.linkonce.prop.*))
}
.xt.lit 0 :
{
KEEP (*(.xt.lit .gnu.linkonce.p.*))
}
2024-04-26 12:37:32 +00:00
.xtensa.info 0: { *(.xtensa.info) }
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
.debug_pubtypes 0 : { *(.debug_pubtypes) }
/* DWARF 3 */
.debug_ranges 0 : { *(.debug_ranges) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
/* GNU DWARF 2 extensions */
.debug_gnu_pubnames 0 : { *(.debug_gnu_pubnames) }
.debug_gnu_pubtypes 0 : { *(.debug_gnu_pubtypes) }
/* DWARF 4 */
.debug_types 0 : { *(.debug_types) }
/* DWARF 5 */
.debug_addr 0 : { *(.debug_addr) }
.debug_line_str 0 : { *(.debug_line_str) }
.debug_loclists 0 : { *(.debug_loclists) }
.debug_macro 0 : { *(.debug_macro) }
.debug_names 0 : { *(.debug_names) }
.debug_rnglists 0 : { *(.debug_rnglists) }
.debug_str_offsets 0 : { *(.debug_str_offsets) }
.comment 0 : { *(.comment) }
.note.GNU-stack 0: { *(.note.GNU-stack) }
2016-08-17 15:08:22 +00:00
}