Page 1 of 1

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

Posted: Wed Oct 09, 2024 10:31 am
by Stipa88
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.

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

Posted: Thu Oct 10, 2024 1:45 am
by nopnop2002
>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