Skip to content

Commit cd887ef

Browse files
fix(panic_handler): Updated panic handler to use RTC WDT
This commit updates the following: - Updates the panic handler to use only the RTC WDT to reset the system. - Refactors some of the panic handler code. - Updates Bluetooth files where in they now feed the WDTs instead of reconfiguring them. - Removes some unnecessary configuration of WDTs from various files. - Added a unit test to verify that the system does not lock up when the panic handler is stuck. - Updates the memprot unit tests to work with the refactored panic handler. Closes #15166 Closes #15018 Closes #10110
1 parent b030657 commit cd887ef

File tree

20 files changed

+574
-159
lines changed

20 files changed

+574
-159
lines changed

components/bt/controller/esp32c2/bt.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ extern int ble_controller_init(esp_bt_controller_config_t *cfg);
130130
extern int ble_log_init_async(interface_func_t bt_controller_log_interface, bool task_create, uint8_t buffers, uint32_t *bufs_size);
131131
extern int ble_log_deinit_async(void);
132132
extern void ble_log_async_output_dump_all(bool output);
133-
extern void esp_panic_handler_reconfigure_wdts(uint32_t timeout_ms);
133+
extern void esp_panic_handler_feed_wdts(void);
134134
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
135135
extern int ble_controller_deinit(void);
136136
extern int ble_controller_enable(uint8_t mode);
@@ -391,7 +391,7 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
391391

