diff --git a/components/lwip/Kconfig b/components/lwip/Kconfig index 69cd6ba306..4f26171765 100644 --- a/components/lwip/Kconfig +++ b/components/lwip/Kconfig @@ -998,6 +998,13 @@ menu "LWIP" All lwIP debug features increase the size of the final binary. + config LWIP_DEBUG_ESP_LOG + bool "Route LWIP debugs through ESP_LOG interface" + depends on LWIP_DEBUG + default n + help + Enabling this option routes all enabled LWIP debugs through ESP_LOGD. + config LWIP_NETIF_DEBUG bool "Enable netif debug messages" depends on LWIP_DEBUG diff --git a/components/lwip/port/esp32/include/arch/cc.h b/components/lwip/port/esp32/include/arch/cc.h index 9e038d11d9..7adf085643 100644 --- a/components/lwip/port/esp32/include/arch/cc.h +++ b/components/lwip/port/esp32/include/arch/cc.h @@ -85,7 +85,15 @@ typedef int sys_prot_t; #include +#ifdef CONFIG_LWIP_DEBUG_ESP_LOG +// lwip debugs routed to ESP_LOGD +#include "esp_log.h" +#define LWIP_ESP_LOG_FUNC(format, ...) ESP_LOG_LEVEL(ESP_LOG_DEBUG, "lwip", format, ##__VA_ARGS__) +#define LWIP_PLATFORM_DIAG(x) LWIP_ESP_LOG_FUNC x +#else +// lwip debugs routed to printf #define LWIP_PLATFORM_DIAG(x) do {printf x;} while(0) +#endif #ifdef NDEBUG