mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-02 12:14:32 +02:00
spi_flash: Simplify init-time size check
This commit is contained in:
@@ -261,13 +261,13 @@ esp_err_t esp_flash_init_default_chip(void)
|
|||||||
if (default_chip.size < legacy_chip->chip_size) {
|
if (default_chip.size < legacy_chip->chip_size) {
|
||||||
ESP_EARLY_LOGE(TAG, "Detected size(%dk) smaller than the size in the binary image header(%dk). Probe failed.", default_chip.size/1024, legacy_chip->chip_size/1024);
|
ESP_EARLY_LOGE(TAG, "Detected size(%dk) smaller than the size in the binary image header(%dk). Probe failed.", default_chip.size/1024, legacy_chip->chip_size/1024);
|
||||||
return ESP_ERR_FLASH_SIZE_NOT_MATCH;
|
return ESP_ERR_FLASH_SIZE_NOT_MATCH;
|
||||||
} else if (default_chip.size > legacy_chip->chip_size) {
|
|
||||||
ESP_EARLY_LOGW(TAG, "Detected size(%dk) larger than the size in the binary image header(%dk). Using the size in the binary image header.", default_chip.size/1024, legacy_chip->chip_size/1024);
|
|
||||||
default_chip.size = legacy_chip->chip_size;
|
|
||||||
} else {
|
|
||||||
default_chip.size = legacy_chip->chip_size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (default_chip.size > legacy_chip->chip_size) {
|
||||||
|
ESP_EARLY_LOGW(TAG, "Detected size(%dk) larger than the size in the binary image header(%dk). Using the size in the binary image header.", default_chip.size/1024, legacy_chip->chip_size/1024);
|
||||||
|
}
|
||||||
|
default_chip.size = legacy_chip->chip_size;
|
||||||
|
|
||||||
esp_flash_default_chip = &default_chip;
|
esp_flash_default_chip = &default_chip;
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user