Skip to content

Commit 98d0a2b

Browse files
Marek Matejnashif
authored andcommitted
soc: espressif: esp32c6 split cached area
Split the cached area and assign both parts IROM and DROM meaning. This is necessary to overcome the esptool section merging issues. Signed-off-by: Marek Matej <[email protected]>
1 parent aeaf32a commit 98d0a2b

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

soc/espressif/esp32c6/default.ld

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ user_sram_org = HPSRAM_START;
2525
user_sram_size = (user_sram_end - user_sram_org);
2626

2727
/* Aliases */
28-
#define CACHED_REGION mmap0_0_seg
28+
#define FLASH_CODE_REGION irom0_0_seg
29+
#define RODATA_REGION drom0_0_seg
2930
#define RAMABLE_REGION sram0_0_seg
3031
#define ROMABLE_REGION FLASH
3132

@@ -38,7 +39,7 @@ user_sram_size = (user_sram_end - user_sram_org);
3839
/* Flash segments (rodata and text) should be mapped in the virtual address spaces.
3940
* Executing directly from LMA is not possible. */
4041
#undef GROUP_ROM_LINK_IN
41-
#define GROUP_ROM_LINK_IN(vregion, lregion) > CACHED_REGION AT > lregion
42+
#define GROUP_ROM_LINK_IN(vregion, lregion) > RODATA_REGION AT > lregion
4243

4344
/* Make sure new sections have consistent alignment between input and output sections */
4445
#undef SECTION_DATA_PROLOGUE
@@ -65,7 +66,8 @@ MEMORY
6566

6667
sram0_0_seg(RW): org = user_sram_org, len = user_sram_size
6768

68-
mmap0_0_seg (R): org = CACHED_ORG, len = CACHED_SIZE
69+
irom0_0_seg(RX): org = IROM_SEG_ORG, len = IROM_SEG_LEN
70+
drom0_0_seg(R): org = DROM_SEG_ORG, len = DROM_SEG_LEN
6971

7072
lp_ram_seg(RW): org = LPSRAM_IRAM_START,
7173
len = 0x2000 - RESERVE_RTC_MEM
@@ -770,7 +772,7 @@ SECTIONS
770772
__rom_region_end = ABSOLUTE(.);
771773
_etext = .;
772774

773-
} GROUP_DATA_LINK_IN(CACHED_REGION, ROMABLE_REGION)
775+
} GROUP_DATA_LINK_IN(FLASH_CODE_REGION, ROMABLE_REGION)
774776

775777
/* --- END OF .flash.text --- */
776778

@@ -782,12 +784,6 @@ SECTIONS
782784
. = ALIGN(CACHE_ALIGN);
783785
} GROUP_LINK_IN(ROMABLE_REGION)
784786

785-
.flash.align_rodata (NOLOAD) :
786-
{
787-
/* Subsequent segment lma and vma align */
788-
. = ALIGN(CACHE_ALIGN);
789-
} GROUP_LINK_IN(CACHED_REGION)
790-
791787
/* Symbols used during the application memory mapping */
792788
_image_drom_start = LOADADDR(.flash.rodata);
793789
_image_drom_size = _image_rodata_end - _image_rodata_start;
@@ -844,7 +840,7 @@ SECTIONS
844840
*(.rodata_wlog)
845841
*(.rodata_wlog*)
846842
. = ALIGN(4);
847-
} GROUP_DATA_LINK_IN(CACHED_REGION, ROMABLE_REGION)
843+
} GROUP_DATA_LINK_IN(RODATA_REGION, ROMABLE_REGION)
848844

849845
#include <zephyr/linker/cplusplus-rom.ld>
850846
#include <zephyr/linker/common-rom/common-rom-init.ld>
@@ -864,7 +860,7 @@ SECTIONS
864860
. = ALIGN(4);
865861
_rodata_reserved_end = ABSOLUTE(.);
866862
_image_rodata_end = ABSOLUTE(.);
867-
} GROUP_DATA_LINK_IN(CACHED_REGION, ROMABLE_REGION)
863+
} GROUP_DATA_LINK_IN(RODATA_REGION, ROMABLE_REGION)
868864

869865
/* --- END OF .rodata --- */
870866

soc/espressif/esp32c6/memory.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@
6060
#endif
6161

6262
/* Cached memory */
63-
#define CACHE_ALIGN CONFIG_MMU_PAGE_SIZE
64-
#define CACHED_ORG 0x42000000
65-
#define CACHED_SIZE FLASH_SIZE
63+
#define CACHE_ALIGN CONFIG_MMU_PAGE_SIZE
64+
#define IROM_SEG_ORG 0x42000000
65+
#define IROM_SEG_LEN FLASH_SIZE
66+
#define DROM_SEG_ORG 0x42800000
67+
#define DROM_SEG_LEN FLASH_SIZE

0 commit comments

Comments
 (0)