From c44d55c70cc996b915cccd7573ee82c21fe2edfd Mon Sep 17 00:00:00 2001 From: Gustavo Henrique Nihei Date: Wed, 15 Mar 2023 09:22:50 -0300 Subject: [PATCH] risc-v/espressif: Fix bootloader and app potential IRAM overlap Related to a recent fix from esp-idf: https://github.com/espressif/esp-idf/commit/0fb0be381763332007c269a558e5df9b23f69c18 Signed-off-by: Gustavo Henrique Nihei --- .../esp32c3/common/scripts/flat_memory.ld | 4 ++-- .../esp32c6/common/scripts/flat_memory.ld | 4 ++-- .../common/scripts/esp32c3_flat_memory.ld | 4 ++-- .../common/scripts/esp32c6_flat_memory.ld | 20 +++++++++---------- .../common/scripts/esp32h2_flat_memory.ld | 20 +++++++++---------- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/boards/risc-v/esp32c3/common/scripts/flat_memory.ld b/boards/risc-v/esp32c3/common/scripts/flat_memory.ld index 1c35a388c4..c0c7937457 100644 --- a/boards/risc-v/esp32c3/common/scripts/flat_memory.ld +++ b/boards/risc-v/esp32c3/common/scripts/flat_memory.ld @@ -43,12 +43,12 @@ /* 2nd stage bootloader iram_loader_seg start address */ -#define SRAM_DRAM_END 0x403d0000 - I_D_SRAM_OFFSET +#define SRAM_DRAM_END (0x403ce710 - I_D_SRAM_OFFSET) #define SRAM_IRAM_ORG (SRAM_IRAM_START + ICACHE_SIZE) #define SRAM_DRAM_ORG (SRAM_DRAM_START + ICACHE_SIZE) -#define I_D_SRAM_SIZE SRAM_DRAM_END - SRAM_DRAM_ORG +#define I_D_SRAM_SIZE (SRAM_DRAM_END - SRAM_DRAM_ORG) #ifdef CONFIG_ESP32C3_FLASH_2M # define FLASH_SIZE 0x200000 diff --git a/boards/risc-v/esp32c6/common/scripts/flat_memory.ld b/boards/risc-v/esp32c6/common/scripts/flat_memory.ld index ee17a5d500..30d4d139b1 100644 --- a/boards/risc-v/esp32c6/common/scripts/flat_memory.ld +++ b/boards/risc-v/esp32c6/common/scripts/flat_memory.ld @@ -36,12 +36,12 @@ /* 2nd stage bootloader iram_loader_seg start address */ -#define SRAM_DRAM_END 0x40880000 - I_D_SRAM_OFFSET +#define SRAM_DRAM_END (0x4086e610 - I_D_SRAM_OFFSET) #define SRAM_IRAM_ORG (SRAM_IRAM_START) #define SRAM_DRAM_ORG (SRAM_DRAM_START) -#define I_D_SRAM_SIZE SRAM_DRAM_END - SRAM_DRAM_ORG +#define I_D_SRAM_SIZE (SRAM_DRAM_END - SRAM_DRAM_ORG) /* IDRAM0_2_SEG_SIZE_DEFAULT is used when page size is 64KB */ diff --git a/boards/risc-v/espressif/common/scripts/esp32c3_flat_memory.ld b/boards/risc-v/espressif/common/scripts/esp32c3_flat_memory.ld index 68673670eb..843030c685 100644 --- a/boards/risc-v/espressif/common/scripts/esp32c3_flat_memory.ld +++ b/boards/risc-v/espressif/common/scripts/esp32c3_flat_memory.ld @@ -41,12 +41,12 @@ /* 2nd stage bootloader iram_loader_seg start address */ -#define SRAM_DRAM_END 0x403d0000 - I_D_SRAM_OFFSET +#define SRAM_DRAM_END (0x403ce710 - I_D_SRAM_OFFSET) #define SRAM_IRAM_ORG (SRAM_IRAM_START + ICACHE_SIZE) #define SRAM_DRAM_ORG (SRAM_DRAM_START + ICACHE_SIZE) -#define I_D_SRAM_SIZE SRAM_DRAM_END - SRAM_DRAM_ORG +#define I_D_SRAM_SIZE (SRAM_DRAM_END - SRAM_DRAM_ORG) MEMORY { diff --git a/boards/risc-v/espressif/common/scripts/esp32c6_flat_memory.ld b/boards/risc-v/espressif/common/scripts/esp32c6_flat_memory.ld index c35f39a1a9..1cfa0b3050 100644 --- a/boards/risc-v/espressif/common/scripts/esp32c6_flat_memory.ld +++ b/boards/risc-v/espressif/common/scripts/esp32c6_flat_memory.ld @@ -31,26 +31,26 @@ #include -#define SRAM_IRAM_START 0x40800000 -#define SRAM_DRAM_START 0x40800000 +#define SRAM_IRAM_START 0x40800000 +#define SRAM_DRAM_START 0x40800000 -#define I_D_SRAM_OFFSET (SRAM_IRAM_START - SRAM_DRAM_START) +#define I_D_SRAM_OFFSET (SRAM_IRAM_START - SRAM_DRAM_START) /* 2nd stage bootloader iram_loader_seg start address */ -#define SRAM_DRAM_END 0x40880000 - I_D_SRAM_OFFSET +#define SRAM_DRAM_END (0x4086e610 - I_D_SRAM_OFFSET) -#define SRAM_IRAM_ORG (SRAM_IRAM_START) -#define SRAM_DRAM_ORG (SRAM_DRAM_START) +#define SRAM_IRAM_ORG (SRAM_IRAM_START) +#define SRAM_DRAM_ORG (SRAM_DRAM_START) -#define I_D_SRAM_SIZE SRAM_DRAM_END - SRAM_DRAM_ORG +#define I_D_SRAM_SIZE (SRAM_DRAM_END - SRAM_DRAM_ORG) /* IDRAM0_2_SEG_SIZE_DEFAULT is used when page size is 64KB */ -#define CONFIG_MMU_PAGE_SIZE 0x10000 -#define IDRAM0_2_SEG_SIZE (CONFIG_MMU_PAGE_SIZE << 8) +#define CONFIG_MMU_PAGE_SIZE 0x10000 +#define IDRAM0_2_SEG_SIZE (CONFIG_MMU_PAGE_SIZE << 8) -#define DRAM0_0_SEG_LEN I_D_SRAM_SIZE +#define DRAM0_0_SEG_LEN I_D_SRAM_SIZE MEMORY { diff --git a/boards/risc-v/espressif/common/scripts/esp32h2_flat_memory.ld b/boards/risc-v/espressif/common/scripts/esp32h2_flat_memory.ld index 766605a5fa..38d9d81d07 100644 --- a/boards/risc-v/espressif/common/scripts/esp32h2_flat_memory.ld +++ b/boards/risc-v/espressif/common/scripts/esp32h2_flat_memory.ld @@ -31,26 +31,26 @@ #include -#define SRAM_IRAM_START 0x40800000 -#define SRAM_DRAM_START 0x40800000 +#define SRAM_IRAM_START 0x40800000 +#define SRAM_DRAM_START 0x40800000 -#define I_D_SRAM_OFFSET (SRAM_IRAM_START - SRAM_DRAM_START) +#define I_D_SRAM_OFFSET (SRAM_IRAM_START - SRAM_DRAM_START) /* 2nd stage bootloader iram_loader_seg start address */ -#define SRAM_DRAM_END 0x40850000 - I_D_SRAM_OFFSET +#define SRAM_DRAM_END (0x4083efd0 - I_D_SRAM_OFFSET) -#define SRAM_IRAM_ORG (SRAM_IRAM_START) -#define SRAM_DRAM_ORG (SRAM_DRAM_START) +#define SRAM_IRAM_ORG (SRAM_IRAM_START) +#define SRAM_DRAM_ORG (SRAM_DRAM_START) -#define I_D_SRAM_SIZE SRAM_DRAM_END - SRAM_DRAM_ORG +#define I_D_SRAM_SIZE (SRAM_DRAM_END - SRAM_DRAM_ORG) /* IDRAM0_2_SEG_SIZE_DEFAULT is used when page size is 64KB */ -#define CONFIG_MMU_PAGE_SIZE 0x10000 -#define IDRAM0_2_SEG_SIZE (CONFIG_MMU_PAGE_SIZE << 8) +#define CONFIG_MMU_PAGE_SIZE 0x10000 +#define IDRAM0_2_SEG_SIZE (CONFIG_MMU_PAGE_SIZE << 8) -#define DRAM0_0_SEG_LEN I_D_SRAM_SIZE +#define DRAM0_0_SEG_LEN I_D_SRAM_SIZE MEMORY {