J. Nick Koston df51f4e371 [rp2040] Fix W5500 Ethernet pbuf corruption by mirroring LWIPMutex semantics
The previous LwIPLock for RP2040+Ethernet only called
ethernet_arch_lwip_begin/end, taking the async_context lock but never
bumping arduino-pico's __inLWIP counter. The W5500 GPIO IRQ path
(LwipIntfDev::_irq) checks __inLWIP to decide whether to defer packet
processing; with __inLWIP == 0 it would proceed to run _lwipCallback
immediately from IRQ context even while the main thread held the
async_context lock, re-entering lwIP and corrupting pbuf chains.

The corruption surfaced later as the pbuf_cat assertion
"p->tot_len == p->len (of last pbuf in chain)" panicking the device
on wiznet-w5500-evb-pico boards configured with an interrupt pin.

Mirror arduino-pico's LWIPMutex (cores/rp2040/lwip_wrap.h) exactly:
bump __inLWIP, take the lock, and on release re-unmask any GPIO IRQs
that were deferred while we held it (__needsIRQEN). We can't write
`using LwIPLock = LWIPMutex;` in core/helpers.h because pulling
lwip_wrap.h there transitively poisons many translation units with
lwIP types in an order that breaks err_t resolution, so the body is
inlined in the rp2040 helpers.cpp where the include is scoped.
2026-04-09 17:42:33 -10:00
2023-06-12 17:00:34 +12:00
2022-09-06 15:48:01 +12:00
2025-12-21 09:26:03 -05:00
2024-03-28 10:20:51 +13:00
2025-07-17 22:40:28 +12:00
2026-04-07 22:29:55 +00:00
2025-12-08 14:37:45 -05:00
2026-04-09 11:28:48 +12:00
2025-07-17 22:40:28 +12:00
S
Description
ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems.
Readme Multiple Licenses
603 MiB
Languages
C++ 55.8%
Python 43.6%
C 0.3%
JavaScript 0.2%