Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
ph-esp32-mac
ph-esp32-mac is a no_std, no_alloc Rust driver for the ESP32 Ethernet MAC (EMAC). It targets ESP32 hardware, provides LAN8720A PHY support, and integrates with smoltcp, embassy-net, and esp-hal.
Table of Contents
- Overview
- Status & Scope
- Motivation
- Goal
- Features
- Supported Hardware
- Quick Start (Happy Path)
- Recommended Workflow
- Examples
- Memory & DMA Sizing
- Feature Flags
- MSRV
- Documentation
- License
Overview
This crate implements the ESP32 EMAC peripheral using static DMA descriptors and buffers. It is designed for embedded use with explicit initialization, no heap allocation, and predictable memory usage. The public API is optimized for esp-hal consumers while keeping low-level control available.
Status & Scope
- Current target: ESP32 (this release only)
- ESP32-P4: Experimental placeholder (not implemented, hidden from docs)
- Happy path: esp-hal synchronous and async bring-up on WT32-ETH01
Motivation
There was no existing bare-metal, no_std, no_alloc Rust driver for the ESP32 MAC, which created a barrier to using wt32_eth01.rs in the bare-metal ecosystem.
Goal
Provide an efficient bare-metal, no_std, no_alloc implementation of the ESP32 MAC to enable use of the LAN8720A Ethernet PHY.
Features
- ESP32 RMII support (MII is available but secondary)
- LAN8720A PHY driver with a generic PHY fallback
- smoltcp integration (
smoltcpfeature) - embassy-net driver integration (
embassy-netfeature) - esp-hal integration helpers (
esp-halfeature) - Async/waker support without allocation (
async+critical-section)
Supported Hardware
- ESP32 (current release target)
- ESP32-P4 (experimental / not implemented yet, hidden from docs)
Quick Start (Happy Path)
These are the recommended esp-hal bring-up paths and match the examples in
apps/examples/.
esp-hal (sync)
use Delay;
use ;
emac_static_sync!;
let mut delay = new;
EMAC.with;
esp-hal (async)
use Delay;
use ;
use ;
emac_static_async!;
emac_async_isr!;
let mut delay = new;
let emac_ptr = EMAC.init as *mut _;
unsafe
Recommended Workflow
From the repo root, use cargo xtask to build and flash apps:
See xtask/README.md for details.
Examples
Examples are provided as a separate crate in this repository and are not packaged with the published library crate. They require the Xtensa toolchain and flashing setup, so they are kept repo-only to avoid pulling those requirements into crates.io consumers.
See apps/examples/README.md for build and run instructions.
Recommended runner (from repo root):
Included examples:
smoltcp_echoesp_hal_integrationesp_hal_asyncembassy_net
Hardware QA runner (separate crate):
- apps/qa-runner/README.md
cargo xtask run qa-runner
Memory & DMA Sizing
Default configuration (10 RX/TX buffers, 1600 bytes each):
| Component | Size |
|---|---|
| RX descriptors | 320 bytes |
| TX descriptors | 320 bytes |
| RX buffers | 16,000 bytes |
| TX buffers | 16,000 bytes |
| Total | ~32 KB |
Adjust via the static macros if memory is constrained:
emac_static_sync!;
Feature Flags
| Feature | Description |
|---|---|
esp32 |
ESP32 target (default) |
esp32p4 |
Experimental placeholder (not implemented) |
smoltcp |
smoltcp integration |
embassy-net |
embassy-net-driver integration |
esp-hal |
esp-hal integration helpers |
critical-section |
Shared/ISR-safe access wrappers |
async |
Async/waker support (requires critical-section) |
defmt |
defmt formatting support |
log |
log crate support |
MSRV
- Rust 1.92.0
Documentation
- docs/README.md (documentation index and TOC)
- CODE_OF_CONDUCT.md
- CONTRIBUTING.md
- SECURITY.md
- CHANGELOG.md
License
Licensed under the Apache License, Version 2.0. See LICENSE.