Skip to content

Commit 296bc7d

Browse files
committed
Merge branch 'feature/h4_reset_reasons' into 'master'
feat(system): updated H4 reset reasons Closes IDF-12307 See merge request espressif/esp-idf!40499
2 parents 138a094 + 374b310 commit 296bc7d

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

components/esp_rom/esp32h4/include/esp32h4/rom/rtc.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ typedef enum {
8585
POWERON_RESET = 1, /**<1, Vbat power on reset*/
8686
RTC_SW_SYS_RESET = 3, /**<3, Software reset digital core (hp system)*/
8787
DEEPSLEEP_RESET = 5, /**<5, Deep Sleep reset digital core (hp system)*/
88-
SDIO_RESET = 6, /**<6, Reset by SLC module, reset digital core (hp system)*/
8988
TG0WDT_SYS_RESET = 7, /**<7, Timer Group0 Watch dog reset digital core (hp system)*/
9089
TG1WDT_SYS_RESET = 8, /**<8, Timer Group1 Watch dog reset digital core (hp system)*/
9190
RTCWDT_SYS_RESET = 9, /**<9, RTC Watch dog Reset digital core (hp system)*/
@@ -96,10 +95,12 @@ typedef enum {
9695
RTCWDT_RTC_RESET = 16, /**<16, RTC Watch dog reset digital core and rtc module*/
9796
TG1WDT_CPU_RESET = 17, /**<17, Time Group1 reset CPU*/
9897
SUPER_WDT_RESET = 18, /**<18, super watchdog reset digital core and rtc module*/
98+
GLITCH_RTC_RESET = 19, /**<19, glitch reset*/
9999
EFUSE_RESET = 20, /**<20, efuse reset digital core (hp system)*/
100100
USB_UART_CHIP_RESET = 21, /**<21, usb uart reset digital core (hp system)*/
101101
USB_JTAG_CHIP_RESET = 22, /**<22, usb jtag reset digital core (hp system)*/
102102
JTAG_RESET = 24, /**<24, jtag reset CPU*/
103+
CPU_LOCKUP_RESET = 25, /**<25, cpu lockup reset*/
103104
} RESET_REASON;
104105

105106
// Check if the reset reason defined in ROM is compatible with soc/reset_reasons.h
@@ -116,10 +117,12 @@ ESP_STATIC_ASSERT((soc_reset_reason_t)RTCWDT_BROWN_OUT_RESET == RESET_REASON_SYS
116117
ESP_STATIC_ASSERT((soc_reset_reason_t)RTCWDT_RTC_RESET == RESET_REASON_SYS_RTC_WDT, "RTCWDT_RTC_RESET != RESET_REASON_SYS_RTC_WDT");
117118
ESP_STATIC_ASSERT((soc_reset_reason_t)TG1WDT_CPU_RESET == RESET_REASON_CPU0_MWDT1, "TG1WDT_CPU_RESET != RESET_REASON_CPU0_MWDT1");
118119
ESP_STATIC_ASSERT((soc_reset_reason_t)SUPER_WDT_RESET == RESET_REASON_SYS_SUPER_WDT, "SUPER_WDT_RESET != RESET_REASON_SYS_SUPER_WDT");
120+
ESP_STATIC_ASSERT((soc_reset_reason_t)GLITCH_RTC_RESET == RESET_REASON_CORE_PWR_GLITCH, "GLITCH_RTC_RESET != RESET_REASON_CORE_PWR_GLITCH");
119121
ESP_STATIC_ASSERT((soc_reset_reason_t)EFUSE_RESET == RESET_REASON_CORE_EFUSE_CRC, "EFUSE_RESET != RESET_REASON_CORE_EFUSE_CRC");
120122
ESP_STATIC_ASSERT((soc_reset_reason_t)USB_UART_CHIP_RESET == RESET_REASON_CORE_USB_UART, "USB_UART_CHIP_RESET != RESET_REASON_CORE_USB_UART");
121123
ESP_STATIC_ASSERT((soc_reset_reason_t)USB_JTAG_CHIP_RESET == RESET_REASON_CORE_USB_JTAG, "USB_JTAG_CHIP_RESET != RESET_REASON_CORE_USB_JTAG");
122124
ESP_STATIC_ASSERT((soc_reset_reason_t)JTAG_RESET == RESET_REASON_CPU0_JTAG, "JTAG_RESET != RESET_REASON_CPU0_JTAG");
125+
ESP_STATIC_ASSERT((soc_reset_reason_t)CPU_LOCKUP_RESET == RESET_REASON_CPU_LOCKUP, "CPU_LOCKUP_RESET != RESET_REASON_CPU_LOCKUP");
123126

124127
typedef enum {
125128
NO_SLEEP = 0,

components/esp_system/port/soc/esp32h4/reset_reason.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include "soc/rtc_periph.h"
1111
#include "esp32h4/rom/rtc.h"
1212

13-
// TODO: [ESP32H4] IDF-12307 inherited from verification branch, need check
1413
// IDF-11910 need refactor
1514

1615
static void esp_reset_reason_clear_hint(void);
@@ -53,10 +52,19 @@ static esp_reset_reason_t get_reset_reason(soc_reset_reason_t rtc_reset_reason,
5352
case RESET_REASON_SYS_BROWN_OUT:
5453
return ESP_RST_BROWNOUT;
5554

55+
case RESET_REASON_CORE_PWR_GLITCH:
56+
return ESP_RST_PWR_GLITCH;
57+
58+
case RESET_REASON_CORE_EFUSE_CRC:
59+
return ESP_RST_EFUSE;
60+
5661
case RESET_REASON_CORE_USB_UART:
5762
case RESET_REASON_CORE_USB_JTAG:
5863
return ESP_RST_USB;
5964

65+
case RESET_REASON_CPU_LOCKUP:
66+
return ESP_RST_CPU_LOCKUP;
67+
6068
default:
6169
return ESP_RST_UNKNOWN;
6270
}

components/soc/esp32h4/include/soc/reset_reasons.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
extern "C" {
2323
#endif
2424

25-
//TODO: [ESP32H4] IDF-12307 inherit from verify code, need check
26-
2725
/**
2826
* @brief Naming conventions: RESET_REASON_{reset level}_{reset reason}
2927
* @note refer to TRM: <Reset and Clock> chapter
@@ -43,10 +41,12 @@ typedef enum {
4341
RESET_REASON_SYS_RTC_WDT = 0x10, // RTC watch dog resets digital core and rtc module
4442
RESET_REASON_CPU0_MWDT1 = 0x11, // Main watch dog 1 resets CPU 0
4543
RESET_REASON_SYS_SUPER_WDT = 0x12, // Super watch dog resets the digital core and rtc module
44+
RESET_REASON_CORE_PWR_GLITCH = 0x13, // Glitch on power resets the digital core and rtc module
4645
RESET_REASON_CORE_EFUSE_CRC = 0x14, // eFuse CRC error resets the digital core (hp system)
4746
RESET_REASON_CORE_USB_UART = 0x15, // USB UART resets the digital core (hp system)
4847
RESET_REASON_CORE_USB_JTAG = 0x16, // USB JTAG resets the digital core (hp system)
4948
RESET_REASON_CPU0_JTAG = 0x18, // JTAG resets the CPU 0
49+
RESET_REASON_CPU_LOCKUP = 0x19, // Triggered when the CPU enters lockup (exception inside the exception handler would cause this)
5050
} soc_reset_reason_t;
5151

5252
#ifdef __cplusplus

0 commit comments

Comments
 (0)