mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
fix(mspi): fixed possible boot failure in some builds when psram is enabled
A typical scenario is: when XIP on PSRAM enabled, compiler optimization level is Os. Under certain binary layout, boot hangs and backtrace points to `esp_sleep_config_gpio_isolate`. The root cause is that, during PSRAM initialization, it calls esp_gpio_reserve, which happens to place before the reported function. However, after call, there is no barrier before the clock adjustment in `mspi_timing_enter_low_speed_mode`. The clock gets changed when the cache is still fetching data, resulting in the corrupted data in the end of the cache line. This commits add spi_flash_disable_cache as a barrier to make sure the cache transactions is finished before the clock switch.
This commit is contained in:
committed by
Michael (XIAO Xufeng)
parent
00c8f05ebf
commit
ecab1fec19
@@ -81,6 +81,22 @@ bool spi_flash_cache_enabled(void);
|
||||
*/
|
||||
void spi_flash_enable_cache(uint32_t cpuid);
|
||||
|
||||
/**
|
||||
* @brief Suspend the Cache access to external memory, will disable branch predictor if supported.
|
||||
*
|
||||
* @param cpuid the core number to enable the cache for, meaning less on shared cache.
|
||||
* @param saved_state Cache status hold by hal (Used only on ROM impl. in idf, this param unused)
|
||||
*/
|
||||
void spi_flash_disable_cache(uint32_t cpuid, uint32_t *saved_state);
|
||||
|
||||
/**
|
||||
* @brief Resume the Cache access to external memory, will enable branch predictor if supported.
|
||||
*
|
||||
* @param cpuid the core number to enable the cache for, meaning less on shared cache.
|
||||
* @param saved_state Cache status hold by hal (Used only on ROM impl. in idf, this param unused)
|
||||
*/
|
||||
void spi_flash_restore_cache(uint32_t cpuid, uint32_t saved_state);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user