Skip to content

Commit

Permalink
Merge branch 'fix/reduce_rtc_text_size' into 'master'
Browse files Browse the repository at this point in the history
fix(system): linker script: free unused .rtc.text memory for esp32c3, esp32s2

See merge request espressif/esp-idf!33972
  • Loading branch information
Lapshin committed Dec 3, 2024
2 parents f297a9d + 3c5d24e commit bcd80c9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
10 changes: 7 additions & 3 deletions components/esp_system/ld/esp32c3/sections.ld.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,18 @@ SECTIONS
{
ALIGNED_SYMBOL(4, _rtc_fast_start)

HIDDEN(_rtc_code_start = .);

mapping[rtc_text]

*rtc_wake_stub*.*(.text .text.*)
*(.rtc_text_end_test)

/* Padding for possible CPU prefetch + alignment for PMS split lines */
. += _esp_memprot_prefetch_pad_size;
. = ALIGN(_esp_memprot_align_size);
HIDDEN(_rtc_code_end = .);

/* Padding for possible CPU prefetch + 4B alignment for PMS split lines. */
. = ((_rtc_code_end - _rtc_code_start) == 0) ?
ALIGN(0) : _esp_memprot_prefetch_pad_size + ALIGN(4);

_rtc_text_end = ABSOLUTE(.);
} > rtc_iram_seg
Expand Down
9 changes: 6 additions & 3 deletions components/esp_system/ld/esp32s2/sections.ld.in
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@ SECTIONS
{
ALIGNED_SYMBOL(4, _rtc_text_start)

HIDDEN(_rtc_code_start = .);

mapping[rtc_text]

*rtc_wake_stub*.*(.literal .text .literal.* .text.*)

/* Padding for possible CPU prefetch + alignment for PMS split lines */
. += _esp_memprot_prefetch_pad_size;
. = ALIGN(_esp_memprot_align_size);
HIDDEN(_rtc_code_end = .);

/* Possibly align + 16B for CPU dummy speculative instruction fetch. */
. = ((_rtc_code_end - _rtc_code_start) == 0) ? ALIGN(0) : ALIGN(4) + 16;

_rtc_text_end = ABSOLUTE(.);
} > rtc_iram_seg
Expand Down
10 changes: 7 additions & 3 deletions components/esp_system/ld/esp32s3/sections.ld.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,20 @@ SECTIONS
ALIGNED_SYMBOL(4, _rtc_fast_start)
ALIGNED_SYMBOL(4, _rtc_text_start)

HIDDEN(_rtc_code_start = .);

*(.rtc.entry.literal .rtc.entry.text)

mapping[rtc_text]

*rtc_wake_stub*.*(.literal .text .literal.* .text.*)
*(.rtc_text_end_test)

/* Padding for possible CPU prefetch + alignment for PMS split lines */
. += _esp_memprot_prefetch_pad_size;
. = ALIGN(_esp_memprot_align_size);
HIDDEN(_rtc_code_end = .);

/* Padding for possible CPU prefetch + 4B alignment for PMS split lines. */
. = ((_rtc_code_end - _rtc_code_start) == 0) ?
ALIGN(0) : _esp_memprot_prefetch_pad_size + ALIGN(4);

_rtc_text_end = ABSOLUTE(.);
} > rtc_iram_seg
Expand Down

0 comments on commit bcd80c9

Please sign in to comment.