diff --git a/components/esp_hw_support/cpu.c b/components/esp_hw_support/cpu.c index fb67935002..ee4c722cd2 100644 --- a/components/esp_hw_support/cpu.c +++ b/components/esp_hw_support/cpu.c @@ -395,11 +395,13 @@ extern int _data_start; #define CONDITIONAL_NONE 0x0 #define CONDITIONAL_RX PMP_R | PMP_X #define CONDITIONAL_RW PMP_R | PMP_W +#define CONDITIONAL_RWX PMP_R | PMP_W | PMP_X #else // With L bit set #define CONDITIONAL_NONE NONE #define CONDITIONAL_RX RX #define CONDITIONAL_RW RW +#define CONDITIONAL_RWX RWX #endif void esp_cpu_configure_region_protection(void) @@ -466,7 +468,12 @@ void esp_cpu_configure_region_protection(void) } else { // 1. IRAM PMP_ENTRY_SET(0, SOC_DIRAM_IRAM_LOW, CONDITIONAL_NONE); + +#if CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT PMP_ENTRY_SET(1, IRAM_END, PMP_TOR | CONDITIONAL_RX); +#else + PMP_ENTRY_SET(1, IRAM_END, PMP_TOR | CONDITIONAL_RWX); +#endif // 2. DRAM PMP_ENTRY_SET(2, DRAM_START, CONDITIONAL_NONE); diff --git a/tools/unit-test-app/configs/default_3_c2 b/tools/unit-test-app/configs/default_3_c2 index af8e5fbf11..b978fc45ac 100644 --- a/tools/unit-test-app/configs/default_3_c2 +++ b/tools/unit-test-app/configs/default_3_c2 @@ -1,3 +1,4 @@ # This config is split between targets since different component needs to be included CONFIG_IDF_TARGET="esp32c2" TEST_EXCLUDE_COMPONENTS=app_trace bootloader_support console efuse esp_common esp_eth esp_event esp_hid esp_http_client esp_http_server esp_netif esp_phy esp_ringbuf esp_rom esp_wifi espcoredump hal lwip mbedtls mdns mqtt newlib nvs_flash partition_table protocomm sdmmc spiffs freertos esp_hw_support esp_ipc esp_system esp_timer driver heap pthread soc spi_flash vfs +CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT=n # for c2 this config must be disabled for certain tests diff --git a/tools/unit-test-app/configs/default_c2 b/tools/unit-test-app/configs/default_c2 index d99387e17e..5bdd529e6a 100644 --- a/tools/unit-test-app/configs/default_c2 +++ b/tools/unit-test-app/configs/default_c2 @@ -1,3 +1,4 @@ # This config is split between targets since different component needs to be included CONFIG_IDF_TARGET="esp32c2" TEST_COMPONENTS=freertos esp_hw_support esp_ipc esp_system esp_timer driver heap pthread soc spi_flash vfs +CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT=n # for c2 this config must be disabled for certain tests diff --git a/tools/unit-test-app/configs/heap_light_poison_c2 b/tools/unit-test-app/configs/heap_light_poison_c2 index 1c165b4765..4b95d36384 100644 --- a/tools/unit-test-app/configs/heap_light_poison_c2 +++ b/tools/unit-test-app/configs/heap_light_poison_c2 @@ -2,3 +2,4 @@ CONFIG_IDF_TARGET="esp32c2" TEST_COMPONENTS=heap CONFIG_HEAP_POISONING_COMPREHENSIVE=n CONFIG_HEAP_POISONING_LIGHT=y +CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT=n # for c2 this config must be disabled for certain tests diff --git a/tools/unit-test-app/configs/release_c2 b/tools/unit-test-app/configs/release_c2 index 820ad4f26e..5348110bb5 100644 --- a/tools/unit-test-app/configs/release_c2 +++ b/tools/unit-test-app/configs/release_c2 @@ -3,3 +3,4 @@ TEST_COMPONENTS=freertos esp_hw_support esp_system esp_ipc esp_timer driver heap CONFIG_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y +CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT=n # for c2 this config must be disabled for certain tests