Not able to redirect crash report using esp_log_set_vprintf

cruvus
Posts: 59
Joined: Fri Jul 08, 2022 5:08 pm
Location: Planet Earth

Not able to redirect crash report using esp_log_set_vprintf

Postby cruvus » Wed Jul 13, 2022 11:05 am

On the ESP8266 we were able to redirect console output using os_install_putc1() and we could dump any byte that normally went over the uart into a buffer, which in turn could be polled over the network. That worked and helped perfectly for years!

On the ESP32 we have esp_log_set_vprintf(), but that stops working just before the interesting stuff happens, i.e. crash reports simply do not get there.
What other choices do I have? I cannot use a serial connection and I cannot create a (crash dump) partition. Let's say, there is no hardware access, the devices are in the field.

I've seen the function ets_install_putc1() in the code, but a quick test showed no effect. That is a pity, since it could be used to dump everything into an rtc memory buffer...
ESP32 / ESP-IDF 5.1.4

cruvus
Posts: 59
Joined: Fri Jul 08, 2022 5:08 pm
Location: Planet Earth

Re: Not able to redirect crash report using esp_log_set_vprintf

Postby cruvus » Thu Jul 21, 2022 11:07 pm

Is there a way to get ets_install_putc1() operational in the ESP32 IDF?
ESP32 / ESP-IDF 5.1.4

ESP_Sprite
Posts: 9619
Joined: Thu Nov 26, 2015 4:08 am

Re: Not able to redirect crash report using esp_log_set_vprintf

Postby ESP_Sprite » Fri Jul 22, 2022 2:02 am

The issue is not that ets_install_putc1 doesn't work, the issue is that the panic handler has its own routines for outputting data, and unfortunately those can't be customized. (See esp-idf/components/esp_system/panic.c for those.) I can see there's an use for being able to hook your own output things there; I'll see if we can make those functions weak so you'd be able to override them with your own. No guarantee on when someone implements that and when it hits the master branch, though.

cruvus
Posts: 59
Joined: Fri Jul 08, 2022 5:08 pm
Location: Planet Earth

Re: Not able to redirect crash report using esp_log_set_vprintf

Postby cruvus » Fri Jul 29, 2022 6:38 pm

Thank you for pointing me to the right file. That was indeed very helpful and solved the problem by introducing my own panic_print_char() function. :)
ESP32 / ESP-IDF 5.1.4

Who is online

Users browsing this forum: No registered users and 85 guests