How Does Swindle Put a GDB Server on the Network Without LWIP?
An RP2040 debug probe for ARM and RISC-V. With 48 KB of RAM already full, the TCP/IP stack had to live on the W5500 instead of in firmware.
0
Components
Hardware components
WIZnet - W5500
TCP server on 2 sockets (GDB :2000, RTT :20001). SPI from RP2040 GPIO2-7, no LWIP in firmware
Project description
01 — What is this project?
A debug probe is normally a USB dongle. You plug it into the machine on your desk, point GDB at it, and that is where the target lives — physically next to you.
Swindle turns a cheap dev board into a full debug probe: SWD for ARM Cortex-M, RVSWD for WCH CH32V2xx/V3xx, SDI for CH32V00x. Its core is rewritten in Rust (no_std) — target drivers, stub runners, GDB and RTT protocol, and the transport layers — around a decoupled multi-transport architecture. The headline feature list includes infinite RAM breakpoints on ARM/RV32, soft flash breakpoints for WCH parts without hardware breakpoints, FreeRTOS awareness and SEGGER RTT with no configuration, and firmware update over USB DFU.
The requirement is modest: ≥256 KB flash, ≥48 KB RAM. An RP2040-Zero qualifies, which is the project's stated appeal — "Got an RP2040 board lying around? You've got a debug probe."
Then there is the variant this write-up is about. One of the supported transports replaces USB entirely:
| Platform | Status | Notes |
|---|---|---|
| RP2040 (e.g. RP2040-Zero) | ✅ Stable | The most affordable option |
| RP2040 + W5500 | 🧪 Experimental | Ethernet |
| RP2350 | 🧪 Experimental | |
| GD32F303CCT6 | ✅ Stable | |
| CH32V30xxx | ✅ Stable | RISC-V host |
With a W5500 attached, the probe becomes a network service. GDB connects to an IP address and a port instead of a serial device, and the board being debugged can be anywhere there is Ethernet.
02 — Why put a debug probe on the network?
🔷 Reason 1 — The target is often not where the developer is
A board in a test chamber, on a robot, in a rack, or in another building still needs a debugger attached. USB gets you about three metres. Ethernet gets you the building, and with it the ability to leave a probe permanently wired to a target that is inconvenient to reach.
🔷 Reason 2 — A networked probe can be shared
A USB probe serves whoever is holding it. A probe with an IP address serves whoever connects. For a hardware-in-the-loop rig or a shared bring-up bench, that changes how the equipment gets used.
🔷 Reason 3 — GDB already speaks TCP
This is the part that makes the whole idea cheap. GDB's remote protocol runs over a plain TCP stream; target extended-remote <host>:<port> has been in GDB for decades. There is no new protocol to design — the probe only has to present the same byte stream over a socket instead of over a CDC-ACM endpoint. Swindle's architecture is explicitly "decoupled, multi-transport", so Ethernet becomes another transport rather than a rewrite.
03 — System architecture
┌──────────── Developer's machine ────────────┐
│ gdb → target extended-remote <ip>:2000 │
│ RTT viewer → <ip>:20001 │
└────────────────────┬────────────────────────┘
│ TCP over Ethernet (DHCP-assigned address)
┌───────────▼────────────┐
│ WIZnet W5500 │
│ TCP, socketRunner │
│ NO LWIP │
│ MAC: 00:08:dc:xx:xx:xx│
│ (from CPU serial)│
└───────────┬────────────┘
│ SPI — RP2040-Zero mapping:
│ SCK GPIO2
│ MOSI GPIO3
│ MISO GPIO4
│ CS GPIO5
│ RST GPIO6
│ IRQ GPIO7
┌───────────▼──────────────────────────────────┐
│ RP2040 (≥256 KB flash, ≥48 KB RAM) │
│ │
│ ┌──────────────────────────────────────┐ │
│ │ Rust no_std core │ │
│ │ · target drivers (SWD/RVSWD/SDI) │ │
│ │ · stub runners │ │
│ │ · GDB + RTT protocol │ │
│ │ · transport layer │ │
│ └──────────────────┬───────────────────┘ │
│ │ │
│ FreeRTOS: gdbTask (6 KiB stack) │
│ RP2040 PIO for the probe's wire protocols │
│ WS2812 status LED (GPIO16 on Zero) │
└───────────┬──────────────────────────────────┘
│ SWD / RVSWD / SDI
┌───────────▼──────────────────────────────┐
│ Target under debug │
│ ARM Cortex-M (RP2040, RP2350, STM32, │
│ GD32, …) · WCH CH32V2xx/V3xx/V00x │
│ Infinite RAM breakpoints · FreeRTOS │
│ awareness · SEGGER RTT │
└──────────────────────────────────────────┘
04 — Why the W5500? ⭐
🔷 The design statement is in the source, and it names the alternative it rejected
The file header of the RP2040 + W5500 entry point says it in one line:
"Communication with GDB is over TCP via the W5500 (socketRunner, no LWIP)."
no LWIP is the whole argument, stated by the author. On a probe host with 48 KB of RAM that is also running a Rust no_std core, FreeRTOS, target drivers, stub runners, the GDB protocol state machine, an RTT channel and RP2040 PIO programs, an LWIP instance is not a comfortable fit. LWIP's buffer pools, protocol control blocks and timers would compete directly with the probe's own working memory — and the probe's memory is where target registers, flash stubs and GDB packet buffers live.
Moving TCP into the W5500 removes that contention entirely. The chip holds the stack and 32 KB of its own packet buffer; the RP2040 keeps its 48 KB for debugging.
🔷 Socket mode used — TOE TCP
The probe listens for GDB. The README documents DHCP plus ports 2000 and 20001 — the GDB server on one, the RTT channel on the other — so the W5500 is operating as a TCP server (Sn_MR_TCP, listen) on at least two sockets concurrently, one per service.
This is a good illustration of why 8 hardware sockets matter on a part like this. Two independent long-lived TCP connections, each with its own buffer allocation out of the shared 32 KB, with no socket multiplexing code on the host side.
IPRAW / MACRAW are not used. The probe wants a byte stream, which is exactly what the hardwired TCP engine delivers.
🔷 A detail worth noticing: the MAC address comes from the CPU, under WIZnet's OUI
uint32_t id = lnCpuID::getSerialID();
uint8_t *p = (uint8_t *)&id;
mymac[0] = 0x0; mymac[1] = 0x08; mymac[2] = 0xdc;
mymac[3] = p[0]; mymac[4] = p[1]; mymac[5] = p[2];
00:08:DC is WIZnet's own OUI. The lower three bytes are taken from the RP2040's unique serial ID, so every probe self-assigns a stable, distinct MAC with no per-unit configuration step and no EEPROM. Combined with DHCP, a freshly flashed board joins the network and is reachable without anyone editing a config file.
For a device meant to be cheap and numerous on a test bench, that is the right amount of provisioning: none.
🔷 Interrupt and reset are both wired
The pin mapping brings out more than the SPI four:
const lnW5500SPI w5500Pins = {
.miso = GPIO4, .mosi = GPIO3, .clk = GPIO2,
.cs = GPIO5, .reset = GPIO6, .intr = GPIO7,
};
reset on GPIO6 lets the firmware hard-reset the controller without power-cycling the board — useful on a probe that may be left running for weeks. intr on GPIO7 means the FreeRTOS GDB task can block on an event rather than poll, which matters when the same CPU is also driving SWD transactions.
🔷 The hardware side reuses WIZnet's own reference schematic — and says so
The repository includes a KiCad board, kicad/rp2040_zero/rev2_w5500/, with its own W5500 symbol and three LQFP-48 footprint variants. Its License.txt is refreshingly direct:
the w5500 schematic is taken from here :
github.com/Wiznet/Hardware-Files-of-WIZnet/.../W5500-EVB-Pico_V100— (c) Wiznet
That is the official W5500-EVB-Pico reference schematic, lifted into a custom board and credited. It is a small thing, but it is the reference design doing exactly the job a reference design exists to do: someone building a one-off probe did not have to re-derive the magnetics, termination and crystal network.
🔷 Verified evidence ✅
| Claim | Evidence | Source |
|---|---|---|
| TCP transport, LWIP explicitly avoided | "Communication with GDB is over TCP via the W5500 (socketRunner, no LWIP)" | src/swindle_rp2040_w5500_common.cpp |
| SPI pin mapping | SCK GPIO2, MOSI GPIO3, MISO GPIO4, CS GPIO5, RST GPIO6, IRQ GPIO7 | src/swindle_rp2040_zero_w5500.cpp |
| MAC from CPU serial under WIZnet OUI | mymac = {0x00, 0x08, 0xdc, serial[0..2]} | same file |
| Ports and addressing | "DHCP + port 2000/20001" | README feature table |
| Host resource floor | "≥256 KB flash and ≥48 KB RAM" | README |
| Dedicated FreeRTOS task | LN_BIG_TASK_STORAGE(gdbTask, TASK_BMP_GDB_STACK_SIZE) — static TCB + stack when the board can spare 6 KiB | swindle_rp2040_w5500_common.cpp |
| Board files | KiCad project with W5500 symbol + 3 LQFP-48 footprint variants | kicad/rp2040_zero/rev2_w5500/ |
| Schematic provenance | W5500 sheet taken from WIZnet's W5500-EVB-Pico V100 reference, credited | kicad/.../License.txt |
| Status | RP2040 + W5500 listed as Experimental | README support table |
🔷 Code completeness — one honest gap
Per a reproducibility check, the W5500 integration is not fully contained in this repository. The board files include lowlevel_w5500.h and the common entry point declares deps ../private_include/w5500_gdb_task, but neither lowlevel_w5500 nor w5500_gdb_task is present in the public tree — they resolve to a sibling directory outside it.
So what the repository proves is the integration: the pin mapping, the MAC scheme, the FreeRTOS task structure, the TCP/no-LWIP decision, and the board. The W5500 register-level driver itself lives elsewhere and would need to be obtained to build this variant. Anyone reproducing it should plan for that, and the Experimental label is consistent with it.
05 — Key components
🌐 WIZnet W5500 — TOE TCP server, two sockets
8 independent hardware sockets, 32 KB internal TX/RX buffer, SPI MODE 0/3 up to 80 MHz, 10/100 PHY embedded, 48-pin LQFP. Serves the GDB port and the RTT port as two concurrent TCP listeners, holding the whole stack off a 48 KB host.
🧠 RP2040 (e.g. RP2040-Zero)
The probe host. Floor is ≥256 KB flash and ≥48 KB RAM. PIO handles the probe's wire protocols; FreeRTOS schedules the GDB/RTT network task alongside them. A WS2812 on GPIO16 gives status on the Zero.
🦀 Rust no_std core
Target drivers, stub runners, GDB and RTT protocol handling, and the transport layers — rewritten in Rust from the Black Magic Probe lineage, with a decoupled multi-transport design that is what makes an Ethernet variant possible at all.
🔗 Probe protocols
SWD for ARM Cortex-M; RVSWD for WCH CH32V2xx/V3xx; SDI for CH32V00x. No JTAG. Infinite breakpoints in RAM for ARM and RV32, plus soft flash breakpoints for WCH parts lacking hardware breakpoint units.
🧰 Developer features that travel over the network
FreeRTOS awareness and SEGGER RTT with no configuration, a dedicated TX-only USB RTT channel on RP2xxx and CH32V3xx, and firmware update over USB DFU with no programmer.
🖼️ Custom PCB (optional)
The repo carries KiCad projects including variants with voltage level translators, a MOSFET on reset, and WS2812 — plus the rev2_w5500 board that adds the Ethernet front end from WIZnet's reference schematic.
06 — Application scenarios
01. Debugging a target you cannot sit next to
Environmental chamber, EMC bench, rooftop installation, a board inside a machine. The probe stays wired to the target; the developer connects over the network.
02. Shared hardware-in-the-loop bench
A rack of targets, each with a cheap RP2040-Zero probe on Ethernet. Whoever needs a board points GDB at its address. No one has to find the dongle.
03. Long-running RTT log capture
With RTT on its own port, a probe can stream a target's log to a collector for days without a developer's laptop being attached. The DHCP + self-assigned MAC arrangement means a rebooted probe comes back on its own.
04. CI and automated flashing
A networked GDB endpoint is scriptable from anywhere on the LAN, which makes a flash-and-test step in CI a matter of a TCP connection rather than USB device plumbing on the runner.
Conclusion
A $5 dev board becomes a networked ARM/RISC-V debug probe — and the reason it fits in 48 KB of RAM is that the TCP stack is not in the RAM. The author put it in three words:
no LWIP.
- ✅ The rejected alternative is named in the source — "over TCP via the W5500 (socketRunner, no LWIP)" — the clearest form the hardwired-stack argument takes
- ✅ Host floor is ≥48 KB RAM while also running a Rust
no_stdcore, FreeRTOS, target drivers, stub runners, GDB and RTT. There is no room for a software stack, and none is used - ✅ Two concurrent TCP server sockets — GDB on port 2000, RTT on 20001 — out of the W5500's 8, with its own 32 KB buffer
- ✅ Zero-configuration provisioning — MAC self-derived from the RP2040 serial under WIZnet's
00:08:DCOUI, address by DHCP. Flash a board and it is reachable - ✅ Reset and interrupt both wired (GPIO6 / GPIO7) — hard reset without power cycling, and event-driven rather than polled service
- ✅ WIZnet's own W5500-EVB-Pico reference schematic reused and credited in the custom KiCad board — the reference design doing its job
- ✅ Broad target support over one network transport — SWD, RVSWD and SDI; ARM Cortex-M and WCH RISC-V; infinite RAM breakpoints; FreeRTOS and RTT awareness
Honest status: the RP2040 + W5500 variant is Experimental, and the low-level W5500 driver is an external dependency rather than part of this repository.
Q&A
Q. Which W5500 socket mode does this use? A. TOE TCP in server (listen) mode. The probe exposes a GDB server and an RTT channel on separate ports (2000 and 20001), so at least two TCP sockets are open concurrently. The source states TCP directly; the port split is from the README.
Q. Why not LWIP on the RP2040? It has been done. A. It has, and on a board with spare RAM it is reasonable. Here the author chose otherwise and said why in the file header. The probe's 48 KB minimum is already carrying a Rust no_std core, FreeRTOS, SWD/RVSWD/SDI drivers, flash stub runners, GDB packet handling and RTT. LWIP's pools and PCBs would be taken out of the same budget that holds target state. The W5500 has its own 32 KB, so the trade is a chip instead of a third of your RAM.
Q. How does the probe get an address, and how do I find it? A. DHCP. The MAC is derived at boot from the RP2040's unique serial ID under WIZnet's OUI (00:08:DC), so each unit is stable and distinct with no provisioning. Look it up on your DHCP server, or give it a reservation keyed on that MAC.
Q. Can I build this today? A. Partly. The firmware repository has the board-specific pin mapping, the common entry point, and a KiCad board for RP2040-Zero + W5500. The W5500 low-level driver (lowlevel_w5500, w5500_gdb_task) is referenced from a sibling private_include directory and is not in the public tree, so that piece has to be obtained separately. The author's own Experimental label on this target is the right expectation to carry in.
Q. Does it work with a stock W5500 module instead of the custom board? A. The pin mapping is plain GPIO (SCK/MOSI/MISO/CS/RST/IRQ on GPIO2–7 for the Zero) and is defined in a per-board file that then includes the common implementation, so retargeting to a module is editing one struct and adding a board file. The custom board exists to put the Ethernet front end on the same PCB rather than because the firmware requires it.
Q. Why does a debug probe need the chip's reset line wired? A. Because it may run unattended for a long time. If the Ethernet controller ever wedges, firmware that can assert RST recovers without someone walking over to unplug the board — which is exactly the situation a networked probe exists to avoid.
한국어 버전
Swindle — LWIP 없이 GDB를 네트워크에 올리다
#W5500 #TOE #TCP #RP2040 #Rust #GDB #디버그프로브 #SWD #RISC-V #FreeRTOS
📚 맥락: 오픈소스 ARM / RISC-V 디버그 프로브 펌웨어. Rust
no_std코어, Black Magic Probe에서 파생 검증 상태: RP2040 + W5500 타깃은 저자가 🧪 실험적(Experimental) 으로 표기. 핀 매핑·MAC 생성·TCP/no-LWIP 설계는 공개 저장소에 있으나 저수준 W5500 드라이버는 외부 의존성 (§04 참조)
01 — 어떤 프로젝트인가
디버그 프로브는 보통 USB 동글입니다. 책상 위 컴퓨터에 꽂고 GDB를 거기로 향하게 하면, 타깃은 물리적으로 바로 옆에 있습니다.
Swindle은 저렴한 개발보드를 완전한 디버그 프로브로 바꿉니다. ARM Cortex-M용 SWD, WCH CH32V2xx/V3xx용 RVSWD, CH32V00x용 SDI. 코어는 Rust(no_std) 로 재작성됐습니다 — 타깃 드라이버, 스텁 러너, GDB·RTT 프로토콜, 전송 계층 전부가 분리된 다중 전송 구조 위에 있습니다. 대표 기능으로 ARM/RV32의 무제한 RAM 브레이크포인트, 하드웨어 브레이크포인트가 없는 WCH 부품용 소프트 플래시 브레이크포인트, 설정 없이 동작하는 FreeRTOS 인식과 SEGGER RTT, USB DFU 펌웨어 업데이트가 있습니다.
요구사항은 소박합니다 — 플래시 256 KB 이상, RAM 48 KB 이상. RP2040-Zero가 충족하고, 그게 이 프로젝트의 매력 포인트입니다 — "RP2040 보드가 굴러다닌다면, 디버그 프로브를 가진 겁니다."
그리고 이 글이 다루는 변종이 있습니다. 지원 전송 중 하나가 USB를 통째로 대체합니다.
| 플랫폼 | 상태 | 비고 |
|---|---|---|
| RP2040 (예: RP2040-Zero) | ✅ 안정 | 가장 저렴한 선택 |
| RP2040 + W5500 | 🧪 실험적 | 이더넷 |
| RP2350 | 🧪 실험적 | |
| GD32F303CCT6 | ✅ 안정 | |
| CH32V30xxx | ✅ 안정 | RISC-V 호스트 |
W5500이 붙으면 프로브가 네트워크 서비스가 됩니다. GDB가 시리얼 장치 대신 IP 주소와 포트로 접속하고, 디버깅 대상 보드는 이더넷이 닿는 어디에든 있을 수 있습니다.
02 — 디버그 프로브를 왜 네트워크에 올리나
🔷 이유 1 — 타깃은 개발자가 있는 곳에 없는 경우가 많다
시험 챔버 안, 로봇 위, 랙 안, 다른 건물에 있는 보드에도 디버거는 붙어 있어야 합니다. USB는 약 3미터를 줍니다. 이더넷은 건물을 주고, 접근하기 불편한 타깃에 프로브를 상시 연결해둘 수 있게 해줍니다.
🔷 이유 2 — 네트워크 프로브는 공유된다
USB 프로브는 그걸 손에 쥔 사람을 섬깁니다. IP 주소를 가진 프로브는 접속한 사람을 섬깁니다. HIL 리그나 공용 브링업 벤치에서는 장비 사용 방식 자체가 달라집니다.
🔷 이유 3 — GDB는 이미 TCP를 말한다
이 아이디어를 싸게 만드는 부분입니다. GDB 원격 프로토콜은 평범한 TCP 스트림으로 동작하고, target extended-remote <host>:<port>는 수십 년째 GDB에 있습니다. 새로 설계할 프로토콜이 없습니다 — 프로브는 같은 바이트 스트림을 CDC-ACM 엔드포인트가 아니라 소켓으로 내놓기만 하면 됩니다. Swindle의 구조가 명시적으로 "분리된 다중 전송" 이어서, 이더넷이 재작성이 아니라 또 하나의 전송이 됩니다.
03 — 시스템 구조
┌──────────── 개발자 머신 ────────────────────┐
│ gdb → target extended-remote <ip>:2000 │
│ RTT 뷰어 → <ip>:20001 │
└────────────────────┬────────────────────────┘
│ 이더넷 상 TCP (DHCP 할당 주소)
┌───────────▼────────────┐
│ WIZnet W5500 │
│ TCP, socketRunner │
│ LWIP 없음 │
│ MAC: 00:08:dc:xx:xx:xx│
│ (CPU 시리얼에서) │
└───────────┬────────────┘
│ SPI — RP2040-Zero 매핑:
│ SCK GPIO2
│ MOSI GPIO3
│ MISO GPIO4
│ CS GPIO5
│ RST GPIO6
│ IRQ GPIO7
┌───────────▼──────────────────────────────────┐
│ RP2040 (플래시 ≥256 KB, RAM ≥48 KB) │
│ │
│ ┌──────────────────────────────────────┐ │
│ │ Rust no_std 코어 │ │
│ │ · 타깃 드라이버 (SWD/RVSWD/SDI) │ │
│ │ · 스텁 러너 │ │
│ │ · GDB + RTT 프로토콜 │ │
│ │ · 전송 계층 │ │
│ └──────────────────┬───────────────────┘ │
│ │ │
│ FreeRTOS: gdbTask (스택 6 KiB) │
│ 프로브 와이어 프로토콜에 RP2040 PIO │
│ WS2812 상태 LED (Zero는 GPIO16) │
└───────────┬──────────────────────────────────┘
│ SWD / RVSWD / SDI
┌───────────▼──────────────────────────────┐
│ 디버깅 대상 │
│ ARM Cortex-M (RP2040, RP2350, STM32, │
│ GD32, …) · WCH CH32V2xx/V3xx/V00x │
│ 무제한 RAM 브레이크포인트 · FreeRTOS │
│ 인식 · SEGGER RTT │
└──────────────────────────────────────────┘
04 — 왜 W5500이어야 했는가 ⭐
🔷 설계 선언이 소스에 있고, 기각한 대안을 이름으로 적어두었다
RP2040 + W5500 엔트리 포인트의 파일 헤더가 한 줄로 말합니다.
"GDB와의 통신은 W5500을 통한 TCP다 (socketRunner, LWIP 없음)."
no LWIP가 논거 전체이고, 저자가 직접 적었습니다. RAM 48 KB 짜리 프로브 호스트가 동시에 Rust no_std 코어, FreeRTOS, 타깃 드라이버, 스텁 러너, GDB 프로토콜 상태기계, RTT 채널, RP2040 PIO 프로그램까지 돌리고 있다면, LWIP 인스턴스는 편하게 들어갈 자리가 아닙니다. LWIP의 버퍼 풀, 프로토콜 제어 블록, 타이머가 프로브 자신의 작업 메모리와 직접 경쟁합니다 — 그리고 프로브의 메모리는 타깃 레지스터, 플래시 스텁, GDB 패킷 버퍼가 사는 곳입니다.
TCP를 W5500으로 옮기면 그 경합이 완전히 사라집니다. 칩이 스택과 자기 패킷 버퍼 32 KB를 들고 있고, RP2040은 48 KB를 디버깅에 그대로 씁니다.
🔷 사용 소켓 모드 — TOE TCP
프로브는 GDB를 기다립니다. README가 DHCP와 포트 2000·20001을 문서화합니다 — 한쪽은 GDB 서버, 다른 쪽은 RTT 채널 — 따라서 W5500은 서비스당 하나씩 최소 두 개의 소켓에서 TCP 서버(Sn_MR_TCP, listen) 로 동작합니다.
이런 부품에서 하드웨어 소켓 8개가 왜 중요한지 보여주는 좋은 예입니다. 독립된 장수명 TCP 연결 두 개가 공유 32 KB에서 각자 버퍼를 할당받고, 호스트 쪽에 소켓 멀티플렉싱 코드가 없습니다.
IPRAW / MACRAW는 쓰지 않습니다. 프로브가 원하는 건 바이트 스트림이고, 하드와이어드 TCP 엔진이 주는 것이 정확히 그것입니다.
🔷 눈여겨볼 디테일 — MAC 주소를 CPU에서, WIZnet OUI 아래로 만든다
uint32_t id = lnCpuID::getSerialID();
uint8_t *p = (uint8_t *)&id;
mymac[0] = 0x0; mymac[1] = 0x08; mymac[2] = 0xdc;
mymac[3] = p[0]; mymac[4] = p[1]; mymac[5] = p[2];
00:08:DC는 WIZnet 자신의 OUI입니다. 하위 3바이트를 RP2040의 고유 시리얼 ID에서 가져오므로, 모든 프로브가 유닛별 설정 단계도 EEPROM도 없이 안정적이고 서로 다른 MAC을 스스로 배정합니다. DHCP와 합쳐지면 갓 플래싱한 보드가 네트워크에 들어와 아무도 설정 파일을 고치지 않아도 접속됩니다.
시험 벤치에 싸고 많이 놓일 장치에게는 적절한 프로비저닝 양입니다 — 없음.
🔷 인터럽트와 리셋이 둘 다 배선돼 있다
핀 매핑이 SPI 4선보다 많이 뽑아냅니다.
const lnW5500SPI w5500Pins = {
.miso = GPIO4, .mosi = GPIO3, .clk = GPIO2,
.cs = GPIO5, .reset = GPIO6, .intr = GPIO7,
};
GPIO6의 reset은 보드 전원을 끊지 않고 펌웨어가 컨트롤러를 하드 리셋하게 해줍니다 — 몇 주씩 켜둘 수 있는 프로브에서 유용합니다. GPIO7의 intr은 FreeRTOS GDB 태스크가 폴링 대신 이벤트에서 블록할 수 있다는 뜻이고, 같은 CPU가 SWD 트랜잭션까지 구동할 때 그게 중요합니다.
🔷 하드웨어는 WIZnet 자신의 레퍼런스 회로도를 재사용했고, 그렇게 밝혔다
저장소에 KiCad 보드 kicad/rp2040_zero/rev2_w5500/가 있고, 자체 W5500 심볼과 LQFP-48 풋프린트 3종을 담고 있습니다. 그 License.txt가 상쾌하게 직설적입니다.
the w5500 schematic is taken from here :
github.com/Wiznet/Hardware-Files-of-WIZnet/.../W5500-EVB-Pico_V100— (c) Wiznet
공식 W5500-EVB-Pico 레퍼런스 회로도를 커스텀 보드로 가져오고 출처를 밝힌 것입니다. 작은 일이지만, 레퍼런스 설계가 존재하는 이유를 그대로 수행한 사례입니다 — 일회성 프로브를 만드는 사람이 마그네틱, 종단, 크리스탈 네트워크를 다시 유도할 필요가 없었습니다.
🔷 검증된 증거 ✅
| 주장 | 근거 | 출처 |
|---|---|---|
| TCP 전송, LWIP 명시적 배제 | "Communication with GDB is over TCP via the W5500 (socketRunner, no LWIP)" | src/swindle_rp2040_w5500_common.cpp |
| SPI 핀 매핑 | SCK GPIO2, MOSI GPIO3, MISO GPIO4, CS GPIO5, RST GPIO6, IRQ GPIO7 | src/swindle_rp2040_zero_w5500.cpp |
| WIZnet OUI 아래 CPU 시리얼 기반 MAC | mymac = {0x00, 0x08, 0xdc, serial[0..2]} | 같은 파일 |
| 포트와 주소 배정 | "DHCP + port 2000/20001" | README 기능표 |
| 호스트 최소 자원 | "≥256 KB flash and ≥48 KB RAM" | README |
| 전용 FreeRTOS 태스크 | LN_BIG_TASK_STORAGE(gdbTask, TASK_BMP_GDB_STACK_SIZE) — 보드가 6 KiB를 낼 수 있으면 정적 TCB+스택 | swindle_rp2040_w5500_common.cpp |
| 보드 파일 | W5500 심볼 + LQFP-48 풋프린트 3종이 든 KiCad 프로젝트 | kicad/rp2040_zero/rev2_w5500/ |
| 회로도 출처 | W5500 시트를 WIZnet W5500-EVB-Pico V100 레퍼런스에서 가져오고 명기 | kicad/.../License.txt |
| 상태 | RP2040 + W5500은 실험적으로 표기 | README 지원표 |
🔷 코드 완전성 — 정직한 결함 하나
재현성 점검 결과, W5500 통합이 이 저장소 안에 전부 들어 있지 않습니다. 보드 파일이 lowlevel_w5500.h를 포함하고 공통 엔트리 포인트가 deps ../private_include/w5500_gdb_task를 선언하는데, lowlevel_w5500도 w5500_gdb_task도 공개 트리에 없습니다 — 바깥의 형제 디렉터리로 해석됩니다.
그래서 이 저장소가 증명하는 것은 통합입니다 — 핀 매핑, MAC 생성 방식, FreeRTOS 태스크 구조, TCP/no-LWIP 결정, 그리고 보드. W5500 레지스터 수준 드라이버 자체는 다른 곳에 있고, 이 변종을 빌드하려면 별도로 확보해야 합니다. 재현하려는 분은 그걸 염두에 두시는 게 좋고, 실험적 표기가 이 상황과 일관됩니다.
05 — 핵심 구성요소
🌐 WIZnet W5500 — TOE TCP 서버, 소켓 2개
독립 하드웨어 소켓 8개, 내부 TX/RX 버퍼 32 KB, SPI MODE 0/3 최대 80 MHz, 10/100 PHY 내장, 48핀 LQFP. GDB 포트와 RTT 포트를 동시 TCP 리스너 두 개로 서비스하며, 48 KB 호스트에서 스택 전체를 덜어냅니다.
🧠 RP2040 (예: RP2040-Zero)
프로브 호스트. 하한은 플래시 256 KB, RAM 48 KB. PIO가 프로브의 와이어 프로토콜을 처리하고, FreeRTOS가 그 옆에서 GDB/RTT 네트워크 태스크를 스케줄합니다. Zero에서는 GPIO16의 WS2812가 상태를 표시합니다.
🦀 Rust no_std 코어
타깃 드라이버, 스텁 러너, GDB·RTT 프로토콜 처리, 전송 계층 — Black Magic Probe 계보에서 Rust로 재작성됐고, 분리된 다중 전송 설계가 이더넷 변종을 애초에 가능하게 만든 요인입니다.
🔗 프로브 프로토콜
ARM Cortex-M에 SWD, WCH CH32V2xx/V3xx에 RVSWD, CH32V00x에 SDI. JTAG은 없음. ARM과 RV32에 무제한 RAM 브레이크포인트, 하드웨어 브레이크포인트 유닛이 없는 WCH 부품에는 소프트 플래시 브레이크포인트.
🧰 네트워크로 함께 넘어가는 개발 기능
설정 없는 FreeRTOS 인식과 SEGGER RTT, RP2xxx·CH32V3xx의 전용 송신 전용 USB RTT 채널, 프로그래머 없는 USB DFU 펌웨어 업데이트.
🖼️ 커스텀 PCB (선택)
저장소에 전압 레벨 변환기, 리셋 MOSFET, WS2812를 포함한 변종들의 KiCad 프로젝트가 있고, 여기에 WIZnet 레퍼런스 회로도에서 이더넷 프론트엔드를 가져온 rev2_w5500 보드가 더해집니다.
06 — 응용 시나리오
01. 옆에 앉을 수 없는 타깃 디버깅
환경 챔버, EMC 벤치, 옥상 설치물, 기계 안의 보드. 프로브는 타깃에 유선으로 남고, 개발자는 네트워크로 접속합니다.
02. 공용 HIL 벤치
타깃이 꽂힌 랙, 각 타깃에 저렴한 RP2040-Zero 프로브가 이더넷으로. 보드가 필요한 사람이 그 주소로 GDB를 향하면 됩니다. 아무도 동글을 찾아다니지 않습니다.
03. 장시간 RTT 로그 수집
RTT가 자기 포트를 가지므로, 개발자 노트북이 붙어 있지 않아도 프로브가 타깃 로그를 수집기로 며칠간 스트리밍할 수 있습니다. DHCP와 자가 배정 MAC 덕에 재부팅된 프로브가 스스로 돌아옵니다.
04. CI와 자동 플래싱
네트워크 GDB 엔드포인트는 LAN 어디서든 스크립트로 다룰 수 있어서, CI의 플래시·테스트 단계가 러너의 USB 장치 배관이 아니라 TCP 연결 문제가 됩니다.
Conclusion
5달러 개발보드가 네트워크 ARM/RISC-V 디버그 프로브가 됩니다 — 그게 RAM 48 KB에 들어가는 이유는 TCP 스택이 그 RAM에 없기 때문입니다. 저자는 세 단어로 적었습니다.
no LWIP.
- ✅ 기각한 대안이 소스에 이름으로 적혀 있다 — "over TCP via the W5500 (socketRunner, no LWIP)" — 하드와이어드 스택 논거가 취할 수 있는 가장 명확한 형태
- ✅ 호스트 하한이 RAM 48 KB 인데 동시에 Rust
no_std코어, FreeRTOS, 타깃 드라이버, 스텁 러너, GDB, RTT를 돌립니다. 소프트웨어 스택이 들어갈 자리가 없고, 쓰지도 않습니다 - ✅ 동시 TCP 서버 소켓 2개 — GDB 2000번, RTT 20001번 — W5500의 8개 중에서, 자기 버퍼 32 KB로
- ✅ 설정 제로 프로비저닝 — MAC을 RP2040 시리얼에서 WIZnet
00:08:DCOUI 아래로 자가 생성, 주소는 DHCP. 플래싱하면 바로 접속됨 - ✅ 리셋과 인터럽트 모두 배선(GPIO6 / GPIO7) — 전원 차단 없는 하드 리셋, 폴링 아닌 이벤트 구동
- ✅ WIZnet 자신의 W5500-EVB-Pico 레퍼런스 회로도를 재사용하고 출처 명기 — 레퍼런스 설계가 제 일을 한 사례
- ✅ 하나의 네트워크 전송으로 폭넓은 타깃 지원 — SWD·RVSWD·SDI, ARM Cortex-M과 WCH RISC-V, 무제한 RAM 브레이크포인트, FreeRTOS·RTT 인식
정직한 상태: RP2040 + W5500 변종은 실험적이고, 저수준 W5500 드라이버는 이 저장소의 일부가 아니라 외부 의존성입니다.
Q&A
Q. W5500의 어떤 소켓 모드를 쓰나요? A. TOE TCP의 서버(listen) 모드입니다. 프로브가 GDB 서버와 RTT 채널을 별개 포트(2000, 20001)로 내놓으므로 최소 두 개의 TCP 소켓이 동시에 열려 있습니다. TCP는 소스에 직접 쓰여 있고, 포트 분리는 README에서 나옵니다.
Q. RP2040에 LWIP를 쓰면 안 되나요? 해본 사례가 있는데요. A. 있고, RAM 여유가 있는 보드라면 합리적입니다. 여기서는 저자가 다르게 선택하고 파일 헤더에 이유를 적었습니다. 프로브의 최소 48 KB는 이미 Rust no_std 코어, FreeRTOS, SWD/RVSWD/SDI 드라이버, 플래시 스텁 러너, GDB 패킷 처리, RTT를 지고 있습니다. LWIP의 풀과 PCB가 타깃 상태를 담은 같은 예산에서 빠져나갑니다. W5500은 자기 32 KB를 가지므로, 거래는 RAM의 3분의 1 대신 칩 하나입니다.
Q. 프로브가 주소를 어떻게 받고, 어떻게 찾나요? A. DHCP입니다. MAC을 부팅 시 RP2040 고유 시리얼 ID에서 WIZnet OUI(00:08:DC) 아래로 생성하므로, 각 유닛이 프로비저닝 없이 안정적이고 서로 다릅니다. DHCP 서버에서 조회하거나, 그 MAC으로 예약을 걸어두면 됩니다.
Q. 지금 바로 만들 수 있나요? A. 부분적으로요. 펌웨어 저장소에 보드별 핀 매핑, 공통 엔트리 포인트, RP2040-Zero + W5500용 KiCad 보드가 있습니다. W5500 저수준 드라이버(lowlevel_w5500, w5500_gdb_task)는 형제 private_include 디렉터리에서 참조되고 공개 트리에 없으므로, 그 조각은 별도로 확보해야 합니다. 저자가 이 타깃에 붙인 실험적 표기가 들어갈 때 가질 올바른 기대치입니다.
Q. 커스텀 보드 대신 기성 W5500 모듈로도 되나요? A. 핀 매핑이 평범한 GPIO이고(Zero는 GPIO2~7에 SCK/MOSI/MISO/CS/RST/IRQ) 보드별 파일에 정의된 뒤 공통 구현을 include하는 구조이므로, 모듈로 바꾸는 건 구조체 하나를 고치고 보드 파일을 추가하는 일입니다. 커스텀 보드는 펌웨어가 요구해서가 아니라 이더넷 프론트엔드를 같은 PCB에 올리기 위해 존재합니다.
Q. 디버그 프로브에 칩 리셋 라인이 왜 필요한가요? A. 오래 무인으로 돌 수 있기 때문입니다. 이더넷 컨트롤러가 멈추는 일이 생기면, RST를 걸 수 있는 펌웨어는 누가 걸어가서 보드를 뽑지 않고 복구합니다 — 네트워크 프로브가 존재하는 이유가 바로 그 상황을 피하는 것이니까요.
Original Link: https://github.com/mean00/swindle