aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2023-05-31 00:54:20 +0200
committerDario Nieuwenhuis <[email protected]>2023-05-31 00:54:20 +0200
commit7f0e778145e7a0f7281d9b37e59473fddf232097 (patch)
treee4f70ef398807f1524301fec6e6fae121b05d5aa /examples
parent6c1137177f92f9a5c5cd9c2a0450b5db5165f8be (diff)
move embassy-net-w5500 to subdir.
Diffstat (limited to 'examples')
-rw-r--r--examples/.cargo/config.toml8
-rw-r--r--examples/Cargo.toml70
-rw-r--r--examples/README.md33
-rw-r--r--examples/build.rs36
-rw-r--r--examples/memory.x5
-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"))']
2runner = "probe-rs-cli run --chip RP2040"
3
4[build]
5target = "thumbv6m-none-eabi"
6
7[env]
8DEFMT_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]
2name = "embassy-net-w5500-examples"
3version = "0.1.0"
4edition = "2021"
5
6[dependencies]
7embassy-executor = { version = "0.2.0", features = ["defmt", "integrated-timers", "executor-thread", "arch-cortex-m"] }
8embassy-time = { version = "0.1.0", features = ["defmt", "defmt-timestamp-uptime"] }
9embassy-rp = { version = "0.1.0", features = ["defmt", "unstable-traits", "nightly", "unstable-pac", "time-driver"] }
10embassy-net = { version = "0.1.0", features = ["defmt", "tcp", "udp", "dhcpv4", "medium-ethernet", "unstable-traits", "nightly"] }
11embassy-sync = { version = "0.1.0" }
12embassy-futures = { version = "0.1.0" }
13embassy-net-driver = { version = "0.1.0" }
14embassy-net-driver-channel = { version = "0.1.0" }
15atomic-polyfill = "0.1.5"
16static_cell = "1.0"
17
18defmt = "=0.3.2"
19defmt-rtt = "0.3"
20panic-probe = { version = "0.3", features = ["print-defmt"] }
21cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
22cortex-m-rt = "0.7.0"
23
24embedded-io = { version = "0.4.0", features = ["async", "defmt"] }
25heapless = "0.7.15"
26embedded-hal = { version = "1.0.0-alpha.10" }
27embedded-hal-async = { version = "=0.2.0-alpha.1" }
28rand = { version = "0.8.5", default-features = false }
29
30embassy-net-w5500 = { path = "../" }
31
32[patch.crates-io]
33embassy-executor = { git = "https://github.com/embassy-rs/embassy", rev = "e179e7cf85810f0aa7ef8027d8d48f6d21f64dac" }
34embassy-time = { git = "https://github.com/embassy-rs/embassy", rev = "e179e7cf85810f0aa7ef8027d8d48f6d21f64dac" }
35embassy-futures = { git = "https://github.com/embassy-rs/embassy", rev = "e179e7cf85810f0aa7ef8027d8d48f6d21f64dac" }
36embassy-sync = { git = "https://github.com/embassy-rs/embassy", rev = "e179e7cf85810f0aa7ef8027d8d48f6d21f64dac" }
37embassy-rp = { git = "https://github.com/embassy-rs/embassy", rev = "e179e7cf85810f0aa7ef8027d8d48f6d21f64dac" }
38embassy-net = { git = "https://github.com/embassy-rs/embassy", rev = "e179e7cf85810f0aa7ef8027d8d48f6d21f64dac" }
39embassy-net-driver = { git = "https://github.com/embassy-rs/embassy", rev = "e179e7cf85810f0aa7ef8027d8d48f6d21f64dac" }
40embassy-net-driver-channel = { git = "https://github.com/embassy-rs/embassy", rev = "e179e7cf85810f0aa7ef8027d8d48f6d21f64dac" }
41
42[profile.dev]
43debug = 2
44debug-assertions = true
45opt-level = 1
46overflow-checks = true
47
48[profile.release]
49codegen-units = 1
50debug = 1
51debug-assertions = false
52incremental = false
53lto = 'fat'
54opt-level = 'z'
55overflow-checks = false
56
57# do not optimize proc-macro crates = faster builds from scratch
58[profile.dev.build-override]
59codegen-units = 8
60debug = false
61debug-assertions = false
62opt-level = 0
63overflow-checks = false
64
65[profile.release.build-override]
66codegen-units = 8
67debug = false
68debug-assertions = false
69opt-level = 0
70overflow-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
3Examples are written for the [`WIZnet W5500-EVB-Pico`](https://www.wiznet.io/product-item/w5500-evb-pico/) board.
4
5## Prerequisites
6```bash
7cargo install probe-rs-cli
8```
9
10## TCP server example
11```bash
12cargo run --bin tcp-server --release
13```
14This example implements a TCP echo server on port 1234 and using DHCP.
15Send it some data, you should see it echoed back and printed in the console.
16
17## Multi-socket example
18```bash
19cargo run --bin multisocket --release
20```
21This 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
25cargo run --bin tcp-client --release
26```
27This 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
31cargo run --bin udp --release
32```
33This 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
11use std::env;
12use std::fs::File;
13use std::io::Write;
14use std::path::PathBuf;
15
16fn 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 @@
1MEMORY {
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)]