mirror of
https://github.com/espressif/esp-idf.git
synced 2026-05-05 12:25:03 +02:00
espcoredump: fix issue with spi_flash access
spi_flash has been updated and its functions work from flash by default instead of IRAM that cause issue add Kconfig value into espcoredump to enable spi_flash legacy mode (CONFIG_SPI_FLASH_USE_LEGACY_IMPL) when core dump is selected fix spi_flash issues to work correctly with legacy mode when CONFIG_SPI_FLASH_USE_LEGACY_IMPL is used
This commit is contained in:
committed by
Angus Gratton
parent
fc62542e18
commit
7ff9538c48
@@ -776,6 +776,20 @@ menu "ESP32-specific"
|
||||
To prevent interrupting DPORT workarounds,
|
||||
need to disable interrupt with a maximum used level in the system.
|
||||
|
||||
config ESP32_PANIC_HANDLER_IRAM
|
||||
bool "Place panic handler code in IRAM"
|
||||
default n
|
||||
help
|
||||
If this option is disabled (default), the panic handler code is placed in flash not IRAM.
|
||||
This means that if ESP-IDF crashes while flash cache is disabled, the panic handler will
|
||||
automatically re-enable flash cache before running GDB Stub or Core Dump. This adds some minor
|
||||
risk, if the flash cache status is also corrupted during the crash.
|
||||
|
||||
If this option is enabled, the panic handler code is placed in IRAM. This allows the panic
|
||||
handler to run without needing to re-enable cache first. This may be necessary to debug some
|
||||
complex issues with crashes while flash cache is disabled (for example, when writing to
|
||||
SPI flash.)
|
||||
|
||||
endmenu # ESP32-Specific
|
||||
|
||||
menu "Power Management"
|
||||
|
||||
@@ -404,9 +404,11 @@ void start_cpu0_default(void)
|
||||
/* init default OS-aware flash access critical section */
|
||||
spi_flash_guard_set(&g_flash_guard_default_ops);
|
||||
|
||||
#ifndef CONFIG_SPI_FLASH_USE_LEGACY_IMPL
|
||||
esp_flash_app_init();
|
||||
esp_err_t flash_ret = esp_flash_init_default_chip();
|
||||
assert(flash_ret == ESP_OK);
|
||||
#endif
|
||||
|
||||
uint8_t revision = esp_efuse_get_chip_ver();
|
||||
ESP_LOGI(TAG, "Chip Revision: %d", revision);
|
||||
|
||||
@@ -608,6 +608,14 @@ static __attribute__((noreturn)) void commonErrorHandler(XtExcFrame *frame)
|
||||
reconfigureAllWdts();
|
||||
#endif
|
||||
|
||||
#if !CONFIG_ESP32_PANIC_HANDLER_IRAM
|
||||
// Re-enable CPU cache for current CPU if it was disabled
|
||||
if (!spi_flash_cache_enabled()) {
|
||||
spi_flash_enable_cache(core_id);
|
||||
panicPutStr("Re-enable cpu cache.\r\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_ESP32_PANIC_GDBSTUB
|
||||
disableAllWdts();
|
||||
rtc_wdt_disable();
|
||||
|
||||
Reference in New Issue
Block a user