Skip to content

Commit f65770c

Browse files
sylvioalvesnashif
authored andcommitted
soc: esp32xx: always use section prologue with alignment
ESP32 requires proper alignment between sections. There are some scenarios, as reported in #74533, that the section can get shifted, causing runtime failure. Making sure SECTION_PROLOGUE is used with ALIGN_WITH_INPUT will guarantee its consistency. Fixes #74533 Signed-off-by: Sylvio Alves <[email protected]>
1 parent 0cfd963 commit f65770c

File tree

5 files changed

+20
-0
lines changed

5 files changed

+20
-0
lines changed

soc/espressif/esp32/default.ld

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ user_dram_2_seg_len = SRAM1_USER_SIZE;
4747
#undef GROUP_ROM_LINK_IN
4848
#define GROUP_ROM_LINK_IN(vregion, lregion) > RODATA_REGION AT > lregion
4949

50+
/* Make sure new sections have consistent alignment between input and output sections */
51+
#undef SECTION_PROLOGUE
52+
#define SECTION_PROLOGUE SECTION_DATA_PROLOGUE
53+
5054
MEMORY
5155
{
5256
#ifdef CONFIG_BOOTLOADER_MCUBOOT

soc/espressif/esp32c3/default.ld

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ user_dram_seg_len = user_idram_size;
4141
#undef GROUP_ROM_LINK_IN
4242
#define GROUP_ROM_LINK_IN(vregion, lregion) > RODATA_REGION AT > lregion
4343

44+
/* Make sure new sections have consistent alignment between input and output sections */
45+
#undef SECTION_PROLOGUE
46+
#define SECTION_PROLOGUE SECTION_DATA_PROLOGUE
47+
4448
/* Global symbols required for espressif hal build */
4549
MEMORY
4650
{

soc/espressif/esp32c6/default.ld

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ user_sram_size = (user_sram_end - user_sram_org);
3434
#undef GROUP_ROM_LINK_IN
3535
#define GROUP_ROM_LINK_IN(vregion, lregion) > CACHED_REGION AT > lregion
3636

37+
/* Make sure new sections have consistent alignment between input and output sections */
38+
#undef SECTION_PROLOGUE
39+
#define SECTION_PROLOGUE SECTION_DATA_PROLOGUE
40+
3741
/* TODO: add RTC support */
3842
#define RESERVE_RTC_MEM 0
3943

soc/espressif/esp32s2/default.ld

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ user_dram_seg_len = user_idram_size;
4242
#undef GROUP_ROM_LINK_IN
4343
#define GROUP_ROM_LINK_IN(vregion, lregion) > RODATA_REGION AT > lregion
4444

45+
/* Make sure new sections have consistent alignment between input and output sections */
46+
#undef SECTION_PROLOGUE
47+
#define SECTION_PROLOGUE SECTION_DATA_PROLOGUE
48+
4549
#define RESERVE_RTC_MEM 0
4650

4751
MEMORY

soc/espressif/esp32s3/default.ld

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ user_dram_seg_len = user_idram_size;
4141
#undef GROUP_ROM_LINK_IN
4242
#define GROUP_ROM_LINK_IN(vregion, lregion) > RODATA_REGION AT > lregion
4343

44+
/* Make sure new sections have consistent alignment between input and output sections */
45+
#undef SECTION_PROLOGUE
46+
#define SECTION_PROLOGUE SECTION_DATA_PROLOGUE
47+
4448
MEMORY
4549
{
4650
#ifdef CONFIG_BOOTLOADER_MCUBOOT

0 commit comments

Comments
 (0)