1/* 2 * Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. 3 * SPDX-License-Identifier: Apache-2.0 4 */ 5 6#include <zephyr/devicetree.h> 7#include <zephyr/linker/sections.h> 8#include <zephyr/linker/linker-defs.h> 9#include <zephyr/linker/linker-tool.h> 10 11#include "memory.h" 12 13/* The "user_iram_end" represents the 2nd stage bootloader 14 * "iram_loader_seg" start address (that should not be overlapped). 15 * If no bootloader is used, we can extend it to gain more user ram. 16 */ 17#ifdef CONFIG_ESP_SIMPLE_BOOT 18user_iram_end = (DRAM_BUFFERS_START + IRAM_DRAM_OFFSET); 19#else 20user_iram_end = BOOTLOADER_IRAM_LOADER_SEG_START; 21#endif 22 23/* User available SRAM memory segments */ 24user_iram_seg_org = SRAM1_IRAM_START; 25user_dram_seg_org = SRAM1_DRAM_START; 26user_dram_end = (user_iram_end - IRAM_DRAM_OFFSET); 27user_idram_size = (user_dram_end - user_dram_seg_org); 28user_iram_seg_len = user_idram_size; 29user_dram_seg_len = user_idram_size; 30 31/* Aliases */ 32#define FLASH_CODE_REGION irom0_0_seg 33#define RODATA_REGION drom0_0_seg 34#define IRAM_REGION iram0_0_seg 35#define DRAM_REGION dram0_0_seg 36#define RAMABLE_REGION dram0_0_seg 37#define ROMABLE_REGION FLASH 38 39#undef GROUP_DATA_LINK_IN 40#define GROUP_DATA_LINK_IN(vregion, lregion) > vregion AT > lregion 41 42#undef GROUP_NOLOAD_LINK_IN 43#define GROUP_NOLOAD_LINK_IN(vregion, lregion) > vregion 44 45/* Flash segments (rodata and text) should be mapped in the virtual address spaces. 46 * Executing directly from LMA is not possible. */ 47#undef GROUP_ROM_LINK_IN 48#define GROUP_ROM_LINK_IN(vregion, lregion) > RODATA_REGION AT > lregion 49 50/* Make sure new sections have consistent alignment between input and output sections */ 51#undef SECTION_DATA_PROLOGUE 52#define SECTION_DATA_PROLOGUE(name, options, align) name options : ALIGN_WITH_INPUT 53 54#undef SECTION_PROLOGUE 55#define SECTION_PROLOGUE SECTION_DATA_PROLOGUE 56 57/* Global symbols required for espressif hal build */ 58MEMORY 59{ 60#ifdef CONFIG_BOOTLOADER_MCUBOOT 61 mcuboot_hdr (R): org = 0x0, len = 0x20 62 metadata (R): org = 0x20, len = 0x20 63 FLASH (R): org = 0x40, len = FLASH_SIZE - 0x40 64#else 65 /* Make safety margin in the FLASH memory size so the 66 * (esp_img_header + (n*esp_seg_headers)) would fit */ 67 FLASH (R): org = 0x0, len = FLASH_SIZE - 0x100 68#endif 69 70 iram0_0_seg(RX): org = user_iram_seg_org, len = user_iram_seg_len 71 dram0_0_seg(RW): org = user_dram_seg_org, len = user_dram_seg_len 72 73 irom0_0_seg(RX): org = IROM_SEG_ORG, len = IROM_SEG_LEN 74 drom0_0_seg (R): org = DROM_SEG_ORG, len = DROM_SEG_LEN 75 76#ifdef CONFIG_GEN_ISR_TABLES 77 IDT_LIST(RW): org = 0x3ebfe010, len = 0x2000 78#endif 79} 80 81/* Default entry point: */ 82ENTRY(CONFIG_KERNEL_ENTRY) 83 84_rom_store_table = 0; 85 86_iram_dram_offset = IRAM_DRAM_OFFSET; 87 88/* Used as a pointer to the heap end */ 89_heap_sentry = DRAM_RESERVED_START; 90 91SECTIONS 92{ 93#ifdef CONFIG_BOOTLOADER_MCUBOOT 94 /* Reserve space for MCUboot header in the binary */ 95 .mcuboot_header : 96 { 97 QUAD(0x0) 98 QUAD(0x0) 99 QUAD(0x0) 100 QUAD(0x0) 101 } > mcuboot_hdr 102 .metadata : 103 { 104 /* 0. Magic byte for load header */ 105 LONG(0xace637d3) 106 107 /* 1. Application entry point address */ 108 KEEP(*(.entry_addr)) 109 110 /* IRAM metadata: 111 * 2. Destination address (VMA) for IRAM region 112 * 3. Flash offset (LMA) for start of IRAM region 113 * 4. Size of IRAM region 114 */ 115 LONG(ADDR(.iram0.text)) 116 LONG(LOADADDR(.iram0.text)) 117 LONG(LOADADDR(.iram0.data) - LOADADDR(.iram0.text)) 118 119 /* DRAM metadata: 120 * 5. Destination address (VMA) for DRAM region 121 * 6. Flash offset (LMA) for start of DRAM region 122 * 7. Size of DRAM region 123 */ 124 LONG(ADDR(.dram0.data)) 125 LONG(LOADADDR(.dram0.data)) 126 LONG(LOADADDR(.dram0.end) - LOADADDR(.dram0.data)) 127 } > metadata 128#endif /* CONFIG_BOOTLOADER_MCUBOOT */ 129 130 iram_vma = ADDR(.iram0.text); 131 iram_lma = LOADADDR(.iram0.text); 132 iram_size_field = LOADADDR(.iram0.data) - LOADADDR(.iram0.text); 133 134 dram_vma = ADDR(.dram0.data); 135 dram_lma = LOADADDR(.dram0.data); 136 dram_size_field = LOADADDR(.dram0.end) - LOADADDR(.dram0.data); 137 138 #include <zephyr/linker/rel-sections.ld> 139 140#ifdef CONFIG_LLEXT 141 #include <zephyr/linker/llext-sections.ld> 142#endif 143 144 /* --- START OF IRAM --- */ 145 146 .iram0.text : ALIGN(4) 147 { 148 /* Vectors go to IRAM */ 149 _iram_start = ABSOLUTE(.); 150 _init_start = ABSOLUTE(.); 151 152 KEEP(*(.exception_vectors.text)); 153 . = ALIGN(256); 154 155 _invalid_pc_placeholder = ABSOLUTE(.); 156 157 KEEP(*(.exception.entry*)); /* contains _isr_wrapper */ 158 *(.exception.other*) 159 . = ALIGN(4); 160 161 *(.entry.text) 162 *(.init.literal) 163 *(.init) 164 . = ALIGN(4); 165 166 _init_end = ABSOLUTE(.); 167 _iram_text_start = ABSOLUTE(.); 168 169 *(.iram1 .iram1.*) 170 *(.iram0.literal .iram.literal .iram.text.literal .iram0.text .iram.text) 171 *libzephyr.a:panic.*(.literal .text .literal.* .text.*) 172 *libzephyr.a:loader.*(.literal .text .literal.* .text.*) 173 *libzephyr.a:flash_init.*(.literal .text .literal.* .text.*) 174 *libzephyr.a:soc_flash_init.*(.literal .text .literal.* .text.*) 175 *libzephyr.a:console_init.*(.literal .text .literal.* .text.*) 176 *libzephyr.a:soc_init.*(.literal .text .literal.* .text.*) 177 *libzephyr.a:hw_init.*(.literal .text .literal.* .text.*) 178 *libarch__riscv__core.a:(.literal .text .literal.* .text.*) 179 *libsubsys__net__l2__ethernet.a:(.literal .text .literal.* .text.*) 180 *libsubsys__net__lib__config.a:(.literal .text .literal.* .text.*) 181 *libsubsys__net__ip.a:(.literal .text .literal.* .text.*) 182 *libsubsys__net.a:(.literal .text .literal.* .text.*) 183 *libkernel.a:(.literal .text .literal.* .text.*) 184 *libgcc.a:lib2funcs.*(.literal .text .literal.* .text.*) 185 *libdrivers__flash.a:flash_esp32.*(.literal .text .literal.* .text.*) 186 *libzephyr.a:log_noos.*(.literal .text .literal.* .text.*) 187 *libdrivers__timer.a:esp32c2_sys_timer.*(.literal .text .literal.* .text.*) 188 *libzephyr.a:log_core.*(.literal .text .literal.* .text.*) 189 *libzephyr.a:cbprintf_complete.*(.literal .text .literal.* .text.*) 190 *libzephyr.a:printk.*(.literal.printk .literal.vprintk .literal.char_out .text.printk .text.vprintk .text.char_out) 191 *libzephyr.a:log_msg.*(.literal .text .literal.* .text.*) 192 *libzephyr.a:log_list.*(.literal .text .literal.* .text.*) 193 *libdrivers__console.a:uart_console.*(.literal.console_out .text.console_out) 194 *libzephyr.a:log_output.*(.literal .text .literal.* .text.*) 195 *libzephyr.a:log_backend_uart.*(.literal .text .literal.* .text.*) 196 *libzephyr.a:rtc_*.*(.literal .text .literal.* .text.*) 197 *liblib__libc__newlib.a:string.*(.literal .text .literal.* .text.*) 198 *liblib__libc__minimal.a:string.*(.literal .text .literal.* .text.*) 199 *liblib__libc__picolib.a:string.*(.literal .text .literal.* .text.*) 200 *libzephyr.a:periph_ctrl.*(.literal .text .literal.* .text.*) 201 *libgcov.a:(.literal .text .literal.* .text.*) 202 *libphy.a:( .phyiram .phyiram.*) 203 *libc.a:*(.literal .text .literal.* .text.*) 204 205 /* [mapping:hal] */ 206 *libzephyr.a:mmu_hal.*(.literal .text .literal.* .text.*) 207 *libzephyr.a:spi_flash_hal_iram.*(.literal .literal.* .text .text.*) 208 *libzephyr.a:spi_flash_encrypt_hal_iram.*(.literal .text .literal.* .text.*) 209 *libzephyr.a:cache_hal.*(.literal .text .literal.* .text.*) 210 *libzephyr.a:ledc_hal_iram.*(.literal .text .literal.* .text.*) 211 *libzephyr.a:i2c_hal_iram.*(.literal .text .literal.* .text.*) 212 *libzephyr.a:wdt_hal_iram.*(.literal .text .literal.* .text.*) 213 *libzephyr.a:systimer_hal.*(.literal .text .literal.* .text.*) 214 *libzephyr.a:spi_flash_hal_gpspi.*(.literal .literal.* .text .text.*) 215 216 /* [mapping:soc] */ 217 *libzephyr.a:lldesc.*(.literal .literal.* .text .text.*) 218 219 /* [mapping:log] */ 220 *(.literal.esp_log_write .text.esp_log_write) 221 *(.literal.esp_log_timestamp .text.esp_log_timestamp) 222 *(.literal.esp_log_early_timestamp .text.esp_log_early_timestamp) 223 *(.literal.esp_log_impl_lock .text.esp_log_impl_lock) 224 *(.literal.esp_log_impl_lock_timeout .text.esp_log_impl_lock_timeout) 225 *(.literal.esp_log_impl_unlock .text.esp_log_impl_unlock) 226 227 /* [mapping:spi_flash] */ 228 *libzephyr.a:spi_flash_chip_boya.*(.literal .literal.* .text .text.*) 229 *libzephyr.a:spi_flash_chip_gd.*(.literal .literal.* .text .text.*) 230 *libzephyr.a:spi_flash_chip_generic.*(.literal .literal.* .text .text.*) 231 *libzephyr.a:spi_flash_chip_issi.*(.literal .literal.* .text .text.*) 232 *libzephyr.a:spi_flash_chip_mxic.*(.literal .literal.* .text .text.*) 233 *libzephyr.a:spi_flash_chip_mxic_opi.*(.literal .literal.* .text .text.*) 234 *libzephyr.a:spi_flash_chip_th.*(.literal .literal.* .text .text.*) 235 *libzephyr.a:spi_flash_chip_winbond.*(.literal .literal.* .text .text.*) 236 *libzephyr.a:memspi_host_driver.*(.literal .literal.* .text .text.*) 237 *libzephyr.a:flash_brownout_hook.*(.literal .literal.* .text .text.*) 238 *libzephyr.a:spi_flash_wrap.*(.literal .literal.* .text .text.*) 239 *libzephyr.a:spi_flash_hpm_enable.*(.literal .literal.* .text .text.*) 240 *libzephyr.a:spi_flash_oct_flash_init*(.literal .literal.* .text .text.*) 241 242 /* [mapping:esp_system] */ 243 *libzephyr.a:esp_err.*(.literal .literal.* .text .text.*) 244 *(.literal.esp_system_abort .text.esp_system_abort) 245 246 /* [mapping:esp_hw_support] */ 247 *(.literal.esp_cpu_stall .text.esp_cpu_stall) 248 *(.literal.esp_cpu_unstall .text.esp_cpu_unstall) 249 *(.literal.esp_cpu_reset .text.esp_cpu_reset) 250 *(.literal.esp_cpu_wait_for_intr .text.esp_cpu_wait_for_intr) 251 *(.literal.esp_cpu_compare_and_set .text.esp_cpu_compare_and_set) 252 *(.literal.esp_gpio_reserve_pins .text.esp_gpio_reserve_pins) 253 *(.literal.esp_gpio_is_pin_reserved .text.esp_gpio_is_pin_reserved) 254 *(.literal.rtc_vddsdio_get_config .text.rtc_vddsdio_get_config) 255 *(.literal.rtc_vddsdio_set_config .text.rtc_vddsdio_set_config) 256 *libzephyr.a:esp_memory_utils.*(.literal .literal.* .text .text.*) 257 *libzephyr.a:rtc_clk.*(.literal .literal.* .text .text.*) 258 *libzephyr.a:rtc_clk_init.*(.literal .literal.* .text .text.*) 259 *libzephyr.a:rtc_time.*(.literal .literal.* .text .text.*) 260 *libzephyr.a:rtc_sleep.*(.literal .literal.* .text .text.*) 261 *libzephyr.a:systimer.*(.literal .literal.* .text .text.*) 262 *libzephyr.a:mspi_timing_config.*(.literal .literal.* .text .text.*) 263 *libzephyr.a:mspi_timing_tuning.*(.literal .literal.* .text .text.*) 264 *(.literal.sar_periph_ctrl_power_enable .text.sar_periph_ctrl_power_enable) 265 266 /* [mapping:soc_pm] */ 267 *(.literal.GPIO_HOLD_MASK .text.GPIO_HOLD_MASK) 268 269 /* [mapping:esp_rom] */ 270 *libzephyr.a:esp_rom_spiflash.*(.literal .literal.* .text .text.*) 271 *libzephyr.a:esp_rom_systimer.*(.literal .literal.* .text .text.*) 272 *libzephyr.a:esp_rom_wdt.*(.literal .literal.* .text .text.*) 273 274 /* [mapping:esp_mm] */ 275 *libzephyr.a:esp_cache.*(.literal .literal.* .text .text.*) 276 *libzephyr.a:cache_utils.*(.literal .text .literal.* .text.*) 277 278 *libzephyr.a:bootloader_soc.*(.literal .text .literal.* .text.*) 279 *libzephyr.a:bootloader_random*.*(.literal.bootloader_random_disable .text.bootloader_random_disable) 280 *libzephyr.a:bootloader_random*.*(.literal.bootloader_random_enable .text.bootloader_random_enable) 281 282#if defined(CONFIG_ESP32_WIFI_IRAM_OPT) 283 *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) 284 *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) 285 *libcoexist.a:(.wifi_slp_iram .wifi_slp_iram.*) 286 287 /* [mapping:esp_wifi] */ 288 *(.literal.wifi_clock_enable_wrapper .text.wifi_clock_enable_wrapper) 289 *(.literal.wifi_clock_disable_wrapper .text.wifi_clock_disable_wrapper) 290 291 /* [mapping:esp_phy] */ 292 *(.literal.esp_phy_enable .text.esp_phy_enable) 293 *(.literal.esp_phy_disable .text.esp_phy_disable) 294 *(.literal.esp_wifi_bt_power_domain_off .text.esp_wifi_bt_power_domain_off) 295#endif /* CONFIG_ESP32_WIFI_IRAM_OPT */ 296 297#if defined(CONFIG_ESP32_WIFI_RX_IRAM_OPT) 298 *libnet80211.a:( .wifirxiram .wifirxiram.* .wifislprxiram .wifislprxiram.*) 299 *libpp.a:( .wifirxiram .wifirxiram.* .wifislprxiram .wifislprxiram.*) 300#endif /* CONFIG_ESP32_WIFI_RX_IRAM_OPT */ 301 302 . = ALIGN(4) + 16; 303 304 } GROUP_DATA_LINK_IN(IRAM_REGION, ROMABLE_REGION) 305 306#ifdef CONFIG_ESP_SIMPLE_BOOT 307 .loader.text : 308 { 309 . = ALIGN(4); 310 _loader_text_start = ABSOLUTE(.); 311 *libzephyr.a:bootloader_clock_init.*(.literal .text .literal.* .text.*) 312 *libzephyr.a:bootloader_wdt.*(.literal .text .literal.* .text.*) 313 *libzephyr.a:bootloader_flash.*(.literal .text .literal.* .text.*) 314 *libzephyr.a:bootloader_clock_loader.*(.literal .text .literal.* .text.*) 315 *libzephyr.a:bootloader_panic.*(.literal .text .literal.* .text.*) 316 *libzephyr.a:bootloader_random.*(.literal .text .literal.* .text.*) 317 *libzephyr.a:bootloader_efuse.*(.literal .text .literal.* .text.*) 318 *libzephyr.a:bootloader_utility.*(.literal .text .literal.* .text.*) 319 *libzephyr.a:bootloader_sha.*(.literal .text .literal.* .text.*) 320 321 *libzephyr.a:esp_image_format.*(.literal .text .literal.* .text.*) 322 *libzephyr.a:flash_ops.*(.literal .text .literal.* .text.*) 323 *libzephyr.a:flash_ops_esp32c2.*(.literal .text .literal.* .text.*) 324 *libzephyr.a:flash_encrypt.*(.literal .text .literal.* .text.*) 325 *libzephyr.a:flash_encryption_secure_features.*(.literal .text .literal.* .text.*) 326 *libzephyr.a:flash_partitions.*(.literal .text .literal.* .text.*) 327 *libzephyr.a:flash_qio_mode.*(.literal .text .literal.* .text.*) 328 *libzephyr.a:spi_flash_hal.*(.literal .literal.* .text .text.*) 329 *libzephyr.a:spi_flash_hal_common.*(.literal .literal.* .text .text.*) 330 *libzephyr.a:esp_flash_api.*(.literal .text .literal.* .text.*) 331 *libzephyr.a:esp_flash_spi_init.*(.literal .text .literal.* .text.*) 332 333 *libzephyr.a:esp_efuse_table.*(.literal .text .literal.* .text.*) 334 *libzephyr.a:esp_efuse_fields.*(.literal .text .literal.* .text.*) 335 *libzephyr.a:esp_efuse_api.*(.literal .text .literal.* .text.*) 336 *libzephyr.a:esp_efuse_utility.*(.literal .text .literal.* .text.*) 337 *libzephyr.a:esp_efuse_api_key_esp32xx.*(.literal .text .literal.* .text.*) 338 *libzephyr.a:secure_boot.*(.literal .text .literal.* .text.*) 339 *libzephyr.a:secure_boot_secure_features.*(.literal .text .literal.* .text.*) 340 *libzephyr.a:secure_boot_signatures_bootloader.*(.literal .text .literal.* .text.*) 341 342 *libzephyr.a:cpu_region_protect.*(.literal .text .literal.* .text.*) 343 344 /* ??? */ 345 *libzephyr.a:esp_gpio_reserve.*(.literal .text .literal.* .text.*) 346 347 . = ALIGN(0x10) + 0x10; 348 _loader_text_end = ABSOLUTE(.); 349 } GROUP_DATA_LINK_IN(IRAM_REGION, ROMABLE_REGION) 350#endif /* CONFIG_ESP_SIMPLE_BOOT */ 351 352 .iram0.text_end (NOLOAD) : 353 { 354 /* C2 memprot requires 512 B alignment for split lines */ 355 . = ALIGN (16); 356 _iram_text_end = ABSOLUTE(.); 357 } GROUP_LINK_IN(IRAM_REGION) 358 359 .iram0.data : 360 { 361 . = ALIGN(16); 362 *(.iram.data) 363 *(.iram.data*) 364 } GROUP_DATA_LINK_IN(IRAM_REGION, ROMABLE_REGION) 365 366 .iram0.bss (NOLOAD) : 367 { 368 . = ALIGN(16); 369 *(.iram.bss) 370 *(.iram.bss*) 371 372 . = ALIGN(16); 373 _iram_end = ABSOLUTE(.); 374 } GROUP_LINK_IN(IRAM_REGION) 375 376 /* --- END OF IRAM --- */ 377 378 /* --- START OF DRAM --- */ 379 380 .dram0.dummy (NOLOAD): 381 { 382 /* Spacer section is required to skip .iram0.text area because 383 * iram0_0_seg and dram0_0_seg reflect the same address space on different buses. 384 */ 385 . = ORIGIN(dram0_0_seg) + MAX(_iram_end, user_iram_seg_org) - user_iram_seg_org; 386 . = ALIGN(16) + 16; 387 } GROUP_LINK_IN(RAMABLE_REGION) 388 389 .dram0.data : 390 { 391 . = ALIGN(4); 392 _data_start = ABSOLUTE(.); 393 __data_start = ABSOLUTE(.); 394 395 *(.data) 396 *(.data.*) 397 *(.gnu.linkonce.d.*) 398 *(.data1) 399 400#ifdef CONFIG_RISCV_GP 401 . = ALIGN(8); 402 __global_pointer$ = . + 0x800; 403#endif /* CONFIG_RISCV_GP */ 404 405 *(.sdata) 406 *(.sdata.*) 407 *(.gnu.linkonce.s.*) 408 *(.sdata2) 409 *(.sdata2.*) 410 *(.gnu.linkonce.s2.*) 411 412 /* All dependent functions should be placed in DRAM to avoid issue 413 * when flash cache is disabled */ 414 *libkernel.a:fatal.*(.rodata .rodata.* .srodata .srodata.*) 415 *libkernel.a:init.*(.rodata .rodata.* .srodata .srodata.*) 416 *libzephyr.a:cbprintf_complete*(.rodata .rodata.* .srodata .srodata.*) 417 *libzephyr.a:log_core.*(.rodata .rodata.* .srodata .srodata.*) 418 *libzephyr.a:log_backend_uart.*(.rodata .rodata.* .srodata .srodata.*) 419 *libzephyr.a:log_output.*(.rodata .rodata.* .srodata .srodata.*) 420 *libdrivers__flash.a:flash_esp32.*(.rodata .rodata.* .srodata .srodata.*) 421 *libdrivers__serial.a:uart_esp32.*(.rodata .rodata.* .srodata .srodata.*) 422 *libzephyr.a:periph_ctrl.*(.rodata .rodata.* .srodata .srodata.*) 423 *libzephyr.a:loader.*(.rodata .rodata.* .srodata .srodata.*) 424 *libzephyr.a:flash_init.*(.rodata .rodata.*) 425 *libzephyr.a:soc_flash_init.*(.rodata .rodata.*) 426 *libzephyr.a:console_init.*(.rodata .rodata.*) 427 *libzephyr.a:soc_init.*(.rodata .rodata.*) 428 *libzephyr.a:hw_init.*(.rodata .rodata.*) 429 *libzephyr.a:cache_utils.*(.rodata .rodata.* .srodata .srodata.*) 430 431 /* [mapping:hal] */ 432 *libzephyr.a:mmu_hal.*(.rodata .rodata.* .srodata .srodata.*) 433 *libzephyr.a:spi_flash_hal_iram.*(.rodata .rodata.* .srodata .srodata.*) 434 *libzephyr.a:spi_flash_encrypt_hal_iram.*(.rodata .rodata.* .srodata .srodata.*) 435 *libzephyr.a:cache_hal.*(.rodata .rodata.* .srodata .srodata.*) 436 *libzephyr.a:ledc_hal_iram.*(.rodata .rodata.* .srodata .srodata.*) 437 *libzephyr.a:i2c_hal_iram.*(.rodata .rodata.* .srodata .srodata.*) 438 *libzephyr.a:wdt_hal_iram.*(.rodata .rodata.* .srodata .srodata.*) 439 *libzephyr.a:systimer_hal.*(.rodata .rodata.* .srodata .srodata.*) 440 *libzephyr.a:spi_flash_hal_gpspi.*(.rodata .rodata.* .srodata .srodata.*) 441 442 /* [mapping:soc] */ 443 *libzephyr.a:lldesc.*(.rodata .rodata.* .srodata .srodata.*) 444 445 /* [mapping:log] */ 446 *(.rodata.esp_log_write) 447 *(.rodata.esp_log_timestamp) 448 *(.rodata.esp_log_early_timestamp) 449 *(.rodata.esp_log_impl_lock) 450 *(.rodata.esp_log_impl_lock_timeout) 451 *(.rodata.esp_log_impl_unlock) 452 453 /* [mapping:spi_flash] */ 454 *libzephyr.a:spi_flash_chip_boya.*(.rodata .rodata.* .srodata .srodata.*) 455 *libzephyr.a:spi_flash_chip_gd.*(.rodata .rodata.* .srodata .srodata.*) 456 *libzephyr.a:spi_flash_chip_generic.*(.rodata .rodata.* .srodata .srodata.*) 457 *libzephyr.a:spi_flash_chip_issi.*(.rodata .rodata.* .srodata .srodata.*) 458 *libzephyr.a:spi_flash_chip_mxic.*(.rodata .rodata.* .srodata .srodata.*) 459 *libzephyr.a:spi_flash_chip_mxic_opi.*(.rodata .rodata.* .srodata .srodata.*) 460 *libzephyr.a:spi_flash_chip_th.*(.rodata .rodata.* .srodata .srodata.*) 461 *libzephyr.a:spi_flash_chip_winbond.*(.rodata .rodata.* .srodata .srodata.*) 462 *libzephyr.a:memspi_host_driver.*(.rodata .rodata.* .srodata .srodata.*) 463 *libzephyr.a:flash_brownout_hook.*(.rodata .rodata.* .srodata .srodata.*) 464 *libzephyr.a:spi_flash_wrap.*(.rodata .rodata.* .srodata .srodata.*) 465 *libzephyr.a:spi_flash_hpm_enable.*(.rodata .rodata.* .srodata .srodata.*) 466 *libzephyr.a:spi_flash_oct_flash_init.*(.rodata .rodata.* .srodata .srodata.*) 467 *libzephyr.a:flash_qio_mode.*(.rodata .rodata.* .srodata .srodata.*) 468 469 /* [mapping:esp_mm] */ 470 *libzephyr.a:esp_cache.*(.rodata .rodata.* .srodata .srodata.*) 471 472 /* [mapping:esp_hw_support] */ 473 *(.rodata.esp_cpu_stall) 474 *(.rodata.esp_cpu_unstall) 475 *(.rodata.esp_cpu_reset) 476 *(.rodata.esp_cpu_wait_for_intr) 477 *(.rodata.esp_cpu_compare_and_set) 478 *(.rodata.esp_gpio_reserve_pins) 479 *(.rodata.esp_gpio_is_pin_reserved) 480 *(.rodata.rtc_vddsdio_get_config) 481 *(.rodata.rtc_vddsdio_set_config) 482 *libzephyr.a:esp_memory_utils.*(.rodata .rodata.* .srodata .srodata.*) 483 *libzephyr.a:rtc_clk.*(.rodata .rodata.* .srodata .srodata.*) 484 *libzephyr.a:rtc_clk_init.*(.rodata .rodata.* .srodata .srodata.*) 485 *libzephyr.a:systimer.*(.rodata .rodata.* .srodata .srodata.*) 486 *libzephyr.a:mspi_timing_config.*(.rodata .rodata.* .srodata .srodata.*) 487 *libzephyr.a:mspi_timing_tuning.*(.rodata .rodata.* .srodata .srodata.*) 488 *(.rodata.sar_periph_ctrl_power_enable) 489 490 /* [mapping:esp_system] */ 491 *libzephyr.a:esp_err.*(.rodata .rodata.*) 492 *(.rodata.esp_system_abort) 493 494 . = ALIGN(4); 495 #include <snippets-rwdata.ld> 496 . = ALIGN(4); 497 498 KEEP(*(.jcr)) 499 *(.dram1 .dram1.*) 500 . = ALIGN(4); 501 } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) 502 503#ifdef CONFIG_ESP_SIMPLE_BOOT 504 /* Secondary loader sections */ 505 .loader.data : 506 { 507 . = ALIGN(4); 508 _loader_data_start = ABSOLUTE(.); 509 *libzephyr.a:bootloader_clock_init.*(.rodata .rodata.* .srodata .srodata.*) 510 *libzephyr.a:bootloader_wdt.*(.rodata .rodata.* .srodata .srodata.*) 511 *libzephyr.a:bootloader_flash.*(.srodata .srodata.* .rodata .rodata.*) 512 *libzephyr.a:bootloader_clock_loader.*(.rodata .rodata.* .srodata .srodata.*) 513 *libzephyr.a:bootloader_panic.*(.rodata .rodata.* .srodata .srodata.*) 514 515 *libzephyr.a:cpu_region_protect.*(.rodata .rodata.* .srodata .srodata.*) 516 *libzephyr.a:clk.*(.rodata .rodata.* .srodata .srodata.*) 517 *libzephyr.a:esp_clk.*(.rodata .rodata.* .srodata .srodata.*) 518 *libzephyr.a:flash_mmap.*(.rodata .rodata.* .srodata .srodata.*) 519 *libzephyr.a:flash_ops.*(.rodata .rodata.* .srodata .srodata.*) 520 *libzephyr.a:flash_ops_esp32c2.*(.rodata .rodata.* .srodata .srodata.*) 521 522 *libzephyr.a:esp_gpio_reserve.*(.rodata .rodata.* .srodata .srodata.*) 523 *libzephyr.a:spi_flash_hal.*(.rodata .rodata.* .srodata .srodata.*) 524 *libzephyr.a:spi_flash_hal_common.*(.rodata .rodata.* .srodata .srodata.*) 525 *libzephyr.a:esp_flash_api.*(.rodata .rodata.* .srodata .srodata.*) 526 *libzephyr.a:esp_flash_spi_init.*(.rodata .rodata.* .srodata .srodata.*) 527 528 . = ALIGN(16); 529 _loader_data_end = ABSOLUTE(.); 530 } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) 531#endif /* CONFIG_ESP_SIMPLE_BOOT */ 532 533 #include <snippets-data-sections.ld> 534 #include <zephyr/linker/common-ram.ld> 535 #include <snippets-ram-sections.ld> 536 #include <zephyr/linker/cplusplus-ram.ld> 537 538 /* logging sections should be placed in RAM area to avoid flash cache disabled issues */ 539 #pragma push_macro("GROUP_ROM_LINK_IN") 540 #undef GROUP_ROM_LINK_IN 541 #define GROUP_ROM_LINK_IN GROUP_DATA_LINK_IN 542 #include <zephyr/linker/common-rom/common-rom-logging.ld> 543 #pragma pop_macro("GROUP_ROM_LINK_IN") 544 545 .dram0.end : 546 { 547 . = ALIGN(4); 548 _data_end = ABSOLUTE(.); 549 __data_end = ABSOLUTE(.); 550 } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) 551 552 .dram0.noinit (NOLOAD): 553 { 554 . = ALIGN(4); 555 *(.noinit) 556 *(.noinit.*) 557 . = ALIGN(4); 558 } GROUP_LINK_IN(RAMABLE_REGION) 559 560 /* Shared RAM */ 561 .dram0.bss (NOLOAD) : 562 { 563 . = ALIGN (8); 564 __bss_start = ABSOLUTE(.); 565 _bss_start = ABSOLUTE(.); 566 567 *(.dynsbss) 568 *(.sbss) 569 *(.sbss.*) 570 *(.gnu.linkonce.sb.*) 571 *(.scommon) 572 *(.sbss2) 573 *(.sbss2.*) 574 *(.gnu.linkonce.sb2.*) 575 *(.dynbss) 576 *(.bss) 577 *(.bss.*) 578 *(.share.mem) 579 *(.gnu.linkonce.b.*) 580 *(COMMON) 581 . = ALIGN (16); 582 __bss_end = ABSOLUTE(.); 583 _bss_end = ABSOLUTE(.); 584 } GROUP_LINK_IN(RAMABLE_REGION) 585 586 /* Provide total SRAM usage, including IRAM and DRAM */ 587 _image_ram_start = _iram_start - IRAM_DRAM_OFFSET; 588 #include <zephyr/linker/ram-end.ld> 589 590 ASSERT(((_end - ORIGIN(dram0_0_seg)) <= LENGTH(dram0_0_seg)), "SRAM code/data does not fit.") 591 592 /* --- END OF DRAM --- */ 593 594 /* --- START OF .flash.text --- */ 595 596 .flash.text_dummy (NOLOAD): 597 { 598 . = ALIGN(CACHE_ALIGN); 599 } GROUP_LINK_IN(ROMABLE_REGION) 600 601 /* Symbols used during the application memory mapping */ 602 _image_irom_start = LOADADDR(.flash.text); 603 _image_irom_size = SIZEOF(.flash.text); 604 _image_irom_vaddr = ADDR(.flash.text); 605 606 .flash.text : ALIGN(CACHE_ALIGN) 607 { 608 _stext = .; 609 _instruction_reserved_start = ABSOLUTE(.); 610 _text_start = ABSOLUTE(.); 611 _instruction_reserved_start = ABSOLUTE(.); 612 __text_region_start = ABSOLUTE(.); 613 __rom_region_start = ABSOLUTE(.); 614 615#if !defined(CONFIG_ESP32_WIFI_IRAM_OPT) 616 *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) 617 *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) 618#endif /* CONFIG_ESP32_WIFI_IRAM_OPT */ 619 620#if !defined(CONFIG_ESP32_WIFI_RX_IRAM_OPT) 621 *libnet80211.a:( .wifirxiram .wifirxiram.* .wifislprxiram .wifislprxiram.*) 622 *libpp.a:( .wifirxiram .wifirxiram.* .wifislprxiram .wifislprxiram.*) 623#endif /* CONFIG_ESP32_WIFI_RX_IRAM_OPT */ 624 625 *(.literal .text .literal.* .text.*) 626 *(.stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*) 627 *(.irom0.text) /* catch stray ICACHE_RODATA_ATTR */ 628 629 *(.fini.literal) 630 *(.fini) 631 632 *(.gnu.version) 633 634 /* CPU will try to prefetch up to 16 bytes of 635 * of instructions. This means that any configuration (e.g. MMU, PMS) must allow 636 * safe access to up to 16 bytes after the last real instruction, add 637 * dummy bytes to ensure this 638 */ 639 . += 16; 640 641 _instruction_reserved_end = ABSOLUTE(.); 642 _text_end = ABSOLUTE(.); 643 _instruction_reserved_end = ABSOLUTE(.); 644 __text_region_end = ABSOLUTE(.); 645 __rom_region_end = ABSOLUTE(.); 646 _etext = .; 647 648 } GROUP_DATA_LINK_IN(FLASH_CODE_REGION, ROMABLE_REGION) 649 650 /* --- END OF .flash.text --- */ 651 652 /* --- START OF .rodata --- */ 653 654 /* Align next section to 64k to allow mapping */ 655 .flash.dummy (NOLOAD) : 656 { 657 . = ALIGN(CACHE_ALIGN); 658 } GROUP_LINK_IN(ROMABLE_REGION) 659 660 .flash.rodata_dummy (NOLOAD) : 661 { 662 /* Spacer in the IROM address to avoid interfering with the DROM address 663 * because DROM and IROM regions share the same address space */ 664 . += SIZEOF(.flash.text); 665 . = ALIGN(CACHE_ALIGN); 666 } GROUP_LINK_IN(RODATA_REGION) 667 668 /* Symbols used during the application memory mapping */ 669 _image_drom_start = LOADADDR(.flash.rodata); 670 _image_drom_size = _image_rodata_end - _image_rodata_start; 671 _image_drom_vaddr = ADDR(.flash.rodata); 672 673 .flash.rodata : ALIGN(0x10) 674 { 675 _rodata_reserved_start = ABSOLUTE(.); 676 _image_rodata_start = ABSOLUTE(.); 677 678 *(.rodata_desc .rodata_desc.*) 679 *(.rodata_custom_desc .rodata_custom_desc.*) 680 681 __rodata_region_start = ABSOLUTE(.); 682 683 . = ALIGN(4); 684 #include <snippets-rodata.ld> 685 686 *(.irom1.text) /* catch stray ICACHE_RODATA_ATTR */ 687 *(.gnu.linkonce.r.*) 688 *(.rodata1) 689 __XT_EXCEPTION_TABLE_ = ABSOLUTE(.); 690 *(.xt_except_table) 691 *(.gcc_except_table .gcc_except_table.*) 692 *(.gnu.linkonce.e.*) 693 *(.gnu.version_r) 694 . = (. + 3) & ~ 3; 695 __eh_frame = ABSOLUTE(.); 696 KEEP(*(.eh_frame)) 697 . = (. + 7) & ~ 3; 698 699 /* C++ exception handlers table: */ 700 __XT_EXCEPTION_DESCS_ = ABSOLUTE(.); 701 *(.xt_except_desc) 702 *(.gnu.linkonce.h.*) 703 __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.); 704 *(.xt_except_desc_end) 705 *(.dynamic) 706 *(.gnu.version_d) 707 __rodata_region_end = ABSOLUTE(.); 708 _rodata_end = ABSOLUTE(.); 709 /* Literals are also RO data. */ 710 _lit4_start = ABSOLUTE(.); 711 *(*.lit4) 712 *(.lit4.*) 713 *(.gnu.linkonce.lit4.*) 714 _lit4_end = ABSOLUTE(.); 715 . = ALIGN(4); 716 *(.srodata) 717 *(.srodata.*) 718 *(.rodata) 719 *(.rodata.*) 720 *(.rodata_wlog) 721 *(.rodata_wlog*) 722 . = ALIGN(4); 723 } GROUP_DATA_LINK_IN(RODATA_REGION, ROMABLE_REGION) 724 725 #include <zephyr/linker/cplusplus-rom.ld> 726 #include <zephyr/linker/common-rom/common-rom-init.ld> 727 #include <zephyr/linker/common-rom/common-rom-kernel-devices.ld> 728 #include <zephyr/linker/common-rom/common-rom-ztest.ld> 729 #include <zephyr/linker/common-rom/common-rom-net.ld> 730 #include <zephyr/linker/common-rom/common-rom-bt.ld> 731 #include <zephyr/linker/common-rom/common-rom-debug.ld> 732 #include <zephyr/linker/common-rom/common-rom-misc.ld> 733 #include <zephyr/linker/thread-local-storage.ld> 734 #include <snippets-sections.ld> 735 736 /* Create an explicit section at the end of all the data that shall be mapped into drom. 737 * This is used to calculate the size of the _image_drom_size variable */ 738 .flash.rodata_end : ALIGN(0x10) 739 { 740 . = ALIGN(4); 741 _rodata_reserved_end = ABSOLUTE(.); 742 _image_rodata_end = ABSOLUTE(.); 743 } GROUP_DATA_LINK_IN(RODATA_REGION, ROMABLE_REGION) 744 745 /* --- END OF .rodata --- */ 746 747#ifdef CONFIG_GEN_ISR_TABLES 748 #include <zephyr/linker/intlist.ld> 749#endif 750 751 #include <zephyr/linker/debug-sections.ld> 752 /DISCARD/ : { *(.note.GNU-stack) } 753 754 SECTION_PROLOGUE(.riscv.attributes, 0,) 755 { 756 KEEP(*(.riscv.attributes)) 757 KEEP(*(.gnu.attributes)) 758 } 759} 760