System/Security: Memprot API unified (ESP32C3)

Unified Memory protection API for all PMS-aware chips (ESP32C3)

Closes JIRA IDF-3849
This commit is contained in:
Martin Vychodil
2021-09-06 10:22:40 +02:00
parent 7c7fbb1fd0
commit dd938eb952
41 changed files with 3443 additions and 3090 deletions

View File

@@ -14,16 +14,14 @@
#include "soc/rtc_cntl_reg.h"
#include "esp_private/panic_internal.h"
#include "esp_rom_uart.h"
#if CONFIG_ESP_SYSTEM_MEMPROT_FEATURE
#if CONFIG_IDF_TARGET_ESP32S2
#include "esp32s2/memprot.h"
#elif CONFIG_IDF_TARGET_ESP32S3
#include "esp32s3/memprot.h"
#elif CONFIG_IDF_TARGET_ESP32C3
#include "esp32c3/memprot.h"
#elif CONFIG_IDF_TARGET_ESP32H2
#include "esp32h2/memprot.h"
#elif CONFIG_IDF_TARGET_ESP8684
#include "esp8684/memprot.h"
#else
#include "esp_memprot.h"
#endif
#endif
#define SHUTDOWN_HANDLERS_NO 5
@@ -88,9 +86,18 @@ void IRAM_ATTR esp_restart(void)
bool digital_reset_needed = false;
#if CONFIG_ESP_SYSTEM_MEMPROT_FEATURE
#if CONFIG_IDF_TARGET_ESP32S2
if (esp_memprot_is_intr_ena_any() || esp_memprot_is_locked_any()) {
digital_reset_needed = true;
}
#else
bool is_on = false;
if (esp_mprot_is_intr_ena_any(&is_on) != ESP_OK || is_on) {
digital_reset_needed = true;
} else if (esp_mprot_is_conf_locked_any(&is_on) != ESP_OK || is_on) {
digital_reset_needed = true;
}
#endif
#endif
if (digital_reset_needed) {
esp_restart_noos_dig();