upgrade to current rust + smoltcp

This commit is contained in:
Astro 2019-10-30 19:53:35 +01:00
parent c2aa0e2989
commit 225be7b911
5 changed files with 4159 additions and 1110 deletions

File diff suppressed because it is too large Load Diff

View File

@ -10,9 +10,9 @@ with pkgs;
let
rustcSrc = pkgs.fetchgit {
url = https://github.com/rust-lang/rust.git;
# master of 2019-09-25
rev = "37538aa1365d1f8a10770a7d15c95b3167c8db57";
sha256 = "1nvddkxwvrsvyx187s5mwj4fwsf26xd4vr6ba1kfy7m2fj7w79hq";
# master of 2019-10-30
rev = "aa69777ea2902208b24b3fd77767d577ceaf6386";
sha256 = "0aq9rb6g7g46abphbvgrig80yymdf75rhllf5pgygardqnh11a02";
fetchSubmodules = true;
};
target = "thumbv7em-none-eabihf";

6
firmware/Cargo.lock generated
View File

@ -151,7 +151,7 @@ dependencies = [
"libm 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"nb 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"nom 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smoltcp 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"smoltcp 0.5.0 (git+https://github.com/m-labs/smoltcp.git?rev=0fedb1db9aa26712830822dd61f065deaa34d611)",
"tm4c129x 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"walkdir 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -287,7 +287,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "smoltcp"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
source = "git+https://github.com/m-labs/smoltcp.git?rev=0fedb1db9aa26712830822dd61f065deaa34d611#0fedb1db9aa26712830822dd61f065deaa34d611"
dependencies = [
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -415,7 +415,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum same-file 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d931a44fdaa43b8637009e7632a02adc4f2b2e0733c08caa4cf00e8da4a117a7"
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
"checksum smoltcp 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fef582369edb298c6c41319a544ca9c4e83622f226055ccfcb35974fbb55ed34"
"checksum smoltcp 0.5.0 (git+https://github.com/m-labs/smoltcp.git?rev=0fedb1db9aa26712830822dd61f065deaa34d611)" = "<none>"
"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8"
"checksum static_assertions 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7f3eb36b47e512f8f1c9e3d10c2c1965bc992bd9cdb024fa581e2194501c83d3"
"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5"

View File

@ -23,8 +23,9 @@ lexical-core = { version = "~0.6.1", default-features = false }
nom = { version = "~5", default-features = false }
[dependencies.smoltcp]
version = "0.5.0"
features = ["proto-ipv4", "socket-tcp"]
git = "https://github.com/m-labs/smoltcp.git"
rev = "0fedb1db9aa26712830822dd61f065deaa34d611"
features = ["ethernet", "proto-ipv4", "socket-tcp"]
default-features = false
[dependencies.compiler_builtins]

View File

@ -155,11 +155,11 @@ impl RxRing {
(EMAC_RDES0_FS | EMAC_RDES0_LS)
}
unsafe fn buf_as_slice<'a>(&self) -> &'a [u8] {
unsafe fn buf_as_slice<'a>(&self) -> &'a mut [u8] {
let len = (self.desc_buf[self.cur_desc + 0] & EMAC_RDES0_FL) >> 16;
let len = cmp::min(len as usize, ETH_RX_BUFFER_SIZE);
let addr = self.desc_buf[self.cur_desc + 2] as *const u8;
slice::from_raw_parts(addr, len)
let addr = self.desc_buf[self.cur_desc + 2] as *mut u8;
slice::from_raw_parts_mut(addr, len)
}
fn buf_release(&mut self) {
@ -428,7 +428,7 @@ pub struct RxToken<'a>(&'a mut RxRing);
impl<'a> phy::RxToken for RxToken<'a> {
fn consume<R, F>(self, _timestamp: Instant, f: F) -> Result<R>
where F: FnOnce(&[u8]) -> Result<R> {
where F: FnOnce(&mut [u8]) -> Result<R> {
let result = f(unsafe { self.0.buf_as_slice() });
self.0.buf_release();
result