Skip to content

Commit

Permalink
Update smoltcp to 0.12.0 and embassy-net to 0.5.0 (#2849)
Browse files Browse the repository at this point in the history
* chore: Update smoltcp to `0.12.0` and embassy-net to `0.5.0`

* Add CHANGELOG entry

* Remove `wifi_dhcp_smoltcp_nal.rs` example

`smoltcp-nal`, a core dependency on which this example depends on doesn't receive the desired amount of maintainability needed to keep up to date with new dependencies releases.
  • Loading branch information
AnthonyGrondin authored Jan 2, 2025
1 parent 36095e4 commit 0f38499
Show file tree
Hide file tree
Showing 13 changed files with 96 additions and 319 deletions.
1 change: 1 addition & 0 deletions esp-wifi/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- Bump MSRV to 1.83 (#2615)
- Bump smoltcp to 0.12.0 (#2849)

### Fixed

Expand Down
2 changes: 1 addition & 1 deletion esp-wifi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ log = { version = "0.4.22", optional = true }
document-features = "0.2.10"
esp-alloc = { version = "0.5.0", path = "../esp-alloc", optional = true }
esp-hal = { version = "0.22.0", path = "../esp-hal", default-features = false }
smoltcp = { version = "0.11.0", default-features = false, features = [
smoltcp = { version = "0.12.0", default-features = false, features = [
"medium-ethernet",
"socket-raw",
], optional = true }
Expand Down
4 changes: 2 additions & 2 deletions esp-wifi/src/wifi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2686,9 +2686,9 @@ impl<Dm: Sealed> WifiRxToken<Dm> {
impl<Dm: Sealed> RxToken for WifiRxToken<Dm> {
fn consume<R, F>(self, f: F) -> R
where
F: FnOnce(&mut [u8]) -> R,
F: FnOnce(&[u8]) -> R,
{
self.consume_token(f)
self.consume_token(|t| f(t))
}
}

Expand Down
12 changes: 8 additions & 4 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ publish = false
[dependencies]
aligned = { version = "0.4.2", optional = true }
bleps = { git = "https://github.com/bjoernQ/bleps", package = "bleps", rev = "a5148d8ae679e021b78f53fd33afb8bb35d0b62e", features = [ "macros", "async"] }
blocking-network-stack = { git = "https://github.com/bjoernQ/blocking-network-stack.git", rev = "1c581661d78e0cf0f17b936297179b993fb149d7" }
blocking-network-stack = { git = "https://github.com/bjoernQ/blocking-network-stack.git", rev = "b3ecefc222d8806edd221f266999ca339c52d34e" }
bt-hci = "0.1.1"
cfg-if = "1.0.0"
critical-section = "1.1.3"
embassy-executor = { version = "0.6.0", features = ["task-arena-size-20480"] }
embassy-futures = "0.1.1"
embassy-net = { version = "0.4.0", features = [ "tcp", "udp", "dhcpv4", "medium-ethernet"] }
embassy-net = { version = "0.5.0", features = [ "tcp", "udp", "dhcpv4", "medium-ethernet"] }
embassy-sync = "0.6.0"
embassy-time = "0.3.2"
embassy-usb = { version = "0.2.0", default-features = false }
Expand All @@ -40,8 +40,7 @@ log = "0.4.22"
nb = "1.1.0"
portable-atomic = { version = "1.9.0", default-features = false }
sha2 = { version = "0.10.8", default-features = false }
smoltcp = { version = "0.11.0", default-features = false, features = [ "medium-ethernet", "socket-raw"] }
smoltcp-nal = "0.5.1"
smoltcp = { version = "0.12.0", default-features = false, features = [ "medium-ethernet", "socket-raw"] }
embedded-time = "=0.12.1"
static_cell = { version = "2.1.0", features = ["nightly"] }
trouble-host = { git = "https://github.com/embassy-rs/trouble", package = "trouble-host", rev = "4f1114ce58e96fe54f5ed7e726f66e1ad8d9ce54", features = [ "log", "gatt" ] }
Expand Down Expand Up @@ -74,3 +73,8 @@ incremental = false
opt-level = 3
lto = 'fat'
overflow-checks = false

[patch.crates-io]
# Patch until https://github.com/ivmarkov/edge-net/pull/50 is merged
edge-nal = { git = "https://github.com/ivmarkov/edge-net", rev = "5a85bcc8b8726e8b7044e9526f01cdba1fd684da"}
edge-nal-embassy = { git = "https://github.com/ivmarkov/edge-net", rev = "5a85bcc8b8726e8b7044e9526f01cdba1fd684da"}
6 changes: 4 additions & 2 deletions examples/src/bin/wifi_access_point_with_sta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#![no_std]
#![no_main]

use core::net::Ipv4Addr;

use blocking_network_stack::Stack;
use embedded_io::*;
use esp_alloc as _;
Expand All @@ -38,7 +40,7 @@ use esp_wifi::{
};
use smoltcp::{
iface::{SocketSet, SocketStorage},
wire::{IpAddress, Ipv4Address},
wire::IpAddress,
};

const SSID: &str = env!("SSID");
Expand Down Expand Up @@ -183,7 +185,7 @@ fn main() -> ! {
sta_socket.work();

sta_socket
.open(IpAddress::Ipv4(Ipv4Address::new(142, 250, 185, 115)), 80)
.open(IpAddress::Ipv4(Ipv4Addr::new(142, 250, 185, 115)), 80)
.unwrap();

sta_socket
Expand Down
12 changes: 7 additions & 5 deletions examples/src/bin/wifi_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#![no_std]
#![no_main]

use core::net::Ipv4Addr;

use blocking_network_stack::Stack;
use embedded_io::*;
use esp_alloc as _;
Expand All @@ -40,7 +42,7 @@ use esp_wifi::{
};
use smoltcp::{
iface::{SocketSet, SocketStorage},
wire::{DhcpOption, IpAddress, Ipv4Address},
wire::{DhcpOption, IpAddress},
};

const SSID: &str = env!("SSID");
Expand All @@ -63,7 +65,7 @@ fn main() -> ! {

esp_alloc::heap_allocator!(72 * 1024);

let server_address: Ipv4Address = HOST_IP.parse().expect("Invalid HOST_IP address");
let server_address: Ipv4Addr = HOST_IP.parse().expect("Invalid HOST_IP address");

let timg0 = TimerGroup::new(peripherals.TIMG0);

Expand Down Expand Up @@ -155,7 +157,7 @@ fn main() -> ! {
}

fn test_download<'a, D: smoltcp::phy::Device>(
server_address: Ipv4Address,
server_address: Ipv4Addr,
socket: &mut blocking_network_stack::Socket<'a, 'a, D>,
) {
println!("Testing download...");
Expand Down Expand Up @@ -189,7 +191,7 @@ fn test_download<'a, D: smoltcp::phy::Device>(
}

fn test_upload<'a, D: smoltcp::phy::Device>(
server_address: Ipv4Address,
server_address: Ipv4Addr,
socket: &mut blocking_network_stack::Socket<'a, 'a, D>,
) {
println!("Testing upload...");
Expand Down Expand Up @@ -223,7 +225,7 @@ fn test_upload<'a, D: smoltcp::phy::Device>(
}

fn test_upload_download<'a, D: smoltcp::phy::Device>(
server_address: Ipv4Address,
server_address: Ipv4Addr,
socket: &mut blocking_network_stack::Socket<'a, 'a, D>,
) {
println!("Testing upload+download...");
Expand Down
6 changes: 4 additions & 2 deletions examples/src/bin/wifi_coex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#![no_std]
#![no_main]

use core::net::Ipv4Addr;

use bleps::{
ad_structure::{
create_advertising_data,
Expand Down Expand Up @@ -45,7 +47,7 @@ use esp_wifi::{
};
use smoltcp::{
iface::{SocketSet, SocketStorage},
wire::{DhcpOption, IpAddress, Ipv4Address},
wire::{DhcpOption, IpAddress},
};

const SSID: &str = env!("SSID");
Expand Down Expand Up @@ -172,7 +174,7 @@ fn main() -> ! {
socket.work();

socket
.open(IpAddress::Ipv4(Ipv4Address::new(142, 250, 185, 115)), 80)
.open(IpAddress::Ipv4(Ipv4Addr::new(142, 250, 185, 115)), 80)
.unwrap();

socket
Expand Down
5 changes: 3 additions & 2 deletions examples/src/bin/wifi_dhcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#![no_main]

extern crate alloc;
use core::net::Ipv4Addr;

use blocking_network_stack::Stack;
use embedded_io::*;
Expand All @@ -39,7 +40,7 @@ use esp_wifi::{
};
use smoltcp::{
iface::{SocketSet, SocketStorage},
wire::{DhcpOption, IpAddress, Ipv4Address},
wire::{DhcpOption, IpAddress},
};

const SSID: &str = env!("SSID");
Expand Down Expand Up @@ -134,7 +135,7 @@ fn main() -> ! {
socket.work();

socket
.open(IpAddress::Ipv4(Ipv4Address::new(142, 250, 185, 115)), 80)
.open(IpAddress::Ipv4(Ipv4Addr::new(142, 250, 185, 115)), 80)
.unwrap();

socket
Expand Down
Loading

0 comments on commit 0f38499

Please sign in to comment.