ESP32: Wifi logs cannot be configured
~~Calling esp_wifi_internal_set_log_level or esp_wifi_internal_set_log_mod crashes immediately or cause crashes later (depending on when those are called) - so Wifi logs are never enabled on ESP32 (i.e. it works fine on ESP32C3)~~
Additionally there is a problem with VaList on ESP32 (or Xtensa in general) - that's why it's conditionally compiled only for ESP32C3 in log_writev
I've been applying this patch for vaarg support. I've never personally used vaargs, so it's quite possible this patch is buggy, or is missing some other steps?
Awesome - will give it a try. Long time since I built the compiler myself the last time 😄
Just to be clear, it's already included in the esp-* branch patch set, so it should already be working.
~~The va_list implementation seems to be fine since I can use it with some C code written myself and compiled with GCC. However, the va_list I get from the WiFi driver looks different. For now, I just print the format string on ESP32 which is better than having nothing. Still an interesting and valid issue so keep it open~~
No idea what I tested back then - here is an issue including a way to reproduce it easily: https://github.com/esp-rs/rust/issues/177
Unfortunately https://github.com/esp-rs/rust/issues/171 doesn't fix this
Alternatively, we could implement syslog, log_write and log_writev in C until a fix is available.
This is an ugly hack but it works. It's not very invasive because it replaces only exactly the function call that bugs out. Not likely woth a PR but if anyone is interested in trying it out, here it is (implemented for esp32 only): https://github.com/esp-rs/esp-wifi/commit/8befe40fc4b859d95d877c95af8b4f810ed6ce06