diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-06-29 19:51:16 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2023-06-29 19:55:32 +0200 |
| commit | 6eac49186d5a5da4c310027e59adcd0bf44ae514 (patch) | |
| tree | 3cbd9c15c68c7ee3859a17ec6d6fc7150e569686 /embassy-net/README.md | |
| parent | 4feabb13bfbda46de74be09566118adc1ba49d5d (diff) | |
Release embassy-net v0.1
Diffstat (limited to 'embassy-net/README.md')
| -rw-r--r-- | embassy-net/README.md | 64 |
1 files changed, 45 insertions, 19 deletions
diff --git a/embassy-net/README.md b/embassy-net/README.md index 470926c58..48f9fd832 100644 --- a/embassy-net/README.md +++ b/embassy-net/README.md | |||
| @@ -1,30 +1,56 @@ | |||
| 1 | # embassy-net | 1 | # embassy-net |
| 2 | 2 | ||
| 3 | embassy-net contains an async network API based on smoltcp and embassy, designed | 3 | `embassy-net` is a no-std no-alloc async network stack, designed for embedded systems. |
| 4 | for embedded systems. | ||
| 5 | 4 | ||
| 6 | ## Running the example | 5 | It builds on [`smoltcp`](https://github.com/smoltcp-rs/smoltcp). It provides a higher-level and more opinionated |
| 6 | API. It glues together the components provided by `smoltcp`, handling the low-level details with defaults and | ||
| 7 | memory management designed to work well for embedded systems, aiiming for a more "Just Works" experience. | ||
| 7 | 8 | ||
| 8 | First, create the tap0 interface. You only need to do this once. | 9 | ## Features |
| 9 | 10 | ||
| 10 | ```sh | 11 | - IPv4, IPv6 |
| 11 | sudo ip tuntap add name tap0 mode tap user $USER | 12 | - Ethernet and bare-IP mediums. |
| 12 | sudo ip link set tap0 up | 13 | - TCP, UDP, DNS, DHCPv4, IGMPv4 |
| 13 | sudo ip addr add 192.168.69.100/24 dev tap0 | 14 | - TCP sockets implement the `embedded-io` async traits. |
| 14 | sudo ip -6 addr add fe80::100/64 dev tap0 | ||
| 15 | sudo ip -6 addr add fdaa::100/64 dev tap0 | ||
| 16 | sudo ip -6 route add fe80::/64 dev tap0 | ||
| 17 | sudo ip -6 route add fdaa::/64 dev tap0 | ||
| 18 | ``` | ||
| 19 | 15 | ||
| 20 | Second, have something listening there. For example `nc -l 8000` | 16 | See the [`smoltcp`](https://github.com/smoltcp-rs/smoltcp) README for a detailed list of implemented and |
| 17 | unimplemented features of the network protocols. | ||
| 21 | 18 | ||
| 22 | Then run the example located in the `examples` folder: | 19 | ## Hardware support |
| 23 | 20 | ||
| 24 | ```sh | 21 | - [`esp-wifi`](https://github.com/esp-rs/esp-wifi) for WiFi support on bare-metal ESP32 chips. Maintained by Espressif. |
| 25 | cd $EMBASSY_ROOT/examples/std/ | 22 | - [`cyw43`](https://github.com/embassy-rs/embassy/tree/main/cyw43) for WiFi on CYW43xx chips, used in the Raspberry Pi Pico W |
| 26 | cargo run --bin net -- --static-ip | 23 | - [`embassy-usb`](https://github.com/embassy-rs/embassy/tree/main/embassy-usb) for Ethernet-over-USB (CDC NCM) support. |
| 27 | ``` | 24 | - [`embassy-stm32`](https://github.com/embassy-rs/embassy/tree/main/embassy-stm32) for the builtin Ethernet MAC in all STM32 chips (STM32F1, STM32F2, STM32F4, STM32F7, STM32H7, STM32H5). |
| 25 | - [`embassy-net-w5500`](https://github.com/embassy-rs/embassy/tree/main/embassy-net-w5500) for Wiznet W5500 SPI Ethernet MAC+PHY chip. | ||
| 26 | - [`embassy-net-esp-hosted`](https://github.com/embassy-rs/embassy/tree/main/embassy-net-esp-hosted) for using ESP32 chips with the [`esp-hosted`](https://github.com/espressif/esp-hosted) firmware as WiFi adapters for another non-ESP32 MCU. | ||
| 27 | |||
| 28 | ## Examples | ||
| 29 | |||
| 30 | - For usage with Embassy HALs and network chip drivers, search [here](https://github.com/embassy-rs/embassy/tree/main/examples) for `eth` or `wifi`. | ||
| 31 | - The [`esp-wifi` repo](https://github.com/esp-rs/esp-wifi) has examples for use on bare-metal ESP32 chips. | ||
| 32 | - For usage on `std` platforms, see [the `std` examples](https://github.com/embassy-rs/embassy/tree/main/examples/std/src/bin) | ||
| 33 | |||
| 34 | ## Adding support for new hardware | ||
| 35 | |||
| 36 | To add `embassy-net` support for new hardware (i.e. a new Ethernet or WiFi chip, or | ||
| 37 | an Ethernet/WiFi MCU peripheral), you have to implement the [`embassy-net-driver`](https://crates.io/crates/embassy-net-driver) | ||
| 38 | traits. | ||
| 39 | |||
| 40 | Alternatively, [`embassy-net-driver-channel`](https://crates.io/crates/embassy-net-driver-channel) provides a higer-level API | ||
| 41 | to construct a driver that processes packets in its own background task and communicates with the `embassy-net` task via | ||
| 42 | packet queues for RX and TX. | ||
| 43 | |||
| 44 | Drivers should depend only on `embassy-net-driver` or `embassy-net-driver-channel`. Never on the main `embassy-net` crate. | ||
| 45 | This allows existing drivers to continue working for newer `embassy-net` major versions, without needing an update, if the driver | ||
| 46 | trait has not had breaking changes. | ||
| 47 | |||
| 48 | ## Interoperability | ||
| 49 | |||
| 50 | This crate can run on any executor. | ||
| 51 | |||
| 52 | [`embassy-time`](https://crates.io/crates/embassy-net-driver) is used for timekeeping and timeouts. You must | ||
| 53 | link an `embassy-time` driver in your project to use this crate. | ||
| 28 | 54 | ||
| 29 | ## License | 55 | ## License |
| 30 | 56 | ||
