From 8c8f8836e5f5a2cff2abf104f7678cc83ca72128 Mon Sep 17 00:00:00 2001 From: Armando Date: Wed, 11 Dec 2024 16:26:59 +0800 Subject: [PATCH] fix(spi_flash): fixed no_os flash API not consider branch predictor on c5/c61 --- components/spi_flash/spi_flash_os_func_noos.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/components/spi_flash/spi_flash_os_func_noos.c b/components/spi_flash/spi_flash_os_func_noos.c index 6843269e15..a2f83f47cc 100644 --- a/components/spi_flash/spi_flash_os_func_noos.c +++ b/components/spi_flash/spi_flash_os_func_noos.c @@ -9,6 +9,7 @@ #include "esp_flash.h" #include "esp_attr.h" #include "esp_rom_sys.h" +#include "esp_cpu.h" #include "rom/cache.h" #include "hal/cache_hal.h" #include "hal/cache_ll.h" @@ -16,6 +17,11 @@ static IRAM_ATTR esp_err_t start(void *arg) { +#if SOC_BRANCH_PREDICTOR_SUPPORTED + //branch predictor will start cache request as well + esp_cpu_branch_prediction_disable(); +#endif + #if CONFIG_IDF_TARGET_ESP32 Cache_Read_Disable(0); Cache_Read_Disable(1); @@ -35,6 +41,10 @@ static IRAM_ATTR esp_err_t end(void *arg) cache_hal_resume(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_ALL); #endif +#if SOC_BRANCH_PREDICTOR_SUPPORTED + esp_cpu_branch_prediction_enable(); +#endif + return ESP_OK; }