From 548e8b717d0aa1e78dde26102c0a4a4c8b960384 Mon Sep 17 00:00:00 2001 From: Marek Matej Date: Mon, 29 May 2023 19:29:47 +0200 Subject: [PATCH] soc: esp32: Fix linker scripts Updated the flash segment alignment on S3, so that mapping corresponds with the linkage. Fixed hard-coded flash size for ESP32. Signed-off-by: Marek Matej --- soc/xtensa/esp32/default.ld | 10 +++++----- soc/xtensa/esp32s3/default.ld | 8 ++------ 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/soc/xtensa/esp32/default.ld b/soc/xtensa/esp32/default.ld index 3dbd0819597..beb79d027d1 100644 --- a/soc/xtensa/esp32/default.ld +++ b/soc/xtensa/esp32/default.ld @@ -30,19 +30,19 @@ #define ROMABLE_REGION ROM #ifdef CONFIG_FLASH_SIZE -#define ROM_SIZE CONFIG_FLASH_SIZE +#define FLASH_SIZE CONFIG_FLASH_SIZE #else -#define ROM_SIZE 0x400000 +#define FLASH_SIZE 0x400000 #endif #ifdef CONFIG_BOOTLOADER_ESP_IDF #define IROM_SEG_ORG 0x400D0020 -#define IROM_SEG_LEN 0x330000-0x20 +#define IROM_SEG_LEN FLASH_SIZE-0x20 #define IROM_SEG_ALIGN 0x4 #define IRAM_SEG_LEN 0x20000 #else #define IROM_SEG_ORG 0x400D0000 -#define IROM_SEG_LEN 0x330000 +#define IROM_SEG_LEN FLASH_SIZE #define IROM_SEG_ALIGN 0x10000 #define IRAM_SEG_LEN 0x13000 #endif @@ -51,7 +51,7 @@ MEMORY { mcuboot_hdr (RX): org = 0x0, len = 0x20 metadata (RX): org = 0x20, len = 0x20 - ROM (RX): org = 0x40, len = ROM_SIZE - 0x40 + ROM (RX): org = 0x40, len = FLASH_SIZE - 0x40 #ifdef CONFIG_ESP32_NETWORK_CORE iram0_0_seg(RX): org = 0x40080000, len = 0x08000 diff --git a/soc/xtensa/esp32s3/default.ld b/soc/xtensa/esp32s3/default.ld index d4996cef2a5..4361e7b38e3 100644 --- a/soc/xtensa/esp32s3/default.ld +++ b/soc/xtensa/esp32s3/default.ld @@ -46,19 +46,15 @@ #endif #ifdef CONFIG_BOOTLOADER_ESP_IDF - #define IROM_SEG_ORG 0x42000020 #define IROM_SEG_LEN FLASH_SIZE-0x20 -#define IROM_SEG_ALIGN 0x4 - #else - #define IROM_SEG_ORG 0x42000000 #define IROM_SEG_LEN FLASH_SIZE -#define IROM_SEG_ALIGN 0x10000 - #endif +#define IROM_SEG_ALIGN 0x10000 + MEMORY { mcuboot_hdr (RX): org = 0x0, len = 0x20