Skip to content

Add experimental ESP32-C3 support - #7

Draft
okhsunrog wants to merge 1 commit into
esp32-open-mac:mainfrom
okhsunrog:esp32c3
Draft

okhsunrog wants to merge 1 commit into
esp32-open-mac:mainfrom
okhsunrog:esp32c3

Conversation

@okhsunrog

Copy link
Copy Markdown

This wires the ESP32-C3 through FoA on top of esp32-open-mac/esp-wifi-hal#22. No chip-specific code was needed in FoA itself: every difference between the S2 and the C3 lives in esp-wifi-hal, so this is only feature plumbing, a linker flag and the [patch.crates-io] entries that point at the esp-wifi-hal and esp-pacs commits carrying the C3 support (esp-rs/esp-pacs#510 rebased onto the 0.32.3 release). Opened as a draft until those land and get released; the patch section goes away then.

  • esp32c3 feature in foa, foa_sta, foa_awdl and the examples
  • examples/.cargo/config.toml: a riscv32imc-unknown-none-elf rustflags override, because rust-lld rejects the -nostartfiles flag from the workspace config that the Xtensa targets need
  • Cargo.toml: git patches for esp-wifi-hal and the esp32c3 PAC

Testing. sta_single built with --features esp32c3 on an ESP32-C3 board connects to a WPA2 network: scan, authentication, association, the full 4-way handshake and CCMP through the hardware key slots, then a DHCP lease from an OpenWrt router (the handshake and lease are visible in hostapd and dnsmasq logs) and the board answers pings. DNS and outbound traffic were checked as well. Note that boards whose only serial path is the USB-JTAG bridge need esp-println's jtag-serial feature to see the log; the examples keep the uart default, so I did not change that here.

How the port was done. The register map, the driver changes and the hardware verification are described in esp32-open-mac/esp-wifi-hal#22: MMIO reference diffing of the S2 and C3 blobs in Ghidra, targeted decompilation for bit layouts, runtime register dumps against esp-radio for the remaining init bits, and a three-node RF test bench (C3, a laptop in monitor mode, a router as a second monitor). The work was carried out with Claude Fable 5.1 (Anthropic) running in Claude Code under my direction; the model did the analysis, wrote the code and ran the hardware loop, I chose the targets, supplied the setup, reviewed every change and decided what to upstream.

Wires the esp32c3 feature through foa, foa_sta, foa_awdl and the examples,
and patches esp-wifi-hal and the esp32c3 PAC to the git commits carrying
the C3 support. No chip-specific code was needed in FoA itself; all the
differences live in esp-wifi-hal.

The examples need a riscv rustflags override so rust-lld does not get the
-nostartfiles flag from the workspace config.

Verified end to end on hardware: sta_single connects to a WPA2 network
(scan, auth, assoc, full 4-way handshake, CCMP), gets a DHCP lease,
resolves DNS and reaches the internet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant