You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BREAKING: FreeRTOS as a define, allow full multithread/core TCP/IP (#3063)
With the expanded performance and memory of the Pico 2, having a full
operating system with threads could really improve developer life and
get the best possible algorithm performance.
This commit includes a large number of changes, all related and not
really separable into smaller bits due to the refactoring involved.
No changes should have been done to bare metal LWIP processing.
* Adds a new ` __FREERTOS` define at the IDE/platform.IO level. This
new define is required to build FreeRTOS apps and a breaking change.
* Moves FreeRTOS into the cores/rp2040 subdirectory, allowing the core
to use it without hokey weak-linked wrapper functions
* Splits the FreeRTOS variantHooks into multiple files focused on a
particular bit of management instead of a random blob of stuff.
* All LWIP calls now will be wrapped into a work queue entry and
sent to the new LWIP task.
* Enable LWIP debugging to be turned on through the menus
* New LWIP task started which handles *all* LWIP calls and Ethernet
polling via callbacks. This ensures that even with multiple cores
and multiple tasks, LWIP stays in sync and only runs on core 0.
It also ensures no LWIP processing is done at IRQ levels, allowing
for malloc/new/free/delete calls and full API access. The LWIP
task also takes care of sys_check_timeouts. It is critically
important that *ALL* LWIP calls go through this task via the
work queue or a crash will happen at some later point in time.
The wrappers take care of this already for every LWIP function
used in the core.
* Note that LWIP callbacks run in the LWIP thread and block other
LWIP operations. So for an absolutely parallel web server, you'd
want to have your tcp_recv/sent/err/poll just take the response
data and put it into a work queue for your own task and return
before processing.
* Split Ethernet interrupt handling into an IRQ acknowledge and a
posted message to the LWIP process to actually read out a packet.
Adds a hardware semaphore which protects just the bits of code where
a packet is being read of written from the HW (and not around any
LWIP send/receive calls).
* Fix race condition in WiFiServer where under heavy load with
multithreading a connection gets a tcp_abort just before tcp_accept
will be called. When we abort, we clear the this pointer, and so
when we try and recover our object we crash. Check for aborted
connections (and ignore) on WiFiServer, like we do in WiFiClient.
* WiFiClient/WiFiUDP connection list (used for stopAll) adds mutex
protection so it can safely work in parallel.
* Just panic() on FreeRTOS fatal error, don't try and be fancy and
blink a LED. GDB shows exactly where the crash is, now.
* Rewrite CYW43 driver for LWIP thread processing. The SDK really
wants to use an async_context, but that only works if the CYW43
driver is the only one there (it handles *both* Ethernet and IP
with the same context). NULL out the context pointer and wrap
the driver calls to the taskless FreeRTOS Ethernet architecture.
* Includes the async_contexts for freertos and bare metal as part
of the core build process. Users can use their own
async_context_freertos if they so desire, instead of being stuck
with the wrong one (bare metal) under FreeRTOS.
0 commit comments