From 733a5e5d026b8a2d6ad1dcd9d8d993127a4bcd41 Mon Sep 17 00:00:00 2001 From: wanglei Date: Fri, 22 May 2026 11:53:50 +0800 Subject: [PATCH] feat(esp_rom): do not patch Cache_WriteBack_All for uboot build --- .../esp_rom_cache_writeback_esp32c5_esp32c61_esp32h4.c | 2 ++ .../esp_rom/patches/esp_rom_cache_writeback_esp32p4.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/components/esp_rom/patches/esp_rom_cache_writeback_esp32c5_esp32c61_esp32h4.c b/components/esp_rom/patches/esp_rom_cache_writeback_esp32c5_esp32c61_esp32h4.c index 7c87535edb3..3c6051ae1c7 100644 --- a/components/esp_rom/patches/esp_rom_cache_writeback_esp32c5_esp32c61_esp32h4.c +++ b/components/esp_rom/patches/esp_rom_cache_writeback_esp32c5_esp32c61_esp32h4.c @@ -31,6 +31,7 @@ int Cache_WriteBack_Addr(uint32_t addr, uint32_t size) return 0; } +#ifndef BOOTLOADER_BUILD void Cache_WriteBack_All(void) { REG_WRITE(CACHE_SYNC_MAP_REG, CACHE_MAP_FLASH_CACHE); @@ -42,6 +43,7 @@ void Cache_WriteBack_All(void) REG_WRITE(CACHE_SYNC_CTRL_REG, CACHE_WRITEBACK_ENA); while (!REG_GET_BIT(CACHE_SYNC_CTRL_REG, CACHE_SYNC_DONE)); } +#endif int Cache_WriteBack_Invalidate_Addr(uint32_t addr, uint32_t size) { diff --git a/components/esp_rom/patches/esp_rom_cache_writeback_esp32p4.c b/components/esp_rom/patches/esp_rom_cache_writeback_esp32p4.c index 49c34adf597..f523d78bacd 100644 --- a/components/esp_rom/patches/esp_rom_cache_writeback_esp32p4.c +++ b/components/esp_rom/patches/esp_rom_cache_writeback_esp32p4.c @@ -49,6 +49,11 @@ int Cache_WriteBack_Addr(uint32_t map, uint32_t addr, uint32_t size) return 0; } +#ifndef BOOTLOADER_BUILD +/** + * ci build no test related case will check backtrace not call functions from .iram.text + * so for bootloader still use the rom function. The issue will not occur in uboot stage + */ int Cache_WriteBack_All(uint32_t map) { /* writeback readonly cache is invalid */ @@ -71,6 +76,7 @@ int Cache_WriteBack_All(uint32_t map) return 0; } +#endif int Cache_WriteBack_Invalidate_Addr(uint32_t map, uint32_t addr, uint32_t size) {