Function assert, panic, abort, IWDT... question

Stipa88
Posts: 20
Joined: Mon May 09, 2022 12:26 pm

Function assert, panic, abort, IWDT... question

Postby Stipa88 » Wed Oct 09, 2024 10:31 am

Hello everyone.

I am working on a commercial project with ESP32C3.

I would like to avoid unpleasant situations, if the "application" freezes, I would like to properly configure the ESP internal functions assert, panic, abort, reset, IWDT...

Which of the above functions can cause freezing, i.e. which have a while(1) that they don't exit? How to override or change them?
IWDT configuration is enabled. I would like to break the "freeze" inside the panic_abort() function (called from the assert() function).
Is it possible and how to configure another own IWDT, I would like to reset it in some other way, not from the FreeRtosTickHook function?
I see that ESP reconfigures the IWDT internally when state determinations happen (COREDUMP; GDBSTUB...), so I don't know if it is possible to have another own IWDT configured in the application? How does the panicHandler(void *frame) function get called?

Ideally, if the esp_system_abort() or panic_abort() function is called, I would call my own function where it would record the error in the ESP_NVS memory, and then continue with the called ..abort() function. Is there a way?

Thanks in advance to everyone for your help.

nopnop2002
Posts: 112
Joined: Thu Oct 03, 2019 10:52 pm
Contact:

Re: Function assert, panic, abort, IWDT... question

Postby nopnop2002 » Thu Oct 10, 2024 1:45 am

>Which of the above functions can cause freezing, i.e. which have a while(1) that they don't exit?

Please try it yourself.

Details of IWDT and TWDT can be found here.

https://docs.espressif.com/projects/esp ... /wdts.html

You can change what happens after a watchdog alert occurs using menuconfig.
On a TWDT timeout the default behaviour is to simply print a warning and a backtrace before continuing running the app.
If you want a timeout to cause a panic and a system reset/system halt then this can be configured through CONFIG_ESP_TASK_WDT_PANIC.

Users can define the function esp_task_wdt_isr_user_handler in the user code, in order to receive the timeout event and extend the default behavior.

How to override or extend the panic handler is Here.
https://github.com/espressif/esp-idf/issues/7681
Attachments
panic_handler-2.jpg
panic_handler-2.jpg (127.03 KiB) Viewed 419 times
panic_handler-3.jpg
panic_handler-3.jpg (122.56 KiB) Viewed 420 times

Who is online

Users browsing this forum: Baidu [Spider], jtroncin21 and 82 guests