From c655870b22736e53982efdd4f8c8f8c919ed8320 Mon Sep 17 00:00:00 2001 From: Dong Heng Date: Tue, 17 Oct 2023 10:11:12 +0800 Subject: [PATCH] boards/esp32s3: Link stack checking function and data to SRAM when enable flash or PSRAM driver During PSRAM initialization and flash operations, the Cache needs to be disabled. So all data and code for the aforementioned scope is required to be placed in Internal RAM. --- .../xtensa/esp32s3/common/scripts/legacy_sections.ld | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/boards/xtensa/esp32s3/common/scripts/legacy_sections.ld b/boards/xtensa/esp32s3/common/scripts/legacy_sections.ld index a6690168bbc49..22ebcdbcd838d 100644 --- a/boards/xtensa/esp32s3/common/scripts/legacy_sections.ld +++ b/boards/xtensa/esp32s3/common/scripts/legacy_sections.ld @@ -131,6 +131,12 @@ SECTIONS #ifdef CONFIG_ESP32S3_SPIRAM_MODE_OCT *libarch.a:esp32s3_psram_octal.*(.literal .text .literal.* .text.*) #endif +#if defined(CONFIG_STACK_CANARIES) && \ + (defined(CONFIG_ESP32S3_SPIFLASH) || \ + defined(CONFIG_ESP32S3_SPIRAM)) + *libc.a:lib_stackchk.*(.literal .text .literal.* .text.*) +#endif + *(.wifirxiram .wifirxiram.*) *(.wifi0iram .wifi0iram.*) *(.wifiorslpiram .wifiorslpiram.*) @@ -214,6 +220,11 @@ SECTIONS *libphy.a:(.rodata .rodata.*) *libarch.a:xtensa_context.*(.rodata .rodata.*) +#if defined(CONFIG_STACK_CANARIES) && \ + (defined(CONFIG_ESP32S3_SPIFLASH) || \ + defined(CONFIG_ESP32S3_SPIRAM)) + *libc.a:lib_stackchk.*(.rodata .rodata.*) +#endif _edata = ABSOLUTE(.); . = ALIGN(4);