mirror of
https://github.com/espressif/esp-idf.git
synced 2025-11-23 03:39:33 +00:00
esp_flash: fix coredump for legacy spi flash API
When legacy mode is used, the coredump still fails during linking because "esp_flash_init_default_chip", "esp_flash_app_init" and "esp_flash_default_chip " are not compiled and linked. Instead of using ``if`` macros in callers, these functions are protected by ``if`` macros in the header, and also not compiled in the sources. "esp_flash_default_chip" variable is compiled with safe default value.
This commit is contained in:
@@ -294,14 +294,15 @@ esp_err_t IRAM_ATTR esp_flash_erase_region(esp_flash_t *chip, uint32_t start, ui
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
esp_err_t err = spiflash_start(chip);
|
||||
if (err != ESP_OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
esp_err_t err = ESP_OK;
|
||||
// Check for write protected regions overlapping the erase region
|
||||
if (chip->chip_drv->get_protected_regions != NULL &&
|
||||
chip->chip_drv->num_protectable_regions > 0) {
|
||||
|
||||
err = spiflash_start(chip);
|
||||
if (err != ESP_OK) {
|
||||
return err;
|
||||
}
|
||||
uint64_t protected = 0;
|
||||
err = chip->chip_drv->get_protected_regions(chip, &protected);
|
||||
if (err == ESP_OK && protected != 0) {
|
||||
@@ -313,10 +314,10 @@ esp_err_t IRAM_ATTR esp_flash_erase_region(esp_flash_t *chip, uint32_t start, ui
|
||||
}
|
||||
}
|
||||
}
|
||||
// Don't lock the SPI flash for the entire erase, as this may be very long
|
||||
err = spiflash_end(chip, err);
|
||||
}
|
||||
|
||||
// Don't lock the SPI flash for the entire erase, as this may be very long
|
||||
err = spiflash_end(chip, err);
|
||||
|
||||
while (err == ESP_OK && len >= sector_size) {
|
||||
err = spiflash_start(chip);
|
||||
|
||||
Reference in New Issue
Block a user