diff options
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/.cargo/config.toml | 8 | ||||
| -rw-r--r-- | examples/Cargo.toml | 70 | ||||
| -rw-r--r-- | examples/README.md | 33 | ||||
| -rw-r--r-- | examples/build.rs | 36 | ||||
| -rw-r--r-- | examples/memory.x | 5 | ||||
| -rw-r--r-- | examples/rp/src/bin/ethernet_w5500_multisocket.rs (renamed from examples/src/bin/multisocket.rs) | 4 | ||||
| -rw-r--r-- | examples/rp/src/bin/ethernet_w5500_tcp_client.rs (renamed from examples/src/bin/tcp-client.rs) | 4 | ||||
| -rw-r--r-- | examples/rp/src/bin/ethernet_w5500_tcp_server.rs (renamed from examples/src/bin/tcp-server.rs) | 5 | ||||
| -rw-r--r-- | examples/rp/src/bin/ethernet_w5500_udp.rs (renamed from examples/src/bin/udp.rs) | 4 |
9 files changed, 17 insertions, 152 deletions
diff --git a/examples/.cargo/config.toml b/examples/.cargo/config.toml deleted file mode 100644 index e6b6b4a41..000000000 --- a/examples/.cargo/config.toml +++ /dev/null | |||
| @@ -1,8 +0,0 @@ | |||
| 1 | [target.'cfg(all(target_arch = "arm", target_os = "none"))'] | ||
| 2 | runner = "probe-rs-cli run --chip RP2040" | ||
| 3 | |||
| 4 | [build] | ||
| 5 | target = "thumbv6m-none-eabi" | ||
| 6 | |||
| 7 | [env] | ||
| 8 | DEFMT_LOG = "info" | ||
diff --git a/examples/Cargo.toml b/examples/Cargo.toml deleted file mode 100644 index 46659c2bc..000000000 --- a/examples/Cargo.toml +++ /dev/null | |||
| @@ -1,70 +0,0 @@ | |||
| 1 | [package] | ||
| 2 | name = "embassy-net-w5500-examples" | ||
| 3 | version = "0.1.0" | ||
| 4 | edition = "2021" | ||
| 5 | |||
| 6 | [dependencies] | ||
| 7 | embassy-executor = { version = "0.2.0", features = ["defmt", "integrated-timers", "executor-thread", "arch-cortex-m"] } | ||
| 8 | embassy-time = { version = "0.1.0", features = ["defmt", "defmt-timestamp-uptime"] } | ||
| 9 | embassy-rp = { version = "0.1.0", features = ["defmt", "unstable-traits", "nightly", "unstable-pac", "time-driver"] } | ||
| 10 | embassy-net = { version = "0.1.0", features = ["defmt", "tcp", "udp", "dhcpv4", "medium-ethernet", "unstable-traits", "nightly"] } | ||
| 11 | embassy-sync = { version = "0.1.0" } | ||
| 12 | embassy-futures = { version = "0.1.0" } | ||
| 13 | embassy-net-driver = { version = "0.1.0" } | ||
| 14 | embassy-net-driver-channel = { version = "0.1.0" } | ||
| 15 | atomic-polyfill = "0.1.5" | ||
| 16 | static_cell = "1.0" | ||
| 17 | |||
| 18 | defmt = "=0.3.2" | ||
| 19 | defmt-rtt = "0.3" | ||
| 20 | panic-probe = { version = "0.3", features = ["print-defmt"] } | ||
| 21 | cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } | ||
| 22 | cortex-m-rt = "0.7.0" | ||
| 23 | |||
| 24 | embedded-io = { version = "0.4.0", features = ["async", "defmt"] } | ||
| 25 | heapless = "0.7.15" | ||
| 26 | embedded-hal = { version = "1.0.0-alpha.10" } | ||
| 27 | embedded-hal-async = { version = "=0.2.0-alpha.1" } | ||
| 28 | rand = { version = "0.8.5", default-features = false } | ||
| 29 | |||
| 30 | embassy-net-w5500 = { path = "../" } | ||
| 31 | |||
| 32 | [patch.crates-io] | ||
| 33 | embassy-executor = { git = "https://github.com/embassy-rs/embassy", rev = "e179e7cf85810f0aa7ef8027d8d48f6d21f64dac" } | ||
| 34 | embassy-time = { git = "https://github.com/embassy-rs/embassy", rev = "e179e7cf85810f0aa7ef8027d8d48f6d21f64dac" } | ||
| 35 | embassy-futures = { git = "https://github.com/embassy-rs/embassy", rev = "e179e7cf85810f0aa7ef8027d8d48f6d21f64dac" } | ||
| 36 | embassy-sync = { git = "https://github.com/embassy-rs/embassy", rev = "e179e7cf85810f0aa7ef8027d8d48f6d21f64dac" } | ||
| 37 | embassy-rp = { git = "https://github.com/embassy-rs/embassy", rev = "e179e7cf85810f0aa7ef8027d8d48f6d21f64dac" } | ||
| 38 | embassy-net = { git = "https://github.com/embassy-rs/embassy", rev = "e179e7cf85810f0aa7ef8027d8d48f6d21f64dac" } | ||
| 39 | embassy-net-driver = { git = "https://github.com/embassy-rs/embassy", rev = "e179e7cf85810f0aa7ef8027d8d48f6d21f64dac" } | ||
| 40 | embassy-net-driver-channel = { git = "https://github.com/embassy-rs/embassy", rev = "e179e7cf85810f0aa7ef8027d8d48f6d21f64dac" } | ||
| 41 | |||
| 42 | [profile.dev] | ||
| 43 | debug = 2 | ||
| 44 | debug-assertions = true | ||
| 45 | opt-level = 1 | ||
| 46 | overflow-checks = true | ||
| 47 | |||
| 48 | [profile.release] | ||
| 49 | codegen-units = 1 | ||
| 50 | debug = 1 | ||
| 51 | debug-assertions = false | ||
| 52 | incremental = false | ||
| 53 | lto = 'fat' | ||
| 54 | opt-level = 'z' | ||
| 55 | overflow-checks = false | ||
| 56 | |||
| 57 | # do not optimize proc-macro crates = faster builds from scratch | ||
| 58 | [profile.dev.build-override] | ||
| 59 | codegen-units = 8 | ||
| 60 | debug = false | ||
| 61 | debug-assertions = false | ||
| 62 | opt-level = 0 | ||
| 63 | overflow-checks = false | ||
| 64 | |||
| 65 | [profile.release.build-override] | ||
| 66 | codegen-units = 8 | ||
| 67 | debug = false | ||
| 68 | debug-assertions = false | ||
| 69 | opt-level = 0 | ||
| 70 | overflow-checks = false | ||
diff --git a/examples/README.md b/examples/README.md deleted file mode 100644 index d818c4a89..000000000 --- a/examples/README.md +++ /dev/null | |||
| @@ -1,33 +0,0 @@ | |||
| 1 | # Examples for the rp2040 `WIZnet W5500-EVB-Pico` board | ||
| 2 | |||
| 3 | Examples are written for the [`WIZnet W5500-EVB-Pico`](https://www.wiznet.io/product-item/w5500-evb-pico/) board. | ||
| 4 | |||
| 5 | ## Prerequisites | ||
| 6 | ```bash | ||
| 7 | cargo install probe-rs-cli | ||
| 8 | ``` | ||
| 9 | |||
| 10 | ## TCP server example | ||
| 11 | ```bash | ||
| 12 | cargo run --bin tcp-server --release | ||
| 13 | ``` | ||
| 14 | This example implements a TCP echo server on port 1234 and using DHCP. | ||
| 15 | Send it some data, you should see it echoed back and printed in the console. | ||
| 16 | |||
| 17 | ## Multi-socket example | ||
| 18 | ```bash | ||
| 19 | cargo run --bin multisocket --release | ||
| 20 | ``` | ||
| 21 | This example shows how you can allow multiple simultaneous TCP connections, by having multiple sockets listening on the same port. | ||
| 22 | |||
| 23 | ## TCP client example | ||
| 24 | ```bash | ||
| 25 | cargo run --bin tcp-client --release | ||
| 26 | ``` | ||
| 27 | This example implements a TCP client that attempts to connect to a host on port 1234 and send it some data once per second. | ||
| 28 | |||
| 29 | ## UDP server example | ||
| 30 | ```bash | ||
| 31 | cargo run --bin udp --release | ||
| 32 | ``` | ||
| 33 | This example implements a UDP server listening on port 1234 and echoing back the data. | ||
diff --git a/examples/build.rs b/examples/build.rs deleted file mode 100644 index 3f915f931..000000000 --- a/examples/build.rs +++ /dev/null | |||
| @@ -1,36 +0,0 @@ | |||
| 1 | //! This build script copies the `memory.x` file from the crate root into | ||
| 2 | //! a directory where the linker can always find it at build time. | ||
| 3 | //! For many projects this is optional, as the linker always searches the | ||
| 4 | //! project root directory -- wherever `Cargo.toml` is. However, if you | ||
| 5 | //! are using a workspace or have a more complicated build setup, this | ||
| 6 | //! build script becomes required. Additionally, by requesting that | ||
| 7 | //! Cargo re-run the build script whenever `memory.x` is changed, | ||
| 8 | //! updating `memory.x` ensures a rebuild of the application with the | ||
| 9 | //! new memory settings. | ||
| 10 | |||
| 11 | use std::env; | ||
| 12 | use std::fs::File; | ||
| 13 | use std::io::Write; | ||
| 14 | use std::path::PathBuf; | ||
| 15 | |||
| 16 | fn main() { | ||
| 17 | // Put `memory.x` in our output directory and ensure it's | ||
| 18 | // on the linker search path. | ||
| 19 | let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap()); | ||
| 20 | File::create(out.join("memory.x")) | ||
| 21 | .unwrap() | ||
| 22 | .write_all(include_bytes!("memory.x")) | ||
| 23 | .unwrap(); | ||
| 24 | println!("cargo:rustc-link-search={}", out.display()); | ||
| 25 | |||
| 26 | // By default, Cargo will re-run a build script whenever | ||
| 27 | // any file in the project changes. By specifying `memory.x` | ||
| 28 | // here, we ensure the build script is only re-run when | ||
| 29 | // `memory.x` is changed. | ||
| 30 | println!("cargo:rerun-if-changed=memory.x"); | ||
| 31 | |||
| 32 | println!("cargo:rustc-link-arg-bins=--nmagic"); | ||
| 33 | println!("cargo:rustc-link-arg-bins=-Tlink.x"); | ||
| 34 | println!("cargo:rustc-link-arg-bins=-Tlink-rp.x"); | ||
| 35 | println!("cargo:rustc-link-arg-bins=-Tdefmt.x"); | ||
| 36 | } | ||
diff --git a/examples/memory.x b/examples/memory.x deleted file mode 100644 index eb8c1731d..000000000 --- a/examples/memory.x +++ /dev/null | |||
| @@ -1,5 +0,0 @@ | |||
| 1 | MEMORY { | ||
| 2 | BOOT2 : ORIGIN = 0x10000000, LENGTH = 0x100 | ||
| 3 | FLASH : ORIGIN = 0x10000100, LENGTH = 1024K - 0x100 | ||
| 4 | RAM : ORIGIN = 0x20000000, LENGTH = 256K | ||
| 5 | } \ No newline at end of file | ||
diff --git a/examples/src/bin/multisocket.rs b/examples/rp/src/bin/ethernet_w5500_multisocket.rs index 49bcbdbb0..eb3b8de81 100644 --- a/examples/src/bin/multisocket.rs +++ b/examples/rp/src/bin/ethernet_w5500_multisocket.rs | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | //! This example shows how you can allow multiple simultaneous TCP connections, by having multiple sockets listening on the same port. | ||
| 2 | //! | ||
| 3 | //! Example written for the [`WIZnet W5500-EVB-Pico`](https://www.wiznet.io/product-item/w5500-evb-pico/) board. | ||
| 4 | |||
| 1 | #![no_std] | 5 | #![no_std] |
| 2 | #![no_main] | 6 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | 7 | #![feature(type_alias_impl_trait)] |
diff --git a/examples/src/bin/tcp-client.rs b/examples/rp/src/bin/ethernet_w5500_tcp_client.rs index 32dfb6a68..e166e0f35 100644 --- a/examples/src/bin/tcp-client.rs +++ b/examples/rp/src/bin/ethernet_w5500_tcp_client.rs | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | //! This example implements a TCP client that attempts to connect to a host on port 1234 and send it some data once per second. | ||
| 2 | //! | ||
| 3 | //! Example written for the [`WIZnet W5500-EVB-Pico`](https://www.wiznet.io/product-item/w5500-evb-pico/) board. | ||
| 4 | |||
| 1 | #![no_std] | 5 | #![no_std] |
| 2 | #![no_main] | 6 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | 7 | #![feature(type_alias_impl_trait)] |
diff --git a/examples/src/bin/tcp-server.rs b/examples/rp/src/bin/ethernet_w5500_tcp_server.rs index 04b220146..ffd664d15 100644 --- a/examples/src/bin/tcp-server.rs +++ b/examples/rp/src/bin/ethernet_w5500_tcp_server.rs | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | //! This example implements a TCP echo server on port 1234 and using DHCP. | ||
| 2 | //! Send it some data, you should see it echoed back and printed in the console. | ||
| 3 | //! | ||
| 4 | //! Example written for the [`WIZnet W5500-EVB-Pico`](https://www.wiznet.io/product-item/w5500-evb-pico/) board. | ||
| 5 | |||
| 1 | #![no_std] | 6 | #![no_std] |
| 2 | #![no_main] | 7 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | 8 | #![feature(type_alias_impl_trait)] |
diff --git a/examples/src/bin/udp.rs b/examples/rp/src/bin/ethernet_w5500_udp.rs index 4dc5e1f2f..08ffeb244 100644 --- a/examples/src/bin/udp.rs +++ b/examples/rp/src/bin/ethernet_w5500_udp.rs | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | //! This example implements a UDP server listening on port 1234 and echoing back the data. | ||
| 2 | //! | ||
| 3 | //! Example written for the [`WIZnet W5500-EVB-Pico`](https://www.wiznet.io/product-item/w5500-evb-pico/) board. | ||
| 4 | |||
| 1 | #![no_std] | 5 | #![no_std] |
| 2 | #![no_main] | 6 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | 7 | #![feature(type_alias_impl_trait)] |
