88#include < zephyr/linker/linker-defs.h>
99#include < zephyr/linker/linker-tool.h>
1010
11+ #if !defined(CONFIG_BOOTLOADER_MCUBOOT)
12+ #error "APPCPU image must use MCUboot image format."
13+ #endif /* CONFIG_BOOTLOADER_MCUBOOT */
14+
1115#include " memory.h"
1216
1317/* User available SRAM memory segments */
@@ -47,15 +51,9 @@ appcpu_dram_len = APPCPU_SRAM_SIZE;
4751
4852MEMORY
4953{
50- #ifdef CONFIG_BOOTLOADER_MCUBOOT
5154 mcuboot_hdr (R) : org = 0x0 , len = 0x20
5255 metadata (R) : org = 0x20 , len = 0x20
5356 FLASH (R) : org = 0x40 , len = FLASH_SIZE - 0x40
54- #else
55- /* Make safety margin in the FLASH memory size so the
56- * (esp_img_header + (n*esp_seg_headers)) would fit */
57- FLASH (R) : org = 0x0 , len = FLASH_SIZE - 0x100
58- #endif /* CONFIG_BOOTLOADER_MCUBOOT */
5957
6058 iram0_1_seg (RX) : org = appcpu_iram_org, len = appcpu_iram_len
6159 dram0_1_seg (RW) : org = appcpu_dram_org, len = appcpu_dram_len
@@ -73,7 +71,6 @@ _heap_sentry = DRAM_RESERVED_START;
7371
7472SECTIONS
7573{
76- #if defined(CONFIG_BOOTLOADER_MCUBOOT)
7774 /* Reserve space for MCUboot header in the binary */
7875 .mcuboot_header :
7976 {
@@ -109,20 +106,18 @@ SECTIONS
109106 LONG (LOADADDR (.dram0 .data ))
110107 LONG (_data_end - _data_start)
111108 } > metadata
112- #endif /* CONFIG_BOOTLOADER_MCUBOOT */
113109
114110 #include < zephyr/linker/rel-sections.ld>
115111
116- #ifdef CONFIG_LLEXT
112+ #ifdef CONFIG_LLEXT
117113 #include < zephyr/linker/llext-sections.ld>
118- #endif
114+ #endif
119115
120116 /* --- START OF IRAM --- */
121117
122118 /* Send .iram0 code to iram */
123119 .iram0.vectors : ALIGN (4 )
124120 {
125- _iram_start = ABSOLUTE (.);
126121 /* Vectors go to IRAM */
127122 _init_start = ABSOLUTE (.);
128123 /* Vectors according to builds/RF-2015.2-win32/esp108_v1_2_s5_512int_2/config.html */
@@ -156,10 +151,9 @@ SECTIONS
156151 *(.entry .text )
157152 *(.init .literal )
158153 *(.init )
159- . = ALIGN (16 );
160-
161154 _init_end = ABSOLUTE (.);
162155
156+ _iram_start = ABSOLUTE (.);
163157 } GROUP_DATA_LINK_IN (IRAM_REGION, ROMABLE_REGION)
164158
165159 .iram0.text : ALIGN (4 )
@@ -290,7 +284,6 @@ SECTIONS
290284 #include < zephyr/linker/kobject-data.ld>
291285 #include < zephyr/linker/common-rom/common-rom-logging.ld>
292286
293- /* SECTION_PROLOGUE(_RODATA_SECTION_NAME,,) */
294287 .dram0.rodata : ALIGN (4 )
295288 {
296289 _rodata_start = ABSOLUTE (.);
@@ -304,26 +297,26 @@ SECTIONS
304297
305298 . = ALIGN (4 );
306299 *(EXCLUDE_FILE (
307- *libarch__xtensa__core.a :*
308- *libkernel.a :fatal.*
309- *libkernel.a :init.*
310- *libzephyr.a :cbprintf_complete*
311- *libzephyr.a :log_core.*
312- *libzephyr.a :log_backend_uart.*
313- *libzephyr.a :log_output.*
314- *libzephyr.a :loader.*
315- *libdrivers__serial.a :uart_esp32.*) .rodata )
300+ *libarch__xtensa__core.a :*
301+ *libkernel.a :fatal.*
302+ *libkernel.a :init.*
303+ *libzephyr.a :cbprintf_complete*
304+ *libzephyr.a :log_core.*
305+ *libzephyr.a :log_backend_uart.*
306+ *libzephyr.a :log_output.*
307+ *libzephyr.a :loader.*
308+ *libdrivers__serial.a :uart_esp32.*) .rodata )
316309
317310 *(EXCLUDE_FILE (
318- *libarch__xtensa__core.a :*
319- *libkernel.a :fatal.*
320- *libkernel.a :init.*
321- *libzephyr.a :cbprintf_complete*
322- *libzephyr.a :log_core.*
323- *libzephyr.a :log_backend_uart.*
324- *libzephyr.a :log_output.*
325- *libzephyr.a :loader.*
326- *libdrivers__serial.a :uart_esp32.*) .rodata .*)
311+ *libarch__xtensa__core.a :*
312+ *libkernel.a :fatal.*
313+ *libkernel.a :init.*
314+ *libzephyr.a :cbprintf_complete*
315+ *libzephyr.a :log_core.*
316+ *libzephyr.a :log_backend_uart.*
317+ *libzephyr.a :log_output.*
318+ *libzephyr.a :loader.*
319+ *libdrivers__serial.a :uart_esp32.*) .rodata .*)
327320
328321 . = ALIGN (4 );
329322
@@ -371,10 +364,6 @@ SECTIONS
371364
372365 /* Flash segments (rodata and text) should be mapped in virtual address space by providing VMA.
373366 * Executing directly from LMA is not possible. */
374- #pragma push_macro("GROUP_ROM_LINK_IN")
375- #undef GROUP_ROM_LINK_IN
376- #define GROUP_ROM_LINK_IN (vregion, lregion ) > RAMABLE_REGION AT > lregion
377-
378367 #include < zephyr/linker/cplusplus-rom.ld>
379368 #include < zephyr/linker/common-rom/common-rom-init.ld>
380369 #include < zephyr/linker/common-rom/common-rom-kernel-devices.ld>
@@ -386,18 +375,14 @@ SECTIONS
386375 #include < zephyr/linker/thread-local-storage.ld>
387376 #include < snippets-sections.ld>
388377
389- #pragma pop_macro("GROUP_ROM_LINK_IN")
390-
391378 /* Create an explicit section at the end of all the data that shall be mapped into drom.
392379 * This is used to calculate the size of the _image_drom_size variable */
393- /* SECTION_PROLOGUE(_RODATA_SECTION_END,,) */
394- .dram0.rodata_end : ALIGN (0x10 )
380+ .dram0.rodata_end : ALIGN (16 )
395381 {
396382 . = ALIGN (16 );
397383 _image_rodata_end = ABSOLUTE (.);
398384 } GROUP_DATA_LINK_IN (RAMABLE_REGION, ROMABLE_REGION)
399385
400-
401386 .dram0.end :
402387 {
403388 __data_end = ABSOLUTE (.);
@@ -438,19 +423,13 @@ SECTIONS
438423 } GROUP_LINK_IN (RAMABLE_REGION)
439424
440425 /* Provide total SRAM usage, including IRAM and DRAM */
441- _image_ram_start = _iram_start - IRAM_DRAM_OFFSET;
426+ _image_ram_start = _init_start - IRAM_DRAM_OFFSET;
442427 #include < zephyr/linker/ram-end.ld>
443428
444429 ASSERT (((__bss_end - ORIGIN (dram0_1_seg)) <= LENGTH (dram0_1_seg)), " DRAM segment data does not fit." )
445430
446431 /* --- END OF DRAM --- */
447432
448- /* --- START OF IROM --- */
449- /* --- END OF IROM --- */
450-
451- /* --- START OF DROM --- */
452- /* --- END OF DROM --- */
453-
454433#ifdef CONFIG_GEN_ISR_TABLES
455434#include < zephyr/linker/intlist.ld>
456435#endif
0 commit comments