mirror of
https://github.com/espressif/esp-idf.git
synced 2025-12-10 18:06:29 +00:00
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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user