From 61b1c67d9f039692c1d35f1ab000d3e33b3752c3 Mon Sep 17 00:00:00 2001 From: Martijn Bastiaan Date: Thu, 21 Nov 2024 11:37:42 +0100 Subject: [PATCH] Bump smoltcp See https://github.com/smoltcp-rs/smoltcp/pull/924 --- firmware-binaries/Cargo.lock | 3 +-- firmware-binaries/examples/smoltcp_client/Cargo.toml | 2 +- firmware-support/Cargo.lock | 3 +-- firmware-support/bittide-sys/Cargo.toml | 2 +- firmware-support/bittide-sys/src/smoltcp/axi.rs | 11 ++--------- host-tools/Cargo.lock | 3 +-- 6 files changed, 7 insertions(+), 17 deletions(-) diff --git a/firmware-binaries/Cargo.lock b/firmware-binaries/Cargo.lock index 1baec7c14..7a80c484d 100644 --- a/firmware-binaries/Cargo.lock +++ b/firmware-binaries/Cargo.lock @@ -384,8 +384,7 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "smoltcp" version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a1a996951e50b5971a2c8c0fa05a381480d70a933064245c4a223ddc87ccc97" +source = "git+https://github.com/smoltcp-rs/smoltcp.git?rev=dc08e0b42e668c331bb2b6f8d80016301d0efe03#dc08e0b42e668c331bb2b6f8d80016301d0efe03" dependencies = [ "bitflags", "byteorder", diff --git a/firmware-binaries/examples/smoltcp_client/Cargo.toml b/firmware-binaries/examples/smoltcp_client/Cargo.toml index 20dfdbcbd..a708c1dfb 100644 --- a/firmware-binaries/examples/smoltcp_client/Cargo.toml +++ b/firmware-binaries/examples/smoltcp_client/Cargo.toml @@ -16,6 +16,6 @@ bittide-sys = { path = "../../../firmware-support/bittide-sys" } riscv-rt = "0.11.0" riscv = "^0.10" heapless = { version = "0.8", default-features = false} -smoltcp = { version = "0.11", default-features = false, features = ["medium-ethernet", "proto-ipv4", "socket-tcp", "socket-dhcpv4"] } +smoltcp = { git = "https://github.com/smoltcp-rs/smoltcp.git", rev = "dc08e0b42e668c331bb2b6f8d80016301d0efe03", default-features = false, features = ["medium-ethernet", "proto-ipv4", "socket-tcp", "socket-dhcpv4"] } ufmt = "0.2.0" log = {version = "0.4.21", features = ["max_level_off", "release_max_level_info"]} diff --git a/firmware-support/Cargo.lock b/firmware-support/Cargo.lock index b0e7b59a3..e31b8b01d 100644 --- a/firmware-support/Cargo.lock +++ b/firmware-support/Cargo.lock @@ -391,8 +391,7 @@ dependencies = [ [[package]] name = "smoltcp" version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a1a996951e50b5971a2c8c0fa05a381480d70a933064245c4a223ddc87ccc97" +source = "git+https://github.com/smoltcp-rs/smoltcp.git?rev=dc08e0b42e668c331bb2b6f8d80016301d0efe03#dc08e0b42e668c331bb2b6f8d80016301d0efe03" dependencies = [ "bitflags 1.3.2", "byteorder", diff --git a/firmware-support/bittide-sys/Cargo.toml b/firmware-support/bittide-sys/Cargo.toml index 28c1d323c..34793647d 100644 --- a/firmware-support/bittide-sys/Cargo.toml +++ b/firmware-support/bittide-sys/Cargo.toml @@ -20,7 +20,7 @@ fdt = "0.1.0" heapless = { version = "0.8", features = ["ufmt"]} log = "0.4.21" rand = {version = "0.8.3", features = ["small_rng"], default-features = false } -smoltcp = { version = "0.11", default-features = false, features = ["log", "medium-ethernet", "proto-ipv4", "socket-tcp"] } +smoltcp = { git = "https://github.com/smoltcp-rs/smoltcp.git", rev = "dc08e0b42e668c331bb2b6f8d80016301d0efe03", default-features = false, features = ["log", "medium-ethernet", "proto-ipv4", "socket-tcp"] } ufmt = "0.2.0" [dev-dependencies] diff --git a/firmware-support/bittide-sys/src/smoltcp/axi.rs b/firmware-support/bittide-sys/src/smoltcp/axi.rs index ead6b523e..20fb0eb5c 100644 --- a/firmware-support/bittide-sys/src/smoltcp/axi.rs +++ b/firmware-support/bittide-sys/src/smoltcp/axi.rs @@ -91,20 +91,13 @@ pub struct RxToken<'a, const BUFFER_SIZE: usize> { impl phy::RxToken for RxToken<'_, BUFFER_SIZE> { fn consume(self, f: F) -> R where - F: FnOnce(&mut [u8]) -> R, + F: FnOnce(&[u8]) -> R, { // Get a slice containing the received data let buf = self.axi_rx.get_slice(); - // TODO: This is a hack to get around the fact that the buffer is not mutable, - // but the smoltcp API requires it to be. This Should be fixed by - // https://github.com/smoltcp-rs/smoltcp/pull/924 - #[allow(clippy::cast_ref_to_mut)] - let mutable_buf = - unsafe { core::slice::from_raw_parts_mut(buf.as_ptr().cast_mut(), buf.len()) }; - // Process the received data - let r = f(mutable_buf); + let r = f(buf); // Clear the packet and status registers self.axi_rx.clear_packet(); diff --git a/host-tools/Cargo.lock b/host-tools/Cargo.lock index 68e1f7b18..e9e5fe7f7 100644 --- a/host-tools/Cargo.lock +++ b/host-tools/Cargo.lock @@ -117,8 +117,7 @@ checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" [[package]] name = "smoltcp" version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a1a996951e50b5971a2c8c0fa05a381480d70a933064245c4a223ddc87ccc97" +source = "git+https://github.com/smoltcp-rs/smoltcp.git?rev=dc08e0b42e668c331bb2b6f8d80016301d0efe03#dc08e0b42e668c331bb2b6f8d80016301d0efe03" dependencies = [ "bitflags", "byteorder",