esp_hw_support: allow writing in IRAM when CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT is not set for esp32C2

when CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT is not set, the PMP rule for esp32c2 shoud allow write access.
Fix esp_cpu_configure_region_protection() in cpu.c accordingly.
This commit is contained in:
Guillaume Souchere 2022-12-28 10:25:42 +01:00
parent 327bf0d608
commit 249fde21e5
5 changed files with 11 additions and 0 deletions

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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