From 2bd5191100dee342e88f52db8f937fe2267e1321 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 20 May 2024 19:04:01 +0200 Subject: [PATCH] add smoltcp dependency --- .../stm32h7-rtic/.cargo/def_config.toml | 3 ++ embedded-examples/stm32h7-rtic/Cargo.lock | 40 +++++++++++++++++++ embedded-examples/stm32h7-rtic/Cargo.toml | 10 ++++- embedded-examples/stm32h7-rtic/README.md | 4 ++ embedded-examples/stm32h7-rtic/src/main.rs | 1 + 5 files changed, 56 insertions(+), 2 deletions(-) diff --git a/embedded-examples/stm32h7-rtic/.cargo/def_config.toml b/embedded-examples/stm32h7-rtic/.cargo/def_config.toml index 9d352da..b229e7f 100644 --- a/embedded-examples/stm32h7-rtic/.cargo/def_config.toml +++ b/embedded-examples/stm32h7-rtic/.cargo/def_config.toml @@ -22,3 +22,6 @@ target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU) [alias] rb = "run --bin" rrb = "run --release --bin" + +[env] +DEFMT_LOG = "info" \ No newline at end of file diff --git a/embedded-examples/stm32h7-rtic/Cargo.lock b/embedded-examples/stm32h7-rtic/Cargo.lock index 757e7f1..eea4a31 100644 --- a/embedded-examples/stm32h7-rtic/Cargo.lock +++ b/embedded-examples/stm32h7-rtic/Cargo.lock @@ -294,12 +294,31 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" +[[package]] +name = "hash32" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" +dependencies = [ + "byteorder", +] + [[package]] name = "hashbrown" version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +[[package]] +name = "heapless" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" +dependencies = [ + "hash32", + "stable_deref_trait", +] + [[package]] name = "indexmap" version = "2.2.6" @@ -310,6 +329,12 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "managed" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ca88d725a0a943b096803bd34e73a4437208b6077654cc4ecb2947a5f91618d" + [[package]] name = "nb" version = "0.1.3" @@ -542,6 +567,7 @@ dependencies = [ "rtic", "rtic-monotonics", "satrs", + "smoltcp", "stm32h7xx-hal", ] @@ -566,6 +592,19 @@ version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +[[package]] +name = "smoltcp" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a1a996951e50b5971a2c8c0fa05a381480d70a933064245c4a223ddc87ccc97" +dependencies = [ + "bitflags", + "byteorder", + "cfg-if", + "heapless", + "managed", +] + [[package]] name = "spacepackets" version = "0.11.2" @@ -613,6 +652,7 @@ dependencies = [ "fugit", "nb 1.1.0", "paste", + "smoltcp", "stm32h7", "void", ] diff --git a/embedded-examples/stm32h7-rtic/Cargo.toml b/embedded-examples/stm32h7-rtic/Cargo.toml index 3b5f920..bbd5514 100644 --- a/embedded-examples/stm32h7-rtic/Cargo.toml +++ b/embedded-examples/stm32h7-rtic/Cargo.toml @@ -20,8 +20,14 @@ defmt = "0.3" defmt-brtt = { version = "0.1", default-features = false, features = ["rtt"] } panic-probe = { version = "0.3", features = ["print-defmt"] } cortex-m-semihosting = "0.5.0" -stm32h7xx-hal = { version="0.16", features= ["stm32h743v"] } +stm32h7xx-hal = { version="0.16", features= ["stm32h743v", "ethernet"] } +[dependencies.smoltcp] +version = "0.11.0" +default-features = false +features = ["medium-ethernet", "proto-ipv4", "socket-raw"] + +optional = true [dependencies.rtic] version = "2" features = ["thumbv7-backend"] @@ -45,7 +51,7 @@ codegen-units = 1 debug = 2 debug-assertions = true # <- incremental = false -opt-level = 'z' # <- +opt-level = 's' # <- overflow-checks = true # <- # cargo test diff --git a/embedded-examples/stm32h7-rtic/README.md b/embedded-examples/stm32h7-rtic/README.md index 7da8627..8ed0ac4 100644 --- a/embedded-examples/stm32h7-rtic/README.md +++ b/embedded-examples/stm32h7-rtic/README.md @@ -111,3 +111,7 @@ You can configure the blinky frequency using All these commands will package a PUS telecommand which will be sent to the MCU using the COBS format as the packet framing format. + +## Resources + +- [STM32H743ZI Ethernet link checker example](https://github.com/stm32-rs/stm32h7xx-hal/blob/master/examples/ethernet-nucleo-h743zi2.rs) diff --git a/embedded-examples/stm32h7-rtic/src/main.rs b/embedded-examples/stm32h7-rtic/src/main.rs index 1484de7..54236b9 100644 --- a/embedded-examples/stm32h7-rtic/src/main.rs +++ b/embedded-examples/stm32h7-rtic/src/main.rs @@ -77,6 +77,7 @@ mod app { async fn blink(mut cx: blink::Context) { let leds = cx.local.leds; loop { + defmt::info!("toggling LEDs"); leds.led0.toggle(); leds.led1.toggle(); leds.led2.toggle();