diff --git a/components/bootloader_support/include/esp_flash_partitions.h b/components/bootloader_support/include/esp_flash_partitions.h index 98ab5b0f83..24b6f25d2d 100644 --- a/components/bootloader_support/include/esp_flash_partitions.h +++ b/components/bootloader_support/include/esp_flash_partitions.h @@ -17,11 +17,12 @@ #include "esp_err.h" #include "esp_flash_data_types.h" #include +#include "sdkconfig.h" /* Pre-partition table fixed flash offsets */ #define ESP_BOOTLOADER_DIGEST_OFFSET 0x0 #define ESP_BOOTLOADER_OFFSET 0x1000 /* Offset of bootloader image. Has matching value in bootloader KConfig.projbuild file. */ -#define ESP_PARTITION_TABLE_OFFSET CONFIG_PARTITION_TABLE_OFFSET /* Offset of partition table. */ +#define ESP_PARTITION_TABLE_OFFSET CONFIG_PARTITION_TABLE_OFFSET /* Offset of partition table. Backwards-compatible name.*/ #define ESP_PARTITION_TABLE_MAX_LEN 0xC00 /* Maximum length of partition table data */ #define ESP_PARTITION_TABLE_MAX_ENTRIES (ESP_PARTITION_TABLE_MAX_LEN / sizeof(esp_partition_info_t)) /* Maximum length of partition table data, including terminating entry */ diff --git a/components/spi_flash/sim/SpiFlash.cpp b/components/spi_flash/sim/SpiFlash.cpp index b8c795aff3..2c48ebbdd2 100644 --- a/components/spi_flash/sim/SpiFlash.cpp +++ b/components/spi_flash/sim/SpiFlash.cpp @@ -22,6 +22,7 @@ #include #include +#include "sdkconfig.h" #include "esp_flash_data_types.h" using namespace std; @@ -59,7 +60,7 @@ void SpiFlash::init(size_t chip_size, size_t block_size, size_t sector_size, siz ifd.read(buffer.data(), size); - memcpy(&this->memory[ESP_PARTITION_TABLE_ADDR], buffer.data(), buffer.size()); + memcpy(&this->memory[CONFIG_PARTITION_TABLE_OFFSET], buffer.data(), buffer.size()); } void SpiFlash::deinit() diff --git a/components/spi_flash/sim/sdkconfig.h b/components/spi_flash/sim/sdkconfig.h index 3f59c932d3..7d44e7f1ba 100644 --- a/components/spi_flash/sim/sdkconfig.h +++ b/components/spi_flash/sim/sdkconfig.h @@ -1,2 +1,3 @@ #pragma once +#define CONFIG_PARTITION_TABLE_OFFSET 0x8000