diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 124f429..40d2a76 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,10 +2,9 @@ name: Continuous Integration on: push: - branches: - - staging - - trying - - master + branches: [master, staging, trying] + pull_request: + branches: [master] env: CARGO_TERM_COLOR: always @@ -42,7 +41,7 @@ jobs: uses: actions-rs/cargo@v1 continue-on-error: true with: - command: clippy + command: clippy compile: runs-on: ubuntu-latest diff --git a/Cargo.lock b/Cargo.lock index ff768f0..9f1bb5d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -344,37 +344,12 @@ dependencies = [ "cortex-m-semihosting", ] -[[package]] -name = "paste" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" -dependencies = [ - "paste-impl", - "proc-macro-hack", -] - [[package]] name = "paste" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba7ae1a2180ed02ddfdb5ab70c70d596a26dd642e097bb6fe78b1bde8588ed97" -[[package]] -name = "paste-impl" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" -dependencies = [ - "proc-macro-hack", -] - -[[package]] -name = "proc-macro-hack" -version = "0.5.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" - [[package]] name = "proc-macro2" version = "1.0.24" @@ -478,7 +453,6 @@ checksum = "0fe46639fd2ec79eadf8fe719f237a7a0bd4dac5d957f1ca5bbdbc1c3c39e53a" dependencies = [ "bitflags", "byteorder", - "log", "managed", ] @@ -503,8 +477,7 @@ dependencies = [ "serde", "serde-json-core", "smoltcp", - "stm32h7-ethernet", - "stm32h7xx-hal 0.8.0", + "stm32h7xx-hal", ] [[package]] @@ -513,17 +486,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" -[[package]] -name = "stm32h7" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9beb5e2a223c82f263c3051bba4614aebc6e98bd40217df3cd8817c83ac7bd8" -dependencies = [ - "bare-metal 0.2.5", - "cortex-m", - "vcell", -] - [[package]] name = "stm32h7" version = "0.12.1" @@ -536,34 +498,6 @@ dependencies = [ "vcell", ] -[[package]] -name = "stm32h7-ethernet" -version = "0.1.1" -source = "git+https://github.com/quartiq/stm32h7-ethernet.git#cf9b8bb2e1b440d8ada6ac6048f48dc4ed9c269a" -dependencies = [ - "cortex-m", - "log", - "smoltcp", - "stm32h7xx-hal 0.5.0", -] - -[[package]] -name = "stm32h7xx-hal" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "987c66628f30012ed9a41cc738421c5caece03292c0cc8fd1e99956f122735bd" -dependencies = [ - "bare-metal 0.2.5", - "cast", - "cortex-m", - "cortex-m-rt", - "embedded-hal", - "nb 0.1.3", - "paste 0.1.18", - "stm32h7 0.11.0", - "void", -] - [[package]] name = "stm32h7xx-hal" version = "0.8.0" @@ -576,9 +510,9 @@ dependencies = [ "embedded-dma", "embedded-hal", "nb 1.0.0", - "paste 1.0.2", + "paste", "smoltcp", - "stm32h7 0.12.1", + "stm32h7", "void", ] diff --git a/Cargo.toml b/Cargo.toml index 0cac547..04bd4e5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,11 +52,6 @@ default-features = false [dependencies.ad9959] path = "ad9959" -[dependencies.stm32h7-ethernet] -git = "https://github.com/quartiq/stm32h7-ethernet.git" -branch = "master" -features = ["stm32h743v"] - [dependencies.stm32h7xx-hal] features = ["stm32h743v", "rt", "unproven", "ethernet", "quadspi"] git = "https://github.com/quartiq/stm32h7xx-hal" diff --git a/src/main.rs b/src/main.rs index b176ca6..3a0b00e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,6 @@ +#![deny(warnings)] +// Deprecation warnings are temporarily allowed as the HAL DMA goes through updates. +#![allow(deprecated)] #![allow(clippy::missing_safety_doc)] #![no_std] #![no_main] @@ -43,7 +46,10 @@ use hal::{ }, ethernet::{self, PHY}, }; + use smoltcp as net; +use smoltcp::iface::Routes; +use smoltcp::wire::Ipv4Address; use heapless::{consts::*, String}; @@ -90,6 +96,7 @@ mod build_info { pub struct NetStorage { ip_addrs: [net::wire::IpCidr; 1], neighbor_cache: [Option<(net::wire::IpAddress, net::iface::Neighbor)>; 8], + routes_storage: [Option<(smoltcp::wire::IpCidr, smoltcp::iface::Route)>; 1], } static mut NET_STORE: NetStorage = NetStorage { @@ -99,6 +106,8 @@ static mut NET_STORE: NetStorage = NetStorage { )], neighbor_cache: [None; 8], + + routes_storage: [None; 1], }; const SCALE: f32 = ((1 << 15) - 1) as f32; @@ -664,6 +673,10 @@ const APP: () = { 24, ); + let default_v4_gw = Ipv4Address::new(10, 0, 16, 1); + let mut routes = Routes::new(&mut store.routes_storage[..]); + routes.add_default_ipv4_route(default_v4_gw).unwrap(); + let neighbor_cache = net::iface::NeighborCache::new(&mut store.neighbor_cache[..]); @@ -671,6 +684,7 @@ const APP: () = { .ethernet_addr(mac_addr) .neighbor_cache(neighbor_cache) .ip_addrs(&mut store.ip_addrs[..]) + .routes(routes) .finalize(); (interface, lan8742a)