How wiznet-ionic/wiznet-pico-freertos-c works
Project type and purpose
• This is an embedded firmware project providing FreeRTOS-based network examples for the Raspberry Pi Pico (RP2040) paired with WIZnet W5x00 Ethernet chips.
• It is organized around a layered architecture: hardware → hardware-abstraction (port) → OS kernel → network/security libraries → application examples.
Main components
a. Hardware Layer
• RP2040 MCU (CPU, PIO, SPI, GPIO, Timer peripherals)
• WIZnet W5x00 Ethernet chip (W5100S or W5500…)
• Physical connections: SPI bus lines, Chip-Select GPIO, Reset GPIO, IRQ line
b. Port / HAL Layer (under port/)
• port/ioLibrary_Driver: SPI read/write, GPIO IRQ callbacks
• port/FreeRTOS-Kernel: board-specific FreeRTOSConfig.h
• port/mbedtls: SSL configuration adaptations
• port/timer: 1 ms timer and delay functions
c. RTOS Layer
• FreeRTOS Kernel (scheduling, tasks, queues, critical sections)
• CMake integration (FreeRTOS_Kernel_import.cmake)
d. Middleware Layer
• ioLibrary_Driver (network stack API: socket, init, DHCP/DNS support)
• mbedtls (TLS/SSL functionality)
• pico-sdk & pico-extras (board support, SDK utilities)
e. Application Layer (examples/)
• DHCP & DNS task
• MQTT client task
• TCP client over SSL task
f. Build & Tooling
• CMakeLists.txt (top-level and per-module)
• Git submodules (sdk, FreeRTOS, mbedtls, ioLibrary_Driver)
• Patches (patches/0001–0003 to support clocks, TFTP, FTP)
Relationships and data flows
• Application tasks create sockets or initiate TLS sessions via ioLibrary_Driver and mbedtls APIs.
• These libraries invoke port layer functions (wizchip_spi_initialize, wizchip_read/write, timer callbacks, IRQ callbacks).
• Port functions control the RP2040 peripherals (SPI, PIO, GPIO, timers).
• SPI transactions go over the physical bus to/from the W5x00 chip, which handles Ethernet frames.
• The RTOS scheduler manages task execution, context switches, and critical‐section locks around SPI calls.
• Build system ties all modules together via CMake, pulling submodules and patches.
Architectural patterns and design principles
• Layered architecture: clear separation of hardware access (port), OS (FreeRTOS), middleware (network+TLS), and application logic (examples).
• Hardware‐abstraction via port directory to support multiple MCUs.
• Modularity by using Git submodules for third-party dependencies.
• Use of FreeRTOS for real-time scheduling and synchronization (mutexes around SPI).