From d2a73229788c8776f822cfe9c6cac7c96d660cbd Mon Sep 17 00:00:00 2001 From: Badr Bouslikhin Date: Tue, 5 Dec 2023 19:48:03 +0100 Subject: [PATCH 1/2] stm32/eth: fix h7 examples The STM32H7 examples enable `dhcpv4` and `dns` features. Both use one socket, meaning that we need one extra socket for our firmware tcp socket. --- examples/stm32h7/src/bin/eth.rs | 2 +- examples/stm32h7/src/bin/eth_client.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/stm32h7/src/bin/eth.rs b/examples/stm32h7/src/bin/eth.rs index b7a077374..030c961eb 100644 --- a/examples/stm32h7/src/bin/eth.rs +++ b/examples/stm32h7/src/bin/eth.rs @@ -92,7 +92,7 @@ async fn main(spawner: Spawner) -> ! { let stack = &*make_static!(Stack::new( device, config, - make_static!(StackResources::<2>::new()), + make_static!(StackResources::<3>::new()), seed )); diff --git a/examples/stm32h7/src/bin/eth_client.rs b/examples/stm32h7/src/bin/eth_client.rs index f0f28ec9c..c6b8243e5 100644 --- a/examples/stm32h7/src/bin/eth_client.rs +++ b/examples/stm32h7/src/bin/eth_client.rs @@ -93,7 +93,7 @@ async fn main(spawner: Spawner) -> ! { let stack = &*make_static!(Stack::new( device, config, - make_static!(StackResources::<2>::new()), + make_static!(StackResources::<3>::new()), seed )); From 0ffb35a2a14c5c033ca4376b329d347df1e3c6bf Mon Sep 17 00:00:00 2001 From: Badr Bouslikhin Date: Tue, 5 Dec 2023 19:50:11 +0100 Subject: [PATCH 2/2] stm32/eth: add host server command example --- examples/stm32h7/src/bin/eth.rs | 1 + examples/stm32h7/src/bin/eth_client.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/examples/stm32h7/src/bin/eth.rs b/examples/stm32h7/src/bin/eth.rs index 030c961eb..dbddfc22f 100644 --- a/examples/stm32h7/src/bin/eth.rs +++ b/examples/stm32h7/src/bin/eth.rs @@ -113,6 +113,7 @@ async fn main(spawner: Spawner) -> ! { socket.set_timeout(Some(embassy_time::Duration::from_secs(10))); + // You need to start a server on the host machine, for example: `nc -l 8000` let remote_endpoint = (Ipv4Address::new(10, 42, 0, 1), 8000); info!("connecting..."); let r = socket.connect(remote_endpoint).await; diff --git a/examples/stm32h7/src/bin/eth_client.rs b/examples/stm32h7/src/bin/eth_client.rs index c6b8243e5..17e1d9fb7 100644 --- a/examples/stm32h7/src/bin/eth_client.rs +++ b/examples/stm32h7/src/bin/eth_client.rs @@ -109,6 +109,7 @@ async fn main(spawner: Spawner) -> ! { let client = TcpClient::new(&stack, &state); loop { + // You need to start a server on the host machine, for example: `nc -l 8000` let addr = SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::new(10, 42, 0, 1), 8000)); info!("connecting...");