392392
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
393393
portENTER_CRITICAL_SAFE(&spinlock);
394-
esp_panic_handler_reconfigure_wdts(5000);
394+
esp_panic_handler_feed_wdts();
395395
ble_log_async_output_dump_all(true);
396396
stop_write = true;
397397
esp_bt_ontroller_log_deinit();
@@ -449,7 +449,7 @@ void esp_ble_controller_log_dump_all(bool output)
449449
} else {
450450
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
451451
portENTER_CRITICAL_SAFE(&spinlock);
452-
esp_panic_handler_reconfigure_wdts(5000);
452+
esp_panic_handler_feed_wdts();
453453
BT_ASSERT_PRINT("\r\n[DUMP_START:");
454454
ble_log_async_output_dump_all(output);
455455
BT_ASSERT_PRINT(":DUMP_END]\r\n");

components/bt/controller/esp32c5/bt.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ extern int r_ble_log_init_async(interface_func_t bt_controller_log_interface, bo
111111
extern int r_ble_log_deinit_async(void);
112112
extern void r_ble_log_async_select_dump_buffers(uint8_t buffers);
113113
extern void r_ble_log_async_output_dump_all(bool output);
114-
extern void esp_panic_handler_reconfigure_wdts(uint32_t timeout_ms);
114+
extern void esp_panic_handler_feed_wdts(void);
115115
extern int r_ble_log_ctrl_level_and_mod(uint8_t log_level, uint32_t mod_switch);
116116
extern int r_ble_ctrl_mod_type(uint16_t mod, uint32_t mod_type_switch);
117117
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
@@ -358,13 +358,13 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
358358

359359
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
360360
portENTER_CRITICAL_SAFE(&spinlock);
361-
esp_panic_handler_reconfigure_wdts(5000);
361+
esp_panic_handler_feed_wdts();
362362
r_ble_log_async_output_dump_all(true);
363363
esp_bt_ontroller_log_deinit();
364364
stop_write = true;
365365

366366
buffer = (const uint8_t *)mapped_ptr;
367-
esp_panic_handler_reconfigure_wdts(5000);
367+
esp_panic_handler_feed_wdts();
368368
if (is_filled) {
369369
read_index = next_erase_index;
370370
} else {
@@ -376,7 +376,7 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
376376
while (read_index != write_index) {
377377
esp_rom_printf("%02x ", buffer[read_index]);
378378
if (print_len > max_print_len) {
379-
esp_panic_handler_reconfigure_wdts(5000);
379+
esp_panic_handler_feed_wdts();
380380
print_len = 0;
381381
}
382382

@@ -1378,7 +1378,7 @@ static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, b
13781378
} else {
13791379
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
13801380
portENTER_CRITICAL_SAFE(&spinlock);
1381-
esp_panic_handler_reconfigure_wdts(1000);
1381+
esp_panic_handler_feed_wdts();
13821382
for (int i = 0; i < len; i++) {
13831383
esp_rom_printf("%02x ", addr[i]);
13841384
}
@@ -1399,7 +1399,7 @@ void esp_ble_controller_log_dump_all(bool output)
13991399
} else {
14001400
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
14011401
portENTER_CRITICAL_SAFE(&spinlock);
1402-
esp_panic_handler_reconfigure_wdts(5000);
1402+
esp_panic_handler_feed_wdts();
14031403
BT_ASSERT_PRINT("\r\n[DUMP_START:");
14041404
r_ble_log_async_output_dump_all(output);
14051405
BT_ASSERT_PRINT(":DUMP_END]\r\n");

components/bt/controller/esp32c6/bt.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ extern int r_ble_log_init_async(interface_func_t bt_controller_log_interface, bo
121121
extern int r_ble_log_deinit_async(void);
122122
extern void r_ble_log_async_select_dump_buffers(uint8_t buffers);
123123
extern void r_ble_log_async_output_dump_all(bool output);
124-
extern void esp_panic_handler_reconfigure_wdts(uint32_t timeout_ms);
124+
extern void esp_panic_handler_feed_wdts(void);
125125
extern int r_ble_log_ctrl_level_and_mod(uint8_t log_level, uint32_t mod_switch);
126126
extern int r_ble_ctrl_mod_type(uint16_t mod, uint32_t mod_type_switch);
127127
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
@@ -381,13 +381,13 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
381381

382382
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
383383
portENTER_CRITICAL_SAFE(&spinlock);
384-
esp_panic_handler_reconfigure_wdts(5000);
384+
esp_panic_handler_feed_wdts();
385385
r_ble_log_async_output_dump_all(true);
386386
esp_bt_ontroller_log_deinit();
387387
stop_write = true;
388388

389389
buffer = (const uint8_t *)mapped_ptr;
390-
esp_panic_handler_reconfigure_wdts(5000);
390+
esp_panic_handler_feed_wdts();
391391
if (is_filled) {
392392
read_index = next_erase_index;
393393
} else {
@@ -399,7 +399,7 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
399399
while (read_index != write_index) {
400400
esp_rom_printf("%02x ", buffer[read_index]);
401401
if (print_len > max_print_len) {
402-
esp_panic_handler_reconfigure_wdts(5000);
402+
esp_panic_handler_feed_wdts();
403403
print_len = 0;
404404
}
405405

@@ -1419,7 +1419,7 @@ static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, b
14191419
} else {
14201420
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
14211421
portENTER_CRITICAL_SAFE(&spinlock);
1422-
esp_panic_handler_reconfigure_wdts(1000);
1422+
esp_panic_handler_feed_wdts();
14231423
for (int i = 0; i < len; i++) {
14241424
esp_rom_printf("%02x ", addr[i]);
14251425
}
@@ -1440,7 +1440,7 @@ void esp_ble_controller_log_dump_all(bool output)
14401440
} else {
14411441
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
14421442
portENTER_CRITICAL_SAFE(&spinlock);
1443-
esp_panic_handler_reconfigure_wdts(5000);
1443+
esp_panic_handler_feed_wdts();
14441444
BT_ASSERT_PRINT("\r\n[DUMP_START:");
14451445
r_ble_log_async_output_dump_all(output);
14461446
BT_ASSERT_PRINT(":DUMP_END]\r\n");

components/bt/controller/esp32h2/bt.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ extern int r_ble_log_init_async(interface_func_t bt_controller_log_interface, bo
116116
extern int r_ble_log_deinit_async(void);
117117
extern void r_ble_log_async_select_dump_buffers(uint8_t buffers);
118118
extern void r_ble_log_async_output_dump_all(bool output);
119-
extern void esp_panic_handler_reconfigure_wdts(uint32_t timeout_ms);
119+
extern void esp_panic_handler_feed_wdts(void);
120120
extern int r_ble_log_ctrl_level_and_mod(uint8_t log_level, uint32_t mod_switch);
121121
extern int r_ble_ctrl_mod_type(uint16_t mod, uint32_t mod_type_switch);
122122
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
@@ -379,13 +379,13 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
379379

380380
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
381381
portENTER_CRITICAL_SAFE(&spinlock);
382-
esp_panic_handler_reconfigure_wdts(5000);
382+
esp_panic_handler_feed_wdts();
383383
r_ble_log_async_output_dump_all(true);
384384
esp_bt_ontroller_log_deinit();
385385
stop_write = true;
386386

387387
buffer = (const uint8_t *)mapped_ptr;
388-
esp_panic_handler_reconfigure_wdts(5000);
388+
esp_panic_handler_feed_wdts();
389389
if (is_filled) {
390390
read_index = next_erase_index;
391391
} else {
@@ -397,7 +397,7 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
397397
while (read_index != write_index) {
398398
esp_rom_printf("%02x ", buffer[read_index]);
399399
if (print_len > max_print_len) {
400-
esp_panic_handler_reconfigure_wdts(5000);
400+
esp_panic_handler_feed_wdts();
401401
print_len = 0;
402402
}
403403

@@ -1393,7 +1393,7 @@ static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, b
13931393
} else {
13941394
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
13951395
portENTER_CRITICAL_SAFE(&spinlock);
1396-
esp_panic_handler_reconfigure_wdts(1000);
1396+
esp_panic_handler_feed_wdts();
13971397
for (int i = 0; i < len; i++) {
13981398
esp_rom_printf("%02x ", addr[i]);
13991399
}
@@ -1413,7 +1413,7 @@ void esp_ble_controller_log_dump_all(bool output)
14131413
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
14141414

14151415
portENTER_CRITICAL_SAFE(&spinlock);
1416-
esp_panic_handler_reconfigure_wdts(5000);
1416+
esp_panic_handler_feed_wdts();
14171417
BT_ASSERT_PRINT("\r\n[DUMP_START:");
14181418
r_ble_log_async_output_dump_all(output);
14191419
BT_ASSERT_PRINT(":DUMP_END]\r\n");

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy