mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-16 23:05:38 +00:00
spi_flash: add config option to override flash size in bootloader header
Sometimes the flash size read from bootloader is not correct. This may forbid SPI Flash driver from reading the the area larger than the size in bootloader header. When the new config option is enabled, the latest configured ESPTOOLPY_FLAHSIZE in the app header will be used to override the value read from bootloader header.
This commit is contained in:
@@ -850,3 +850,21 @@ static esp_err_t verify_simple_hash(bootloader_sha256_handle_t sha_handle, esp_i
|
||||
bootloader_munmap(hash);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
int esp_image_get_flash_size(esp_image_flash_size_t app_flash_size)
|
||||
{
|
||||
switch (app_flash_size) {
|
||||
case ESP_IMAGE_FLASH_SIZE_1MB:
|
||||
return 1 * 1024 * 1024;
|
||||
case ESP_IMAGE_FLASH_SIZE_2MB:
|
||||
return 2 * 1024 * 1024;
|
||||
case ESP_IMAGE_FLASH_SIZE_4MB:
|
||||
return 4 * 1024 * 1024;
|
||||
case ESP_IMAGE_FLASH_SIZE_8MB:
|
||||
return 8 * 1024 * 1024;
|
||||
case ESP_IMAGE_FLASH_SIZE_16MB:
|
||||
return 16 * 1024 * 1024;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user