From bdf761329664ef09bdd33e659de7fa25f6970112 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 1 Dec 2025 10:46:43 +1100 Subject: [PATCH] esp32/mphalport: Enable D-cache flushing on P4 for native code. This is necessary to get native code running on the ESP32-P4. Signed-off-by: Damien George --- ports/esp32/esp32_common.cmake | 1 + ports/esp32/mphalport.h | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/ports/esp32/esp32_common.cmake b/ports/esp32/esp32_common.cmake index a52498a7fe..e3b1b81cae 100644 --- a/ports/esp32/esp32_common.cmake +++ b/ports/esp32/esp32_common.cmake @@ -166,6 +166,7 @@ list(APPEND IDF_COMPONENTS driver esp_adc esp_app_format + esp_mm esp_common esp_driver_touch_sens esp_eth diff --git a/ports/esp32/mphalport.h b/ports/esp32/mphalport.h index d779b6e66c..a2b11520a5 100644 --- a/ports/esp32/mphalport.h +++ b/ports/esp32/mphalport.h @@ -36,6 +36,7 @@ #include "freertos/task.h" #include "driver/spi_master.h" +#include "esp_cache.h" #include "soc/gpio_reg.h" #define MICROPY_PLATFORM_VERSION "IDF" IDF_VER @@ -51,6 +52,11 @@ #define MP_TASK_COREID (1) #endif +#if CONFIG_IDF_TARGET_ESP32P4 +#define MP_HAL_CLEAN_DCACHE(data, len) \ + esp_cache_msync((void *)(data), (len), ESP_CACHE_MSYNC_FLAG_UNALIGNED | ESP_CACHE_MSYNC_FLAG_DIR_C2M) +#endif + extern TaskHandle_t mp_main_task_handle; extern ringbuf_t stdin_ringbuf;