From e2fbc08545f68d2fe6d1ba6bc247f7d4fde0ca82 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 10 Sep 2025 18:06:50 +0200 Subject: [PATCH] continue updating embedded examples --- .../stm32f3-disco-rtic/Cargo.lock | 584 ++++++++-------- .../stm32f3-disco-rtic/Cargo.toml | 39 +- .../stm32f3-disco-rtic/src/bin/blinky.rs | 111 ++- .../stm32f3-disco-rtic/src/lib.rs | 141 +++- .../stm32f3-disco-rtic/src/main.rs | 649 ++++++++---------- .../stm32h7-nucleo-rtic/Cargo.lock | 641 ++++++++++++++--- .../stm32h7-nucleo-rtic/Cargo.toml | 11 +- satrs/src/pus/verification.rs | 34 +- 8 files changed, 1347 insertions(+), 863 deletions(-) diff --git a/embedded-examples/stm32f3-disco-rtic/Cargo.lock b/embedded-examples/stm32f3-disco-rtic/Cargo.lock index be838d2..e6c4465 100644 --- a/embedded-examples/stm32f3-disco-rtic/Cargo.lock +++ b/embedded-examples/stm32f3-disco-rtic/Cargo.lock @@ -3,12 +3,21 @@ version = 4 [[package]] -name = "accelerometer" -version = "0.12.0" +name = "aligned" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a4586d95cb0695e748760c9a751141eebb68265b1b20392a0f14db608679f7a" +checksum = "377e4c0ba83e4431b10df45c1d4666f178ea9c552cac93e60c3a88bf32785923" dependencies = [ - "micromath", + "as-slice", +] + +[[package]] +name = "as-slice" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516" +dependencies = [ + "stable_deref_trait", ] [[package]] @@ -23,7 +32,7 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3" dependencies = [ - "rustc_version 0.2.3", + "rustc_version", ] [[package]] @@ -32,6 +41,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8fe8f5a8a398345e52358e18ff07cc17a568fbca5c6f73873d3a62056309603" +[[package]] +name = "bit_field" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e4b40c7323adcfc0a41c4b88143ed58346ff65a288fc144329c5c45e05d70c6" + [[package]] name = "bitfield" version = "0.13.2" @@ -45,15 +60,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] -name = "bxcan" -version = "0.7.0" +name = "bitflags" +version = "2.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ac3d0c0a542d0ab5521211f873f62706a7136df415676f676d347e5a41dd80" +checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394" + +[[package]] +name = "block-device-driver" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c051592f59fe68053524b4c4935249b806f72c1f544cfb7abe4f57c3be258e" dependencies = [ - "bitflags", - "embedded-hal 0.2.7", - "nb 1.1.0", - "vcell", + "aligned", ] [[package]] @@ -62,41 +80,17 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" -[[package]] -name = "cast" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c24dab4283a142afa2fdca129b80ad2c6284e073930f964c3a1293c225ee39a" -dependencies = [ - "rustc_version 0.4.1", -] - [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "chrono" -version = "0.4.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" -dependencies = [ - "num-traits", -] - [[package]] name = "cobs" -version = "0.2.3" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" - -[[package]] -name = "cobs" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1" +checksum = "fea6d1b751c55bd9c0dda7d4ff752074e98f4765ae969664648bd193bb326d15" dependencies = [ "thiserror", ] @@ -200,29 +194,19 @@ dependencies = [ [[package]] name = "defmt" -version = "0.3.10" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" dependencies = [ - "bitflags", + "bitflags 1.3.2", "defmt-macros", ] -[[package]] -name = "defmt-brtt" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2f0ac3635d0c89d12b8101fcb44a7625f5f030a1c0491124b74467eb5a58a78" -dependencies = [ - "critical-section", - "defmt", -] - [[package]] name = "defmt-macros" -version = "0.4.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" dependencies = [ "defmt-parser", "proc-macro-error2", @@ -233,18 +217,28 @@ dependencies = [ [[package]] name = "defmt-parser" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" dependencies = [ "thiserror", ] [[package]] -name = "defmt-test" -version = "0.3.2" +name = "defmt-rtt" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290966e8c38f94b11884877242de876280d0eab934900e9642d58868e77c5df1" +checksum = "b2cac3b8a5644a9e02b75085ebad3b6deafdbdbdec04bb25086523828aa4dfd1" +dependencies = [ + "critical-section", + "defmt", +] + +[[package]] +name = "defmt-test" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24076cc7203c365e7febfcec15d6667a9ef780bd2c5fd3b2a197400df78f299b" dependencies = [ "cortex-m-rt", "cortex-m-semihosting", @@ -254,9 +248,9 @@ dependencies = [ [[package]] name = "defmt-test-macros" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "984bc6eca246389726ac2826acc2488ca0fe5fcd6b8d9b48797021951d76a125" +checksum = "fe5520fd36862f281c026abeaab153ebbc001717c29a9b8e5ba9704d8f3a879d" dependencies = [ "proc-macro2", "quote", @@ -286,12 +280,140 @@ dependencies = [ ] [[package]] -name = "embedded-dma" +name = "document-features" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95249b50c6c185bee49034bcb378a49dc2b5dff0be90ff6616d31d64febab05d" +dependencies = [ + "litrs", +] + +[[package]] +name = "embassy-embedded-hal" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "554e3e840696f54b4c9afcf28a0f24da431c927f4151040020416e7393d6d0d8" +dependencies = [ + "embassy-futures", + "embassy-hal-internal", + "embassy-sync", + "embedded-hal 0.2.7", + "embedded-hal 1.0.0", + "embedded-hal-async", + "embedded-storage", + "embedded-storage-async", + "nb 1.1.0", +] + +[[package]] +name = "embassy-futures" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc2d050bdc5c21e0862a89256ed8029ae6c290a93aecefc73084b3002cdebb01" + +[[package]] +name = "embassy-hal-internal" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95285007a91b619dc9f26ea8f55452aa6c60f7115a4edc05085cd2bd3127cd7a" +dependencies = [ + "cortex-m", + "critical-section", + "num-traits", +] + +[[package]] +name = "embassy-net-driver" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "994f7e5b5cb23521c22304927195f236813053eb9c065dd2226a32ba64695446" +checksum = "524eb3c489760508f71360112bca70f6e53173e6fe48fc5f0efd0f5ab217751d" + +[[package]] +name = "embassy-stm32" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d972eab325cc96afee98f80a91ca6b00249b6356dc0fdbff68b70c200df9fae" dependencies = [ - "stable_deref_trait", + "aligned", + "bit_field", + "bitflags 2.9.4", + "block-device-driver", + "cfg-if", + "cortex-m", + "cortex-m-rt", + "critical-section", + "document-features", + "embassy-embedded-hal", + "embassy-futures", + "embassy-hal-internal", + "embassy-net-driver", + "embassy-sync", + "embassy-usb-driver", + "embassy-usb-synopsys-otg", + "embedded-can", + "embedded-hal 0.2.7", + "embedded-hal 1.0.0", + "embedded-hal-async", + "embedded-hal-nb", + "embedded-io", + "embedded-io-async", + "embedded-storage", + "embedded-storage-async", + "futures-util", + "nb 1.1.0", + "proc-macro2", + "quote", + "rand_core 0.6.4", + "rand_core 0.9.3", + "sdio-host", + "static_assertions", + "stm32-fmc", + "stm32-metapac", + "vcell", + "volatile-register", +] + +[[package]] +name = "embassy-sync" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73974a3edbd0bd286759b3d483540f0ebef705919a5f56f4fc7709066f71689b" +dependencies = [ + "cfg-if", + "critical-section", + "embedded-io-async", + "futures-core", + "futures-sink", + "heapless 0.8.0", +] + +[[package]] +name = "embassy-usb-driver" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17119855ccc2d1f7470a39756b12068454ae27a3eabb037d940b5c03d9c77b7a" +dependencies = [ + "embedded-io-async", +] + +[[package]] +name = "embassy-usb-synopsys-otg" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "288751f8eaa44a5cf2613f13cee0ca8e06e6638cb96e897e6834702c79084b23" +dependencies = [ + "critical-section", + "embassy-sync", + "embassy-usb-driver", +] + +[[package]] +name = "embedded-can" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9d2e857f87ac832df68fa498d18ddc679175cf3d2e4aa893988e5601baf9438" +dependencies = [ + "nb 1.1.0", ] [[package]] @@ -320,12 +442,43 @@ dependencies = [ ] [[package]] -name = "embedded-time" -version = "0.12.1" +name = "embedded-hal-nb" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7a4b4d10ac48d08bfe3db7688c402baadb244721f30a77ce360bd24c3dffe58" +checksum = "fba4268c14288c828995299e59b12babdbe170f6c6d73731af1b4648142e8605" dependencies = [ - "num", + "embedded-hal 1.0.0", + "nb 1.1.0", +] + +[[package]] +name = "embedded-io" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" + +[[package]] +name = "embedded-io-async" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" +dependencies = [ + "embedded-io", +] + +[[package]] +name = "embedded-storage" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21dea9854beb860f3062d10228ce9b976da520a73474aed3171ec276bc0c032" + +[[package]] +name = "embedded-storage-async" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1763775e2323b7d5f0aa6090657f5e21cfa02ede71f5dc40eead06d64dcd15cc" +dependencies = [ + "embedded-storage", ] [[package]] @@ -376,6 +529,12 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + [[package]] name = "futures-task" version = "0.3.31" @@ -400,25 +559,6 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" -[[package]] -name = "generic-array" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "667f6ea017b297ec65b8a108c6e9ad6879460721fb3b6b23abf690970147fc28" -dependencies = [ - "typenum", -] - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - [[package]] name = "hash32" version = "0.3.1" @@ -444,6 +584,16 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "heapless" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1edcd5a338e64688fbdcb7531a846cfd3476a54784dcb918a0844682bc7ada5" +dependencies = [ + "hash32", + "stable_deref_trait", +] + [[package]] name = "ident_case" version = "1.0.1" @@ -461,24 +611,10 @@ dependencies = [ ] [[package]] -name = "lsm303dlhc" -version = "0.2.0" +name = "litrs" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5d1a5c290951321d1b0d4a40edd828537de9889134a0e67c5146542ae57706" -dependencies = [ - "cast", - "embedded-hal 0.2.7", - "generic-array 0.11.2", -] - -[[package]] -name = "micromath" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc4010833aea396656c2f91ee704d51a6f1329ec2ab56ffd00bfd56f7481ea94" -dependencies = [ - "generic-array 0.14.7", -] +checksum = "f5e54036fe321fd421e10d732f155734c4e4afd610dd556d9a82833ab3ee0bed" [[package]] name = "nb" @@ -495,59 +631,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" -[[package]] -name = "num" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b7a8e9be5e039e2ff869df49155f1c06bd01ade2117ec783e56ab0932b67a8f" -dependencies = [ - "num-complex", - "num-integer", - "num-iter", - "num-rational", - "num-traits", -] - -[[package]] -name = "num-complex" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "747d632c0c558b87dbabbe6a82f3b4ae03720d0646ac5b7b4dae89394be5f2c5" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-integer" -version = "0.1.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-iter" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -579,9 +662,9 @@ dependencies = [ [[package]] name = "panic-probe" -version = "0.3.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4047d9235d1423d66cc97da7d07eddb54d4f154d6c13805c6d0793956f4f25b0" +checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" dependencies = [ "cortex-m", "defmt", @@ -652,13 +735,16 @@ dependencies = [ ] [[package]] -name = "rtcc" -version = "0.3.2" +name = "rand_core" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95973c3a0274adc4f3c5b70d2b5b85618d6de9559a6737d3293ecae9a2fc0839" -dependencies = [ - "chrono", -] +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" + +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" [[package]] name = "rtic" @@ -735,42 +821,27 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" dependencies = [ - "semver 0.9.0", -] - -[[package]] -name = "rustc_version" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" -dependencies = [ - "semver 1.0.25", + "semver", ] [[package]] name = "satrs" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "866fcae3b683ccc37b5ad77982483a0ee01d5dc408dea5aad2117ad404b60fe1" +version = "0.3.0-alpha.2" dependencies = [ - "cobs 0.2.3", - "crc", + "cobs", "defmt", "delegate", "derive-new", - "num-traits", "num_enum", "paste", "satrs-shared", - "smallvec", "spacepackets", + "thiserror", ] [[package]] name = "satrs-shared" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6042477018c2d43fffccaaa5099bc299a58485139b4d31c5b276889311e474f1" +version = "0.2.3" dependencies = [ "spacepackets", ] @@ -779,24 +850,31 @@ dependencies = [ name = "satrs-stm32f3-disco-rtic" version = "0.1.0" dependencies = [ - "cobs 0.3.0", + "cobs", "cortex-m", "cortex-m-rt", "cortex-m-semihosting", "defmt", - "defmt-brtt", + "defmt-rtt", "defmt-test", - "embedded-hal 0.2.7", + "embassy-stm32", + "embedded-hal 1.0.0", "enumset", - "heapless", + "heapless 0.9.1", "panic-probe", "rtic", "rtic-monotonics", "satrs", - "stm32f3-discovery", - "stm32f3xx-hal", + "spacepackets", + "static_cell", ] +[[package]] +name = "sdio-host" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b328e2cb950eeccd55b7f55c3a963691455dcd044cfb5354f0c5e68d2c2d6ee2" + [[package]] name = "semver" version = "0.9.0" @@ -806,41 +884,25 @@ dependencies = [ "semver-parser", ] -[[package]] -name = "semver" -version = "1.0.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f79dfe2d285b0488816f30e700a7438c5a73d816b5b7d3ac72fbc48b0d185e03" - [[package]] name = "semver-parser" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -[[package]] -name = "slice-group-by" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" - -[[package]] -name = "smallvec" -version = "1.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" - [[package]] name = "spacepackets" -version = "0.11.2" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e85574d113a06312010c0ba51aadccd4ba2806231ebe9a49fc6473d0534d8696" +checksum = "95ca19d2a251259686f6fffb094a8e32824098f387cd613ae81bfe4216524d02" dependencies = [ "crc", "defmt", "delegate", "num-traits", "num_enum", + "paste", + "thiserror", "zerocopy", ] @@ -851,74 +913,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] -name = "stm32-usbd" -version = "0.6.0" +name = "static_assertions" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6c94998f166d66b210a164648a0b7866428d8f1e0740bf8a4c5edd89d4750c1" -dependencies = [ - "cortex-m", - "usb-device", - "vcell", -] +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] -name = "stm32f3" -version = "0.15.1" +name = "static_cell" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b28b37228ef3fa47956af38c6abd756e912f244c1657f14e66d42fc8d74ea96f" +checksum = "0530892bb4fa575ee0da4b86f86c667132a94b74bb72160f58ee5a4afec74c23" dependencies = [ - "bare-metal 1.0.0", - "cortex-m", - "cortex-m-rt", - "vcell", + "portable-atomic", ] [[package]] -name = "stm32f3-discovery" -version = "0.8.0-alpha.0" -source = "git+https://github.com/robamu/stm32f3-discovery?branch=complete-dma-update-hal#5ccacae07ceff02d7d3649df67a6a0ba2a144752" -dependencies = [ - "accelerometer", - "cortex-m", - "cortex-m-rt", - "lsm303dlhc", - "stm32f3xx-hal", - "switch-hal", -] - -[[package]] -name = "stm32f3xx-hal" -version = "0.11.0-alpha.0" -source = "git+https://github.com/robamu/stm32f3xx-hal?branch=complete-dma-update#04fc76b7912649c84b57bd0ab803ea3ccf2aadae" -dependencies = [ - "bxcan", - "cfg-if", - "cortex-m", - "cortex-m-rt", - "critical-section", - "embedded-dma", - "embedded-hal 0.2.7", - "embedded-time", - "enumset", - "nb 1.1.0", - "num-traits", - "paste", - "rtcc", - "slice-group-by", - "stm32-usbd", - "stm32f3", - "void", -] - -[[package]] -name = "switch-hal" -version = "0.4.0" +name = "stm32-fmc" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90a4adc8cbd1726249b161898e48e0f3f1ce74d34dc784cbbc98fba4ed283fbf" +checksum = "c7f0639399e2307c2446c54d91d4f1596343a1e1d5cab605b9cce11d0ab3858c" dependencies = [ "embedded-hal 0.2.7", ] +[[package]] +name = "stm32-metapac" +version = "18.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fd8ec3a292a0d9fc4798416a61b21da5ae50341b2e7b8d12e662bf305366097" +dependencies = [ + "cortex-m", + "cortex-m-rt", +] + [[package]] name = "syn" version = "1.0.109" @@ -961,36 +988,18 @@ dependencies = [ "syn 2.0.96", ] -[[package]] -name = "typenum" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" - [[package]] name = "unicode-ident" version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a210d160f08b701c8721ba1c726c11662f877ea6b7094007e1ca9a1041945034" -[[package]] -name = "usb-device" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f6cc3adc849b5292b4075fc0d5fdcf2f24866e88e336dd27a8943090a520508" - [[package]] name = "vcell" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - [[package]] name = "void" version = "1.0.2" @@ -1008,19 +1017,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.35" +version = "0.8.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f" dependencies = [ - "byteorder", "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.35" +version = "0.8.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" dependencies = [ "proc-macro2", "quote", diff --git a/embedded-examples/stm32f3-disco-rtic/Cargo.toml b/embedded-examples/stm32f3-disco-rtic/Cargo.toml index 2c46000..42f9e1a 100644 --- a/embedded-examples/stm32f3-disco-rtic/Cargo.toml +++ b/embedded-examples/stm32f3-disco-rtic/Cargo.toml @@ -9,13 +9,16 @@ default-run = "satrs-stm32f3-disco-rtic" [dependencies] cortex-m = { version = "0.7", features = ["critical-section-single-core"] } cortex-m-rt = "0.7" -defmt = "0.3" -defmt-brtt = { version = "0.1", default-features = false, features = ["rtt"] } -panic-probe = { version = "0.3", features = ["print-defmt"] } -embedded-hal = "0.2.7" +defmt = "1" +defmt-rtt = { version = "1" } +panic-probe = { version = "1", features = ["print-defmt"] } +embedded-hal = "1" cortex-m-semihosting = "0.5.0" +embassy-stm32 = { version = "0.4", features = ["stm32f303vc", "unstable-pac"] } enumset = "1" -heapless = "0.8" +heapless = "0.9" +spacepackets = { version = "0.15", default-features = false, features = ["defmt"] } +static_cell = "2" [dependencies.rtic] version = "2" @@ -26,32 +29,32 @@ version = "2" features = ["cortex-m-systick"] [dependencies.cobs] -version = "0.3" +version = "0.4" default-features = false -[dependencies.stm32f3xx-hal] -git = "https://github.com/robamu/stm32f3xx-hal" -version = "0.11.0-alpha.0" -features = ["stm32f303xc", "rt", "enumset"] -branch = "complete-dma-update" +# [dependencies.stm32f3xx-hal] +# git = "https://github.com/robamu/stm32f3xx-hal" +# version = "0.11.0-alpha.0" +# features = ["stm32f303xc", "rt", "enumset"] +# branch = "complete-dma-update" # Can be used in workspace to develop and update HAL # path = "../stm32f3xx-hal" -[dependencies.stm32f3-discovery] -git = "https://github.com/robamu/stm32f3-discovery" -version = "0.8.0-alpha.0" -branch = "complete-dma-update-hal" +# [dependencies.stm32f3-discovery] +# git = "https://github.com/robamu/stm32f3-discovery" +# version = "0.8.0-alpha.0" +# branch = "complete-dma-update-hal" # Can be used in workspace to develop and update BSP # path = "../stm32f3-discovery" [dependencies.satrs] -# path = "satrs" -version = "0.2" +# version = "0.2" +path = "../../satrs" default-features = false features = ["defmt"] [dev-dependencies] -defmt-test = "0.3" +defmt-test = "0.4" # cargo test [profile.test] diff --git a/embedded-examples/stm32f3-disco-rtic/src/bin/blinky.rs b/embedded-examples/stm32f3-disco-rtic/src/bin/blinky.rs index ea09455..372d7b3 100644 --- a/embedded-examples/stm32f3-disco-rtic/src/bin/blinky.rs +++ b/embedded-examples/stm32f3-disco-rtic/src/bin/blinky.rs @@ -1,76 +1,61 @@ -#![no_std] #![no_main] -use satrs_stm32f3_disco_rtic as _; +#![no_std] -use stm32f3_discovery::leds::Leds; -use stm32f3_discovery::stm32f3xx_hal::delay::Delay; -use stm32f3_discovery::stm32f3xx_hal::{pac, prelude::*}; -use stm32f3_discovery::switch_hal::{OutputSwitch, ToggleableOutputSwitch}; +use panic_probe as _; +use rtic::app; -#[cortex_m_rt::entry] -fn main() -> ! { - defmt::println!("STM32F3 Discovery Blinky"); - let dp = pac::Peripherals::take().unwrap(); - let mut rcc = dp.RCC.constrain(); - let cp = cortex_m::Peripherals::take().unwrap(); - let mut flash = dp.FLASH.constrain(); - let clocks = rcc.cfgr.freeze(&mut flash.acr); - let mut delay = Delay::new(cp.SYST, clocks); +#[app(device = embassy_stm32)] +mod app { + use rtic_monotonics::fugit::ExtU32; + use rtic_monotonics::Monotonic as _; + use satrs_stm32f3_disco_rtic::{Direction, LedPinSet, Leds}; - let mut gpioe = dp.GPIOE.split(&mut rcc.ahb); - let mut leds = Leds::new( - gpioe.pe8, - gpioe.pe9, - gpioe.pe10, - gpioe.pe11, - gpioe.pe12, - gpioe.pe13, - gpioe.pe14, - gpioe.pe15, - &mut gpioe.moder, - &mut gpioe.otyper, - ); - let delay_ms = 200u16; - loop { - leds.ld3_n.toggle().ok(); - delay.delay_ms(delay_ms); - leds.ld3_n.toggle().ok(); - delay.delay_ms(delay_ms); + rtic_monotonics::systick_monotonic!(Mono, 1000); - //explicit on/off - leds.ld4_nw.on().ok(); - delay.delay_ms(delay_ms); - leds.ld4_nw.off().ok(); - delay.delay_ms(delay_ms); + #[shared] + struct Shared {} - leds.ld5_ne.on().ok(); - delay.delay_ms(delay_ms); - leds.ld5_ne.off().ok(); - delay.delay_ms(delay_ms); + #[local] + struct Local { + leds: Leds, + current_dir: Direction, + } - leds.ld6_w.on().ok(); - delay.delay_ms(delay_ms); - leds.ld6_w.off().ok(); - delay.delay_ms(delay_ms); + #[init] + fn init(cx: init::Context) -> (Shared, Local) { + let p = embassy_stm32::init(Default::default()); - leds.ld7_e.on().ok(); - delay.delay_ms(delay_ms); - leds.ld7_e.off().ok(); - delay.delay_ms(delay_ms); + defmt::info!("Starting sat-rs demo application for the STM32F3-Discovery using RTICv2"); - leds.ld8_sw.on().ok(); - delay.delay_ms(delay_ms); - leds.ld8_sw.off().ok(); - delay.delay_ms(delay_ms); + let led_pin_set = LedPinSet { + pin_n: p.PE8, + pin_ne: p.PE9, + pin_e: p.PE10, + pin_se: p.PE11, + pin_s: p.PE12, + pin_sw: p.PE13, + pin_w: p.PE14, + pin_nw: p.PE15, + }; + let leds = Leds::new(led_pin_set); - leds.ld9_se.on().ok(); - delay.delay_ms(delay_ms); - leds.ld9_se.off().ok(); - delay.delay_ms(delay_ms); + // Initialize the systick interrupt & obtain the token to prove that we did + Mono::start(cx.core.SYST, 8_000_000); + blinky::spawn().expect("failed to spawn blinky task"); + ( + Shared {}, + Local { + leds, + current_dir: Direction::North, + }, + ) + } - leds.ld10_s.on().ok(); - delay.delay_ms(delay_ms); - leds.ld10_s.off().ok(); - delay.delay_ms(delay_ms); + #[task(local = [leds, current_dir])] + async fn blinky(cx: blinky::Context) { + loop { + cx.local.leds.blink_next(cx.local.current_dir); + Mono::delay(200.millis()).await; + } } } diff --git a/embedded-examples/stm32f3-disco-rtic/src/lib.rs b/embedded-examples/stm32f3-disco-rtic/src/lib.rs index 284660c..1ad71a0 100644 --- a/embedded-examples/stm32f3-disco-rtic/src/lib.rs +++ b/embedded-examples/stm32f3-disco-rtic/src/lib.rs @@ -3,12 +3,147 @@ use cortex_m_semihosting::debug; -use defmt_brtt as _; // global logger - -use stm32f3xx_hal as _; // memory layout +use defmt_rtt as _; // global logger use panic_probe as _; +use embassy_stm32::gpio::Output; + +#[derive(defmt::Format, PartialEq, Eq, Clone, Copy)] +pub enum Direction { + North, + NorthEast, + East, + SouthEast, + South, + SouthWest, + West, + NorthWest, +} + +impl Direction { + pub fn switch_to_next(&mut self) -> (Self, Self) { + let curr = *self; + *self = match self { + Direction::North => Direction::NorthEast, + Direction::NorthEast => Direction::East, + Direction::East => Direction::SouthEast, + Direction::SouthEast => Direction::South, + Direction::South => Direction::SouthWest, + Direction::SouthWest => Direction::West, + Direction::West => Direction::NorthWest, + Direction::NorthWest => Direction::North, + }; + (curr, *self) + } +} + +pub struct Leds { + pub north: Output<'static>, + pub north_east: Output<'static>, + pub east: Output<'static>, + pub south_east: Output<'static>, + pub south: Output<'static>, + pub south_west: Output<'static>, + pub west: Output<'static>, + pub north_west: Output<'static>, +} + +impl Leds { + pub fn blink_next(&mut self, current_dir: &mut Direction) { + let (prev, curr) = current_dir.switch_to_next(); + self.set_dir_low(prev); + self.set_dir_high(curr); + } + + pub fn set_dir(&mut self, dir: Direction, level: embassy_stm32::gpio::Level) { + match dir { + Direction::North => self.north.set_level(level), + Direction::NorthEast => self.north_east.set_level(level), + Direction::East => self.east.set_level(level), + Direction::SouthEast => self.south_east.set_level(level), + Direction::South => self.south.set_level(level), + Direction::SouthWest => self.south_west.set_level(level), + Direction::West => self.west.set_level(level), + Direction::NorthWest => self.north_west.set_level(level), + } + } + + pub fn set_dir_low(&mut self, dir: Direction) { + self.set_dir(dir, embassy_stm32::gpio::Level::Low); + } + + pub fn set_dir_high(&mut self, dir: Direction) { + self.set_dir(dir, embassy_stm32::gpio::Level::High); + } +} + +pub struct LedPinSet { + pub pin_n: embassy_stm32::Peri<'static, embassy_stm32::peripherals::PE8>, + pub pin_ne: embassy_stm32::Peri<'static, embassy_stm32::peripherals::PE9>, + pub pin_e: embassy_stm32::Peri<'static, embassy_stm32::peripherals::PE10>, + pub pin_se: embassy_stm32::Peri<'static, embassy_stm32::peripherals::PE11>, + pub pin_s: embassy_stm32::Peri<'static, embassy_stm32::peripherals::PE12>, + pub pin_sw: embassy_stm32::Peri<'static, embassy_stm32::peripherals::PE13>, + pub pin_w: embassy_stm32::Peri<'static, embassy_stm32::peripherals::PE14>, + pub pin_nw: embassy_stm32::Peri<'static, embassy_stm32::peripherals::PE15>, +} + +impl Leds { + pub fn new(pin_set: LedPinSet) -> Self { + let led_n = Output::new( + pin_set.pin_n, + embassy_stm32::gpio::Level::Low, + embassy_stm32::gpio::Speed::Medium, + ); + let led_ne = Output::new( + pin_set.pin_ne, + embassy_stm32::gpio::Level::Low, + embassy_stm32::gpio::Speed::Medium, + ); + let led_e = Output::new( + pin_set.pin_e, + embassy_stm32::gpio::Level::Low, + embassy_stm32::gpio::Speed::Medium, + ); + let led_se = Output::new( + pin_set.pin_se, + embassy_stm32::gpio::Level::Low, + embassy_stm32::gpio::Speed::Medium, + ); + let led_s = Output::new( + pin_set.pin_s, + embassy_stm32::gpio::Level::Low, + embassy_stm32::gpio::Speed::Medium, + ); + let led_sw = Output::new( + pin_set.pin_sw, + embassy_stm32::gpio::Level::Low, + embassy_stm32::gpio::Speed::Medium, + ); + let led_w = Output::new( + pin_set.pin_w, + embassy_stm32::gpio::Level::Low, + embassy_stm32::gpio::Speed::Medium, + ); + let led_nw = Output::new( + pin_set.pin_nw, + embassy_stm32::gpio::Level::Low, + embassy_stm32::gpio::Speed::Medium, + ); + Self { + north: led_n, + north_east: led_ne, + east: led_e, + south_east: led_se, + south: led_s, + south_west: led_sw, + west: led_w, + north_west: led_nw, + } + } +} + // same panicking *behavior* as `panic-probe` but doesn't print a panic message // this prevents the panic message being printed *twice* when `defmt::panic` is invoked #[defmt::panic_handler] diff --git a/embedded-examples/stm32f3-disco-rtic/src/main.rs b/embedded-examples/stm32f3-disco-rtic/src/main.rs index 6944542..768ad03 100644 --- a/embedded-examples/stm32f3-disco-rtic/src/main.rs +++ b/embedded-examples/stm32f3-disco-rtic/src/main.rs @@ -1,8 +1,6 @@ #![no_std] #![no_main] -use satrs::pus::verification::{ - FailParams, TcStateAccepted, VerificationReportCreator, VerificationToken, -}; +use satrs::pus::verification::{FailParams, VerificationReportCreator}; use satrs::spacepackets::ecss::tc::PusTcReader; use satrs::spacepackets::ecss::tm::{PusTmCreator, PusTmSecondaryHeader}; use satrs::spacepackets::ecss::EcssEnumU16; @@ -13,16 +11,12 @@ use satrs_stm32f3_disco_rtic as _; use rtic::app; -use heapless::{mpmc::Q8, Vec}; +use heapless::Vec; #[allow(unused_imports)] use rtic_monotonics::fugit::{MillisDurationU32, TimerInstantU32}; use rtic_monotonics::systick::prelude::*; -use satrs::seq_count::SequenceCountProviderCore; use satrs::spacepackets::{ecss::PusPacket, ecss::WritablePusPacket}; -use stm32f3xx_hal::dma::dma1; -use stm32f3xx_hal::gpio::{PushPull, AF7, PA2, PA3}; -use stm32f3xx_hal::pac::USART2; -use stm32f3xx_hal::serial::{Rx, RxEvent, Serial, SerialDmaRx, SerialDmaTx, Tx, TxEvent}; +use spacepackets::seq_count::SequenceCountProvider; const UART_BAUD: u32 = 115200; const DEFAULT_BLINK_FREQ_MS: u32 = 1000; @@ -30,33 +24,24 @@ const TX_HANDLER_FREQ_MS: u32 = 20; const MIN_DELAY_BETWEEN_TX_PACKETS_MS: u32 = 5; const MAX_TC_LEN: usize = 128; const MAX_TM_LEN: usize = 128; -pub const PUS_APID: u16 = 0x02; -type TxType = Tx>>; -type RxType = Rx>>; -type InstantFugit = TimerInstantU32<1000>; -type TxDmaTransferType = SerialDmaTx<&'static [u8], dma1::C7, TxType>; -type RxDmaTransferType = SerialDmaRx<&'static mut [u8], dma1::C6, RxType>; +pub const PUS_APID: u16 = 0x02; // This is the predictable maximum overhead of the COBS encoding scheme. // It is simply the maximum packet lenght dividied by 254 rounded up. -const COBS_TC_OVERHEAD: usize = (MAX_TC_LEN + 254 - 1) / 254; -const COBS_TM_OVERHEAD: usize = (MAX_TM_LEN + 254 - 1) / 254; +const COBS_TC_OVERHEAD: usize = cobs::max_encoding_overhead(MAX_TC_LEN); +const COBS_TM_OVERHEAD: usize = cobs::max_encoding_overhead(MAX_TM_LEN); const TC_BUF_LEN: usize = MAX_TC_LEN + COBS_TC_OVERHEAD; const TM_BUF_LEN: usize = MAX_TC_LEN + COBS_TM_OVERHEAD; -// This is a static buffer which should ONLY (!) be used as the TX DMA -// transfer buffer. -static mut DMA_TX_BUF: [u8; TM_BUF_LEN] = [0; TM_BUF_LEN]; -// This is a static buffer which should ONLY (!) be used as the RX DMA -// transfer buffer. -static mut DMA_RX_BUF: [u8; TC_BUF_LEN] = [0; TC_BUF_LEN]; +const TC_DMA_BUF_LEN: usize = 512; -type TmPacket = Vec; -type TcPacket = Vec; +type TmPacket = heapless::Vec; +type TcPacket = heapless::Vec; -static TM_REQUESTS: Q8 = Q8::new(); +static TM_REQUESTS: static_cell::ConstStaticCell> = + static_cell::ConstStaticCell::new(heapless::spsc::Queue::new()); use core::sync::atomic::{AtomicU16, Ordering}; @@ -74,7 +59,10 @@ impl SeqCountProviderAtomicRef { } } -impl SequenceCountProviderCore for SeqCountProviderAtomicRef { +impl SequenceCountProvider for SeqCountProviderAtomicRef { + type Raw = u16; + const MAX_BIT_WIDTH: usize = 16; + fn get(&self) -> u16 { self.atomic.load(self.ordering) } @@ -92,8 +80,8 @@ static SEQ_COUNT_PROVIDER: SeqCountProviderAtomicRef = SeqCountProviderAtomicRef::new(Ordering::Relaxed); pub struct TxIdle { - tx: TxType, - dma_channel: dma1::C7, + //tx: TxType, + //dma_channel: dma1::C7, } #[derive(Debug, defmt::Format)] @@ -108,49 +96,8 @@ impl From for TmSendError { } } -fn send_tm(tm_creator: PusTmCreator) -> Result<(), TmSendError> { - if tm_creator.len_written() > MAX_TM_LEN { - return Err(ByteConversionError::ToSliceTooSmall { - expected: tm_creator.len_written(), - found: MAX_TM_LEN, - } - .into()); - } - let mut tm_vec = TmPacket::new(); - tm_vec - .resize(tm_creator.len_written(), 0) - .expect("vec resize failed"); - tm_creator.write_to_bytes(tm_vec.as_mut_slice())?; - defmt::info!( - "Sending TM[{},{}] with size {}", - tm_creator.service(), - tm_creator.subservice(), - tm_creator.len_written() - ); - TM_REQUESTS - .enqueue(tm_vec) - .map_err(|_| TmSendError::Queue)?; - Ok(()) -} - -fn handle_tm_send_error(error: TmSendError) { - defmt::warn!("sending tm failed with error {}", error); -} - -pub enum UartTxState { - // Wrapped in an option because we need an owned type later. - Idle(Option), - // Same as above - Transmitting(Option), -} - -pub struct UartTxShared { - last_completed: Option, - state: UartTxState, -} - pub struct RequestWithToken { - token: VerificationToken, + request_id: satrs::pus::verification::RequestId, request: Request, } @@ -168,147 +115,69 @@ pub enum RequestError { NotEnoughAppData = 4, } -pub fn convert_pus_tc_to_request( - tc: &PusTcReader, - verif_reporter: &mut VerificationReportCreator, - src_data_buf: &mut [u8], - timestamp: &[u8], -) -> Result { - defmt::info!( - "Found PUS TC [{},{}] with length {}", - tc.service(), - tc.subservice(), - tc.len_packed() - ); - - let token = verif_reporter.add_tc(tc); - if tc.apid() != PUS_APID { - defmt::warn!("Received tc with unknown APID {}", tc.apid()); - let result = send_tm( - verif_reporter - .acceptance_failure( - src_data_buf, - token, - SEQ_COUNT_PROVIDER.get_and_increment(), - 0, - FailParams::new(timestamp, &EcssEnumU16::new(0), &[]), - ) - .unwrap(), - ); - if let Err(e) = result { - handle_tm_send_error(e); - } - return Err(RequestError::InvalidApid); - } - let (tm_creator, accepted_token) = verif_reporter - .acceptance_success( - src_data_buf, - token, - SEQ_COUNT_PROVIDER.get_and_increment(), - 0, - timestamp, - ) - .unwrap(); - - if let Err(e) = send_tm(tm_creator) { - handle_tm_send_error(e); - } - - if tc.service() == 17 && tc.subservice() == 1 { - if tc.subservice() == 1 { - return Ok(RequestWithToken { - request: Request::Ping, - token: accepted_token, - }); - } else { - return Err(RequestError::InvalidSubservice); - } - } else if tc.service() == 8 { - if tc.subservice() == 1 { - if tc.user_data().len() < 4 { - return Err(RequestError::NotEnoughAppData); - } - let new_freq_ms = u32::from_be_bytes(tc.user_data()[0..4].try_into().unwrap()); - return Ok(RequestWithToken { - request: Request::ChangeBlinkFrequency(new_freq_ms), - token: accepted_token, - }); - } else { - return Err(RequestError::InvalidSubservice); - } - } else { - return Err(RequestError::InvalidService); - } -} - -#[app(device = stm32f3xx_hal::pac, peripherals = true)] +#[app(device = embassy_stm32)] mod app { use super::*; - use core::slice::Iter; - use satrs::pus::verification::{TcStateStarted, VerificationReportCreator}; + use satrs::pus::verification::VerificationReportCreator; use satrs::spacepackets::{ecss::tc::PusTcReader, time::cds::P_FIELD_BASE}; - #[allow(unused_imports)] - use stm32f3_discovery::leds::Direction; - use stm32f3_discovery::leds::Leds; - use stm32f3xx_hal::prelude::*; - - use stm32f3_discovery::switch_hal::OutputSwitch; - use stm32f3xx_hal::Switch; - #[allow(dead_code)] - type SerialType = Serial>, PA3>)>; + use satrs_stm32f3_disco_rtic::LedPinSet; systick_monotonic!(Mono, 1000); + embassy_stm32::bind_interrupts!(struct Irqs { + USART2 => embassy_stm32::usart::InterruptHandler; + }); + #[shared] struct Shared { blink_freq: MillisDurationU32, - tx_shared: UartTxShared, - rx_transfer: Option, } #[local] struct Local { verif_reporter: VerificationReportCreator, - leds: Leds, - last_dir: Direction, - curr_dir: Iter<'static, Direction>, + leds: satrs_stm32f3_disco_rtic::Leds, + current_dir: satrs_stm32f3_disco_rtic::Direction, + tm_prod: heapless::spsc::Producer<'static, TmPacket>, + tm_cons: heapless::spsc::Consumer<'static, TmPacket>, + tx: embassy_stm32::usart::UartTx<'static, embassy_stm32::mode::Async>, + rx: embassy_stm32::usart::RingBufferedUartRx<'static>, } #[init] fn init(cx: init::Context) -> (Shared, Local) { - let mut rcc = cx.device.RCC.constrain(); + static DMA_BUF: static_cell::ConstStaticCell<[u8; TC_DMA_BUF_LEN]> = static_cell::ConstStaticCell::new([0; TC_DMA_BUF_LEN]); + + let p = embassy_stm32::init(Default::default()); // Initialize the systick interrupt & obtain the token to prove that we did Mono::start(cx.core.SYST, 8_000_000); - let mut flash = cx.device.FLASH.constrain(); - let clocks = rcc - .cfgr - .use_hse(8.MHz()) - .sysclk(8.MHz()) - .pclk1(8.MHz()) - .freeze(&mut flash.acr); + defmt::info!("Starting sat-rs demo application for the STM32F3-Discovery with RTICv2"); + let led_pin_set = LedPinSet { + pin_n: p.PE8, + pin_ne: p.PE9, + pin_e: p.PE10, + pin_se: p.PE11, + pin_s: p.PE12, + pin_sw: p.PE13, + pin_w: p.PE14, + pin_nw: p.PE15, + }; + let leds = satrs_stm32f3_disco_rtic::Leds::new(led_pin_set); - // Set up monotonic timer. - //let mono_timer = MonoTimer::new(cx.core.DWT, clocks, &mut cx.core.DCB); + let config = embassy_stm32::usart::Config::default(); + let uart = embassy_stm32::usart::Uart::new( + p.USART2, p.PA3, p.PA2, Irqs, p.DMA1_CH7, p.DMA1_CH6, config, + ) + .unwrap(); - defmt::info!("Starting sat-rs demo application for the STM32F3-Discovery"); - let mut gpioe = cx.device.GPIOE.split(&mut rcc.ahb); - - let leds = Leds::new( - gpioe.pe8, - gpioe.pe9, - gpioe.pe10, - gpioe.pe11, - gpioe.pe12, - gpioe.pe13, - gpioe.pe14, - gpioe.pe15, - &mut gpioe.moder, - &mut gpioe.otyper, - ); - let mut gpioa = cx.device.GPIOA.split(&mut rcc.ahb); + let (tx, rx) = uart.split(); + let tm_queue = TM_REQUESTS.take(); + let (tm_prod, tm_cons) = tm_queue.split(); + //let mut gpioa = cx.device.GPIOA.split(&mut rcc.ahb); // USART2 pins + /* let mut pins = ( // TX pin: PA2 gpioa @@ -319,29 +188,32 @@ mod app { .pa3 .into_af_push_pull(&mut gpioa.moder, &mut gpioa.otyper, &mut gpioa.afrl), ); - pins.1.internal_pull_up(&mut gpioa.pupdr, true); - let mut usart2 = Serial::new( - cx.device.USART2, - pins, - UART_BAUD.Bd(), - clocks, - &mut rcc.apb1, - ); - usart2.configure_rx_interrupt(RxEvent::Idle, Switch::On); - // This interrupt is enabled to re-schedule new transfers in the interrupt handler immediately. - usart2.configure_tx_interrupt(TxEvent::TransmissionComplete, Switch::On); + */ + //pins.1.internal_pull_up(&mut gpioa.pupdr, true); + /* + let mut usart2 = Serial::new( + cx.device.USART2, + pins, + UART_BAUD.Bd(), + clocks, + &mut rcc.apb1, + ); + usart2.configure_rx_interrupt(RxEvent::Idle, Switch::On); + // This interrupt is enabled to re-schedule new transfers in the interrupt handler immediately. + usart2.configure_tx_interrupt(TxEvent::TransmissionComplete, Switch::On); + */ - let dma1 = cx.device.DMA1.split(&mut rcc.ahb); - let (mut tx_serial, mut rx_serial) = usart2.split(); + //let dma1 = cx.device.DMA1.split(&mut rcc.ahb); + //let (mut tx_serial, mut rx_serial) = usart2.split(); // This interrupt is immediately triggered, clear it. It will only be reset // by the hardware when data is received on RX (RXNE event) - rx_serial.clear_event(RxEvent::Idle); + //rx_serial.clear_event(RxEvent::Idle); // For some reason, this is also immediately triggered.. - tx_serial.clear_event(TxEvent::TransmissionComplete); - let rx_transfer = rx_serial.read_exact(unsafe { DMA_RX_BUF.as_mut_slice() }, dma1.ch6); + //tx_serial.clear_event(TxEvent::TransmissionComplete); + //let rx_transfer = rx_serial.read_exact(unsafe { DMA_RX_BUF.as_mut_slice() }, dma1.ch6); defmt::info!("Spawning tasks"); - blink::spawn().unwrap(); + blinky::spawn().unwrap(); serial_tx_handler::spawn().unwrap(); let verif_reporter = VerificationReportCreator::new(PUS_APID).unwrap(); @@ -349,118 +221,49 @@ mod app { ( Shared { blink_freq: MillisDurationU32::from_ticks(DEFAULT_BLINK_FREQ_MS), - tx_shared: UartTxShared { - last_completed: None, - state: UartTxState::Idle(Some(TxIdle { - tx: tx_serial, - dma_channel: dma1.ch7, - })), - }, - rx_transfer: Some(rx_transfer), }, Local { verif_reporter, leds, - last_dir: Direction::North, - curr_dir: Direction::iter(), + tm_prod, + tm_cons, + tx, + rx: rx.into_ring_buffered(DMA_BUF.take()), + current_dir: satrs_stm32f3_disco_rtic::Direction::North, }, ) } - #[task(local = [leds, curr_dir, last_dir], shared=[blink_freq])] - async fn blink(mut cx: blink::Context) { - let blink::LocalResources { - leds, - curr_dir, - last_dir, - .. - } = cx.local; - let mut toggle_leds = |dir: &Direction| { - let last_led = leds.for_direction(*last_dir); - last_led.off().ok(); - let led = leds.for_direction(*dir); - led.on().ok(); - *last_dir = *dir; - }; + #[task(local = [leds, current_dir], shared=[blink_freq])] + async fn blinky(mut cx: blinky::Context) { loop { - match curr_dir.next() { - Some(dir) => { - toggle_leds(dir); - } - None => { - *curr_dir = Direction::iter(); - toggle_leds(curr_dir.next().unwrap()); - } - } + cx.local.leds.blink_next(cx.local.current_dir); let current_blink_freq = cx.shared.blink_freq.lock(|current| *current); Mono::delay(current_blink_freq).await; } } #[task( - shared = [tx_shared], + local = [ + tm_cons, + tx, + dma_buf: [u8; TM_BUF_LEN] = [0; TM_BUF_LEN] + ], + shared = [], )] - async fn serial_tx_handler(mut cx: serial_tx_handler::Context) { + async fn serial_tx_handler(cx: serial_tx_handler::Context) { loop { - let is_idle = cx.shared.tx_shared.lock(|tx_shared| { - if let UartTxState::Idle(_) = tx_shared.state { - return true; - } - false - }); - if is_idle { - let last_completed = cx.shared.tx_shared.lock(|shared| shared.last_completed); - if let Some(last_completed) = last_completed { - let elapsed_ms = (Mono::now() - last_completed).to_millis(); - if elapsed_ms < MIN_DELAY_BETWEEN_TX_PACKETS_MS { - Mono::delay((MIN_DELAY_BETWEEN_TX_PACKETS_MS - elapsed_ms).millis()).await; - } - } - } else { - // Check for completion after 1 ms - Mono::delay(1.millis()).await; + while let Some(vec) = cx.local.tm_cons.dequeue() { + cx.local.dma_buf[0] = 0; + let encoded_len = cobs::encode(&vec[0..vec.len()], &mut cx.local.dma_buf[1..]); + // Should never panic, we accounted for the overhead. + // Write into transfer buffer directly, no need for intermediate + // encoding buffer. + // 0 end marker + cx.local.dma_buf[encoded_len + 1] = 0; + cx.local.tx.write(&vec[0..encoded_len + 2]).await.unwrap(); continue; } - if let Some(vec) = TM_REQUESTS.dequeue() { - cx.shared - .tx_shared - .lock(|tx_shared| match &mut tx_shared.state { - UartTxState::Idle(tx) => { - let encoded_len; - //debug!(target: "serial_tx_handler", "bytes: {:x?}", &buf[0..len]); - // Safety: We only copy the data into the TX DMA buffer in this task. - // If the DMA is active, another branch will be taken. - unsafe { - // 0 sentinel value as start marker - DMA_TX_BUF[0] = 0; - encoded_len = - cobs::encode(&vec[0..vec.len()], &mut DMA_TX_BUF[1..]); - // Should never panic, we accounted for the overhead. - // Write into transfer buffer directly, no need for intermediate - // encoding buffer. - // 0 end marker - DMA_TX_BUF[encoded_len + 1] = 0; - } - //debug!(target: "serial_tx_handler", "Sending {} bytes", encoded_len + 2); - //debug!("sent: {:x?}", &mut_tx_dma_buf[0..encoded_len + 2]); - let tx_idle = tx.take().unwrap(); - // Transfer completion and re-scheduling of new TX transfers will be done - // by the IRQ handler. - // SAFETY: The DMA is the exclusive writer to the DMA buffer now. - let transfer = tx_idle.tx.write_all( - unsafe { &DMA_TX_BUF[0..encoded_len + 2] }, - tx_idle.dma_channel, - ); - tx_shared.state = UartTxState::Transmitting(Some(transfer)); - // The memory block is automatically returned to the pool when it is dropped. - } - UartTxState::Transmitting(_) => (), - }); - // Check for completion after 1 ms - Mono::delay(1.millis()).await; - continue; - } - // Nothing to do, and we are idle. Mono::delay(TX_HANDLER_FREQ_MS.millis()).await; } } @@ -468,6 +271,9 @@ mod app { #[task( local = [ verif_reporter, + tm_prod, + rx, + read_buf: [u8; 128] = [0; 128], decode_buf: [u8; MAX_TC_LEN] = [0; MAX_TC_LEN], src_data_buf: [u8; MAX_TM_LEN] = [0; MAX_TM_LEN], timestamp: [u8; 7] = [0; 7], @@ -478,6 +284,18 @@ mod app { mut cx: serial_rx_handler::Context, received_packet: Vec, ) { + let decoder = cobs::CobsDecoder::new(cx.local.decode_buf); + loop { + let read_bytes = cx.local.rx.read(cx.local.read_buf).await; + match decoder.push(&cx.local.read_buf[0..read_bytes]) { + Ok(None) => (), + Ok(Some(report)) => { + + } + Err(_) => {}, + } + + } cx.local.timestamp[0] = P_FIELD_BASE; defmt::info!("Received packet with {} bytes", received_packet.len()); let decode_buf = cx.local.decode_buf; @@ -494,21 +312,24 @@ mod app { return; } let start_idx = start_idx.unwrap(); + decoder.push(data) match cobs::decode(&received_packet.as_slice()[start_idx..], decode_buf) { - Ok(len) => { - defmt::info!("Decoded packet length: {}", len); + Ok(decode_report) => { + defmt::info!("Decoded packet length: {}", decode_report.frame_size()); let pus_tc = PusTcReader::new(decode_buf); match pus_tc { - Ok((tc, _tc_len)) => { + Ok(tc) => { match convert_pus_tc_to_request( &tc, cx.local.verif_reporter, + cx.local.tm_prod, cx.local.src_data_buf, cx.local.timestamp, ) { Ok(request_with_token) => { - let started_token = handle_start_verification( - request_with_token.token, + handle_start_verification( + request_with_token.request_id, + cx.local.tm_prod, cx.local.verif_reporter, cx.local.src_data_buf, cx.local.timestamp, @@ -516,7 +337,7 @@ mod app { match request_with_token.request { Request::Ping => { - handle_ping_request(cx.local.timestamp); + handle_ping_request(cx.local.tm_prod, cx.local.timestamp); } Request::ChangeBlinkFrequency(new_freq_ms) => { defmt::info!("Received blink frequency change request with new frequncy {}", new_freq_ms); @@ -527,7 +348,8 @@ mod app { } } handle_completion_verification( - started_token, + request_with_token.request_id, + cx.local.tm_prod, cx.local.verif_reporter, cx.local.src_data_buf, cx.local.timestamp, @@ -550,7 +372,10 @@ mod app { } } - fn handle_ping_request(timestamp: &[u8]) { + fn handle_ping_request( + tm_prod: &mut heapless::spsc::Producer<'static, TmPacket>, + timestamp: &[u8], + ) { defmt::info!("Received PUS ping telecommand, sending ping reply TM[17,2]"); let sp_header = SpHeader::new_for_unseg_tc(PUS_APID, SEQ_COUNT_PROVIDER.get_and_increment(), 0); @@ -561,36 +386,36 @@ mod app { .resize(ping_reply.len_written(), 0) .expect("vec resize failed"); ping_reply.write_to_bytes(&mut tm_packet).unwrap(); - if TM_REQUESTS.enqueue(tm_packet).is_err() { + if tm_prod.enqueue(tm_packet).is_err() { defmt::warn!("TC queue full"); - return; } } fn handle_start_verification( - accepted_token: VerificationToken, + request_id: satrs::pus::verification::RequestId, + tm_prod: &mut heapless::spsc::Producer, verif_reporter: &mut VerificationReportCreator, src_data_buf: &mut [u8], timestamp: &[u8], - ) -> VerificationToken { - let (tm_creator, started_token) = verif_reporter + ) { + let tm_creator = verif_reporter .start_success( src_data_buf, - accepted_token, + &request_id, SEQ_COUNT_PROVIDER.get(), 0, - ×tamp, + timestamp, ) .unwrap(); - let result = send_tm(tm_creator); + let result = send_tm(tm_creator, tm_prod); if let Err(e) = result { handle_tm_send_error(e); } - started_token } fn handle_completion_verification( - started_token: VerificationToken, + request_id: satrs::pus::verification::RequestId, + tm_prod: &mut heapless::spsc::Producer, verif_reporter: &mut VerificationReportCreator, src_data_buf: &mut [u8], timestamp: &[u8], @@ -599,20 +424,23 @@ mod app { verif_reporter .completion_success( src_data_buf, - started_token, + &request_id, SEQ_COUNT_PROVIDER.get(), 0, timestamp, ) .unwrap(), + tm_prod, ); if let Err(e) = result { handle_tm_send_error(e); } } - #[task(binds = DMA1_CH6, shared = [rx_transfer])] - fn rx_dma_isr(mut cx: rx_dma_isr::Context) { + /* + #[task(binds = DMA1_CH6, shared = [])] + fn rx_dma_isr(cx: rx_dma_isr::Context) { + /* let mut tc_packet = TcPacket::new(); cx.shared.rx_transfer.lock(|rx_transfer| { let rx_ref = rx_transfer.as_ref().unwrap(); @@ -638,45 +466,156 @@ mod app { ); } }); + */ + } + */ + + /* + #[task(binds = USART2_EXTI26, shared = [])] + fn serial_isr(mut cx: serial_isr::Context) { + /* + cx.shared + .tx_shared + .lock(|tx_shared| match &mut tx_shared.state { + UartTxState::Idle(_) => (), + UartTxState::Transmitting(transfer) => { + let transfer_ref = transfer.as_ref().unwrap(); + if transfer_ref.is_complete() { + let transfer = transfer.take().unwrap(); + let (_, dma_channel, mut tx) = transfer.stop(); + tx.clear_event(TxEvent::TransmissionComplete); + tx_shared.state = UartTxState::Idle(Some(TxIdle { tx, dma_channel })); + // We cache the last completed time to ensure that there is a minimum delay between consecutive + // transferred packets. + tx_shared.last_completed = Some(Mono::now()); + } + } + }); + let mut tc_packet = TcPacket::new(); + cx.shared.rx_transfer.lock(|rx_transfer| { + let rx_transfer_ref = rx_transfer.as_ref().unwrap(); + // Received a partial packet. + if rx_transfer_ref.is_event_triggered(RxEvent::Idle) { + let rx_transfer_owned = rx_transfer.take().unwrap(); + let (buf, ch, mut rx, rx_len) = rx_transfer_owned.stop_and_return_received_bytes(); + // The received data is transferred to another task now to avoid any processing overhead + // during the interrupt. There are multiple ways to do this, we use a stack + // allocated vector to do this. + tc_packet + .resize(rx_len as usize, 0) + .expect("vec resize failed"); + tc_packet[0..rx_len as usize].copy_from_slice(&buf[0..rx_len as usize]); + rx.clear_event(RxEvent::Idle); + serial_rx_handler::spawn(tc_packet).expect("spawning rx handler failed"); + *rx_transfer = Some(rx.read_exact(buf, ch)); + } + }); + */ + } + */ +} + +fn send_tm( + tm_creator: PusTmCreator, + tm_prod: &mut heapless::spsc::Producer, +) -> Result<(), TmSendError> { + if tm_creator.len_written() > MAX_TM_LEN { + return Err(ByteConversionError::ToSliceTooSmall { + expected: tm_creator.len_written(), + found: MAX_TM_LEN, + } + .into()); + } + let mut tm_vec = TmPacket::new(); + tm_vec + .resize(tm_creator.len_written(), 0) + .expect("vec resize failed"); + tm_creator.write_to_bytes(tm_vec.as_mut_slice())?; + defmt::info!( + "Sending TM[{},{}] with size {}", + tm_creator.service(), + tm_creator.subservice(), + tm_creator.len_written() + ); + tm_prod.enqueue(tm_vec).map_err(|_| TmSendError::Queue)?; + Ok(()) +} + +fn handle_tm_send_error(error: TmSendError) { + defmt::warn!("sending tm failed with error {}", error); +} + +pub fn convert_pus_tc_to_request( + tc: &PusTcReader, + verif_reporter: &mut VerificationReportCreator, + tm_prod: &mut heapless::spsc::Producer<'static, TmPacket>, + src_data_buf: &mut [u8], + timestamp: &[u8], +) -> Result { + defmt::info!( + "Found PUS TC [{},{}] with length {}", + tc.service(), + tc.subservice(), + tc.len_packed() + ); + + let request_id = verif_reporter.read_request_id(tc); + if tc.apid() != PUS_APID { + defmt::warn!("Received tc with unknown APID {}", tc.apid()); + let result = send_tm( + verif_reporter + .acceptance_failure( + src_data_buf, + &request_id, + SEQ_COUNT_PROVIDER.get_and_increment(), + 0, + FailParams::new(timestamp, &EcssEnumU16::new(0), &[]), + ) + .unwrap(), + tm_prod, + ); + if let Err(e) = result { + handle_tm_send_error(e); + } + return Err(RequestError::InvalidApid); + } + let tm_creator = verif_reporter + .acceptance_success( + src_data_buf, + &request_id, + SEQ_COUNT_PROVIDER.get_and_increment(), + 0, + timestamp, + ) + .unwrap(); + + if let Err(e) = send_tm(tm_creator, tm_prod) { + handle_tm_send_error(e); } - #[task(binds = USART2_EXTI26, shared = [rx_transfer, tx_shared])] - fn serial_isr(mut cx: serial_isr::Context) { - cx.shared - .tx_shared - .lock(|tx_shared| match &mut tx_shared.state { - UartTxState::Idle(_) => (), - UartTxState::Transmitting(transfer) => { - let transfer_ref = transfer.as_ref().unwrap(); - if transfer_ref.is_complete() { - let transfer = transfer.take().unwrap(); - let (_, dma_channel, mut tx) = transfer.stop(); - tx.clear_event(TxEvent::TransmissionComplete); - tx_shared.state = UartTxState::Idle(Some(TxIdle { tx, dma_channel })); - // We cache the last completed time to ensure that there is a minimum delay between consecutive - // transferred packets. - tx_shared.last_completed = Some(Mono::now()); - } - } - }); - let mut tc_packet = TcPacket::new(); - cx.shared.rx_transfer.lock(|rx_transfer| { - let rx_transfer_ref = rx_transfer.as_ref().unwrap(); - // Received a partial packet. - if rx_transfer_ref.is_event_triggered(RxEvent::Idle) { - let rx_transfer_owned = rx_transfer.take().unwrap(); - let (buf, ch, mut rx, rx_len) = rx_transfer_owned.stop_and_return_received_bytes(); - // The received data is transferred to another task now to avoid any processing overhead - // during the interrupt. There are multiple ways to do this, we use a stack - // allocated vector to do this. - tc_packet - .resize(rx_len as usize, 0) - .expect("vec resize failed"); - tc_packet[0..rx_len as usize].copy_from_slice(&buf[0..rx_len as usize]); - rx.clear_event(RxEvent::Idle); - serial_rx_handler::spawn(tc_packet).expect("spawning rx handler failed"); - *rx_transfer = Some(rx.read_exact(buf, ch)); + if tc.service() == 17 && tc.subservice() == 1 { + if tc.subservice() == 1 { + Ok(RequestWithToken { + request_id, + request: Request::Ping, + }) + } else { + Err(RequestError::InvalidSubservice) + } + } else if tc.service() == 8 { + if tc.subservice() == 1 { + if tc.user_data().len() < 4 { + return Err(RequestError::NotEnoughAppData); } - }); + let new_freq_ms = u32::from_be_bytes(tc.user_data()[0..4].try_into().unwrap()); + Ok(RequestWithToken { + request_id, + request: Request::ChangeBlinkFrequency(new_freq_ms), + }) + } else { + Err(RequestError::InvalidSubservice) + } + } else { + Err(RequestError::InvalidService) } } diff --git a/embedded-examples/stm32h7-nucleo-rtic/Cargo.lock b/embedded-examples/stm32h7-nucleo-rtic/Cargo.lock index aa4b9fb..6e4df86 100644 --- a/embedded-examples/stm32h7-nucleo-rtic/Cargo.lock +++ b/embedded-examples/stm32h7-nucleo-rtic/Cargo.lock @@ -3,10 +3,19 @@ version = 4 [[package]] -name = "autocfg" -version = "1.4.0" +name = "aho-corasick" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "bare-metal" @@ -54,16 +63,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] -name = "cfg-if" -version = "1.0.0" +name = "cc" +version = "1.2.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "5252b3d2648e5eedbc1a6f501e3c795e07025c1e93bbf8bbdd6eef7f447a6d54" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" [[package]] name = "cobs" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1" +checksum = "fea6d1b751c55bd9c0dda7d4ff752074e98f4765ae969664648bd193bb326d15" dependencies = [ "thiserror", ] @@ -104,7 +123,7 @@ checksum = "e37549a379a9e0e6e576fd208ee60394ccb8be963889eebba3ffe0980364f472" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.106", ] [[package]] @@ -118,9 +137,9 @@ dependencies = [ [[package]] name = "crc" -version = "3.2.1" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" +checksum = "9710d3b3739c2e349eb44fe848ad0b7c8cb1e42bd87ee49371df2f7acaf3e675" dependencies = [ "crc-catalog", ] @@ -139,9 +158,18 @@ checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" [[package]] name = "defmt" -version = "0.3.10" +version = "0.3.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" +dependencies = [ + "defmt 1.0.1", +] + +[[package]] +name = "defmt" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" dependencies = [ "bitflags", "defmt-macros", @@ -154,63 +182,63 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2f0ac3635d0c89d12b8101fcb44a7625f5f030a1c0491124b74467eb5a58a78" dependencies = [ "critical-section", - "defmt", + "defmt 0.3.100", ] [[package]] name = "defmt-macros" -version = "0.4.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" dependencies = [ "defmt-parser", "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.106", ] [[package]] name = "defmt-parser" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" dependencies = [ "thiserror", ] [[package]] name = "defmt-test" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290966e8c38f94b11884877242de876280d0eab934900e9642d58868e77c5df1" +checksum = "24076cc7203c365e7febfcec15d6667a9ef780bd2c5fd3b2a197400df78f299b" dependencies = [ "cortex-m-rt", "cortex-m-semihosting", - "defmt", + "defmt 1.0.1", "defmt-test-macros", ] [[package]] name = "defmt-test-macros" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "984bc6eca246389726ac2826acc2488ca0fe5fcd6b8d9b48797021951d76a125" +checksum = "fe5520fd36862f281c026abeaab153ebbc001717c29a9b8e5ba9704d8f3a879d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.106", ] [[package]] name = "delegate" -version = "0.13.2" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "297806318ef30ad066b15792a8372858020ae3ca2e414ee6c2133b1eb9e9e945" +checksum = "6178a82cf56c836a3ba61a7935cdb1c49bfaa6fa4327cd5bf554a503087de26b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.106", ] [[package]] @@ -221,7 +249,7 @@ checksum = "2cdc8d50f426189eef89dac62fabfa0abb27d5cc008f25bf4156a0203325becc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.106", ] [[package]] @@ -261,7 +289,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -270,18 +298,18 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-hal 1.0.0", ] [[package]] name = "embedded-hal-bus" -version = "0.1.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57b4e6ede84339ebdb418cd986e6320a34b017cdf99b5cc3efceec6450b06886" +checksum = "513e0b3a8fb7d3013a8ae17a834283f170deaf7d0eeab0a7c1a36ad4dd356d22" dependencies = [ "critical-section", - "defmt", + "defmt 0.3.100", "embedded-hal 1.0.0", "embedded-hal-async", ] @@ -294,9 +322,15 @@ checksum = "a21dea9854beb860f3062d10228ce9b976da520a73474aed3171ec276bc0c032" [[package]] name = "equivalent" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "find-msvc-tools" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fd99930f64d146689264c637b5af2f0233a933bef0d8570e2526bf9e083192d" [[package]] name = "fugit" @@ -337,6 +371,20 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" +[[package]] +name = "generator" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "605183a538e3e2a9c1038635cc5c2d194e2ee8fd0d1b66b8349fad7dbacce5a2" +dependencies = [ + "cc", + "cfg-if", + "libc", + "log", + "rustversion", + "windows", +] + [[package]] name = "hash32" version = "0.3.1" @@ -348,9 +396,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.2" +version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" [[package]] name = "heapless" @@ -358,26 +406,42 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" dependencies = [ - "defmt", + "defmt 0.3.100", + "hash32", + "stable_deref_trait", +] + +[[package]] +name = "heapless" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1edcd5a338e64688fbdcb7531a846cfd3476a54784dcb918a0844682bc7ada5" +dependencies = [ "hash32", "stable_deref_trait", ] [[package]] name = "indexmap" -version = "2.7.1" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9c992b02b5b4c94ea26e32fe5bccb7aa7d9f390ab5c1221ff895bc7ea8b652" +checksum = "f2481980430f9f78649238835720ddccc57e52df14ffce1c6f37391d61b563e9" dependencies = [ "equivalent", "hashbrown", ] [[package]] -name = "libc" -version = "0.2.169" +name = "lazy_static" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.175" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" [[package]] name = "linked_list_allocator" @@ -385,12 +449,47 @@ version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9afa463f5405ee81cdb9cc2baf37e08ec7e4c8209442b5d72c04cfb2cd6e6286" +[[package]] +name = "log" +version = "0.4.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" + +[[package]] +name = "loom" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "419e0dc8046cb947daa77eb95ae174acfbddb7673b4151f56d1eed8e93fbfaca" +dependencies = [ + "cfg-if", + "generator", + "pin-utils", + "scoped-tls", + "tracing", + "tracing-subscriber", +] + [[package]] name = "managed" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ca88d725a0a943b096803bd34e73a4437208b6077654cc4ecb2947a5f91618d" +[[package]] +name = "matchers" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "memchr" +version = "2.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" + [[package]] name = "nb" version = "0.1.3" @@ -406,6 +505,15 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" +[[package]] +name = "nu-ansi-term" +version = "0.50.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4a28e057d01f97e61255210fcff094d74ed0466038633e95017f5beb68e4399" +dependencies = [ + "windows-sys", +] + [[package]] name = "num-traits" version = "0.2.19" @@ -417,32 +525,39 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e613fc340b2220f734a8595782c551f1250e969d87d3be1ae0579e8d4065179" +checksum = "a973b4e44ce6cad84ce69d797acf9a044532e4184c4f267913d1b546a0727b7a" dependencies = [ "num_enum_derive", + "rustversion", ] [[package]] name = "num_enum_derive" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" +checksum = "77e878c846a8abae00dd069496dbe8751b16ac1c3d6bd2a7283a938e8228f90d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.106", ] [[package]] -name = "panic-probe" -version = "0.3.2" +name = "once_cell" +version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4047d9235d1423d66cc97da7d07eddb54d4f154d6c13805c6d0793956f4f25b0" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "panic-probe" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" dependencies = [ "cortex-m", - "defmt", + "defmt 1.0.1", ] [[package]] @@ -465,9 +580,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "portable-atomic" -version = "1.10.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" +checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" [[package]] name = "proc-macro-error-attr2" @@ -488,27 +603,44 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.106", ] [[package]] name = "proc-macro2" -version = "1.0.93" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.38" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] +[[package]] +name = "regex-automata" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b9458fa0bfeeac22b5ca447c63aaf45f28439a709ccd244698632f9aa6394d6" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001" + [[package]] name = "rlsf" version = "0.2.1" @@ -523,9 +655,9 @@ dependencies = [ [[package]] name = "rtic" -version = "2.1.2" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "401961431a1e491124cdd216a313fada2d395aa2b5bee2867c872fc8af7c1bc1" +checksum = "6bc68b1fa2eefbb7ad6747b299b79c8fca92163dfa46f0e279f39109cf272186" dependencies = [ "bare-metal 1.0.0", "cortex-m", @@ -537,11 +669,12 @@ dependencies = [ [[package]] name = "rtic-common" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0786b50b81ef9d2a944a000f60405bb28bf30cd45da2d182f3fe636b2321f35c" +checksum = "67caeecca87cb20e1101eb104b0f05604633b7ab1035cce777417c6fb7c8f9a0" dependencies = [ "critical-section", + "portable-atomic", ] [[package]] @@ -552,22 +685,22 @@ checksum = "d9369355b04d06a3780ec0f51ea2d225624db777acbc60abd8ca4832da5c1a42" [[package]] name = "rtic-macros" -version = "2.1.2" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac22ab522d80079b48f46ac66ded4d349e1adf81b52430d6a74faa3a7790ed80" +checksum = "f387b12bd6c01d2c9d4776dddeefaf0ae51b9497c83c0186b1693f6821ff3c4a" dependencies = [ "indexmap", "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.106", ] [[package]] name = "rtic-monotonics" -version = "2.0.3" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1cb90bcfdbbacf3ca37340cdab52ec2de5611c744095ef7889e9c50c233b748" +checksum = "99f9923ce32637ee40c0cb28fbbc2fad880d8aebea2d545918c6971ae9be3d17" dependencies = [ "cfg-if", "cortex-m", @@ -578,25 +711,26 @@ dependencies = [ [[package]] name = "rtic-sync" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49b1200137ccb2bf272a1801fa6e27264535facd356cb2c1d5bc8e12aa211bad" +checksum = "d378d811a8e25411a139f1428804e390fb2dc9b5bcf84e880a19c25feaa89a2a" dependencies = [ "critical-section", - "defmt", + "defmt 0.3.100", "embedded-hal 1.0.0", "embedded-hal-async", "embedded-hal-bus", - "heapless", + "heapless 0.8.0", + "loom", "portable-atomic", "rtic-common", ] [[package]] name = "rtic-time" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7b1d853fa50dc125695414ce4510567a0d420221e455b1568cfa8c9aece9614" +checksum = "61485474f5a23247ae1d4875f2bfe860be9b3030dbf87c232e50799e021429a1" dependencies = [ "critical-section", "embedded-hal 1.0.0", @@ -615,21 +749,24 @@ dependencies = [ "semver", ] +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + [[package]] name = "satrs" -version = "0.2.1" +version = "0.3.0-alpha.2" dependencies = [ "cobs", - "crc", - "defmt", + "defmt 1.0.1", "delegate", "derive-new", - "heapless", - "num-traits", + "heapless 0.9.1", "num_enum", "paste", "satrs-shared", - "smallvec", "spacepackets", "static_cell", "thiserror", @@ -637,9 +774,7 @@ dependencies = [ [[package]] name = "satrs-shared" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f10b962c131d0bcb0de06fefa5d4716cbd7f836167f90229f7f38405dc573bd3" +version = "0.2.3" dependencies = [ "spacepackets", ] @@ -651,7 +786,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "cortex-m-semihosting", - "defmt", + "defmt 1.0.1", "defmt-brtt", "defmt-test", "embedded-alloc", @@ -660,10 +795,16 @@ dependencies = [ "rtic-monotonics", "rtic-sync", "satrs", - "smoltcp", + "smoltcp 0.12.0", "stm32h7xx-hal", ] +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + [[package]] name = "semver" version = "0.9.0" @@ -680,10 +821,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] -name = "smallvec" -version = "1.13.2" +name = "sharded-slab" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] name = "smoltcp" @@ -694,19 +850,32 @@ dependencies = [ "bitflags", "byteorder", "cfg-if", - "defmt", - "heapless", + "heapless 0.8.0", + "managed", +] + +[[package]] +name = "smoltcp" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dad095989c1533c1c266d9b1e8d70a1329dd3723c3edac6d03bbd67e7bf6f4bb" +dependencies = [ + "bitflags", + "byteorder", + "cfg-if", + "defmt 0.3.100", + "heapless 0.8.0", "managed", ] [[package]] name = "spacepackets" -version = "0.13.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "591d42bfa6af2ab308e5efd8f0870e2d0eb5dd19a141bdcb7da731f5ff9cc11c" +checksum = "95ca19d2a251259686f6fffb094a8e32824098f387cd613ae81bfe4216524d02" dependencies = [ "crc", - "defmt", + "defmt 1.0.1", "delegate", "num-traits", "num_enum", @@ -723,9 +892,9 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "static_cell" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d89b0684884a883431282db1e4343f34afc2ff6996fe1f4a1664519b66e14c1e" +checksum = "0530892bb4fa575ee0da4b86f86c667132a94b74bb72160f58ee5a4afec74c23" dependencies = [ "portable-atomic", ] @@ -757,7 +926,7 @@ dependencies = [ "fugit", "nb 1.1.0", "paste", - "smoltcp", + "smoltcp 0.11.0", "stm32h7", "void", ] @@ -788,9 +957,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.96" +version = "2.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" dependencies = [ "proc-macro2", "quote", @@ -799,29 +968,87 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.11" +version = "2.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc" +checksum = "3467d614147380f2e4e374161426ff399c91084acd2363eaf549172b3d5e60c0" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "2.0.11" +version = "2.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2" +checksum = "6c5e1be1c48b9172ee610da68fd9cd2770e7a4056cb3fc98710ee6906f0c7960" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.106", +] + +[[package]] +name = "thread_local" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "tracing" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex-automata", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", ] [[package]] name = "unicode-ident" -version = "1.0.16" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a210d160f08b701c8721ba1c726c11662f877ea6b7094007e1ca9a1041945034" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] name = "unicode-width" @@ -829,6 +1056,12 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + [[package]] name = "vcell" version = "0.1.3" @@ -851,21 +1084,205 @@ dependencies = [ ] [[package]] -name = "zerocopy" -version = "0.8.14" +name = "windows" +version = "0.61.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a367f292d93d4eab890745e75a778da40909cab4d6ff8173693812f79c4a2468" +checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" +dependencies = [ + "windows-collections", + "windows-core", + "windows-future", + "windows-link", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" +dependencies = [ + "windows-core", +] + +[[package]] +name = "windows-core" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-future" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" +dependencies = [ + "windows-core", + "windows-link", + "windows-threading", +] + +[[package]] +name = "windows-implement" +version = "0.60.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "windows-interface" +version = "0.59.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "windows-link" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + +[[package]] +name = "windows-numerics" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" +dependencies = [ + "windows-core", + "windows-link", +] + +[[package]] +name = "windows-result" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows-threading" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "zerocopy" +version = "0.8.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.14" +version = "0.8.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3931cb58c62c13adec22e38686b559c86a30565e16ad6e8510a337cedc611e1" +checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.106", ] diff --git a/embedded-examples/stm32h7-nucleo-rtic/Cargo.toml b/embedded-examples/stm32h7-nucleo-rtic/Cargo.toml index 62e87b8..5eb08b8 100644 --- a/embedded-examples/stm32h7-nucleo-rtic/Cargo.toml +++ b/embedded-examples/stm32h7-nucleo-rtic/Cargo.toml @@ -16,16 +16,17 @@ harness = false [dependencies] cortex-m = { version = "0.7", features = ["critical-section-single-core"] } cortex-m-rt = "0.7" -defmt = "0.3" +defmt = "1" defmt-brtt = { version = "0.1", default-features = false, features = ["rtt"] } -panic-probe = { version = "0.3", features = ["print-defmt"] } +panic-probe = { version = "1", features = ["print-defmt"] } cortex-m-semihosting = "0.5.0" +# TODO: Replace with embassy-hal. stm32h7xx-hal = { version="0.16", features= ["stm32h743v", "ethernet"] } embedded-alloc = "0.6" rtic-sync = { version = "1", features = ["defmt-03"] } [dependencies.smoltcp] -version = "0.11" +version = "0.12" default-features = false features = ["medium-ethernet", "proto-ipv4", "socket-raw", "socket-dhcpv4", "socket-udp", "defmt"] @@ -39,12 +40,12 @@ features = ["cortex-m-systick"] [dependencies.satrs] path = "../../satrs" -version = "0.2" +# version = "0.2" default-features = false features = ["defmt", "heapless"] [dev-dependencies] -defmt-test = "0.3" +defmt-test = "0.4" # cargo build/run [profile.dev] diff --git a/satrs/src/pus/verification.rs b/satrs/src/pus/verification.rs index 2db42c4..c82c8a9 100644 --- a/satrs/src/pus/verification.rs +++ b/satrs/src/pus/verification.rs @@ -511,9 +511,7 @@ impl VerificationReportCreator { self.dest_id = dest_id; } - /// Initialize verification handling by passing a TC reference. This returns a token required - /// to call the acceptance functions - pub fn read_request_id_from_tc(pus_tc: &(impl CcsdsPacket + IsPusTelecommand)) -> RequestId { + pub fn read_request_id(&self, pus_tc: &(impl CcsdsPacket + IsPusTelecommand)) -> RequestId { RequestId::new(pus_tc) } @@ -903,7 +901,7 @@ pub mod alloc_mod { > { owner_id: ComponentId, source_data_buf: RefCell>, - pub reporter_creator: VerificationReportCreator, + pub report_creator: VerificationReportCreator, pub tm_hook: VerificationHookInstance, } @@ -919,7 +917,7 @@ pub mod alloc_mod { + cfg.fail_code_field_width + cfg.max_fail_data_len ]), - reporter_creator: reporter, + report_creator: reporter, tm_hook: DummyVerificationHook::default(), } } @@ -943,7 +941,7 @@ pub mod alloc_mod { + cfg.fail_code_field_width + cfg.max_fail_data_len ]), - reporter_creator: reporter, + report_creator: reporter, tm_hook, } } @@ -952,9 +950,7 @@ pub mod alloc_mod { &self, pus_tc: &(impl CcsdsPacket + IsPusTelecommand), ) -> VerificationToken { - VerificationToken::::new( - VerificationReportCreator::read_request_id_from_tc(pus_tc), - ) + VerificationToken::::new(self.report_creator.read_request_id(pus_tc)) } pub fn start_verification_with_req_id( @@ -965,7 +961,7 @@ pub mod alloc_mod { } delegate!( - to self.reporter_creator { + to self.report_creator { pub fn set_apid(&mut self, apid: u16) -> bool; pub fn apid(&self) -> u16; pub fn dest_id(&self) -> u16; @@ -982,7 +978,7 @@ pub mod alloc_mod { for VerificationReporter { delegate!( - to self.reporter_creator { + to self.report_creator { fn set_apid(&mut self, apid: Apid); fn apid(&self) -> Apid; } @@ -1008,7 +1004,7 @@ pub mod alloc_mod { ) -> Result, EcssTmtcError> { let mut source_data_buf = self.source_data_buf.borrow_mut(); let mut tm_creator = self - .reporter_creator + .report_creator .acceptance_success( source_data_buf.as_mut_slice(), &token.request_id(), @@ -1031,7 +1027,7 @@ pub mod alloc_mod { ) -> Result<(), EcssTmtcError> { let mut buf = self.source_data_buf.borrow_mut(); let mut tm_creator = self - .reporter_creator + .report_creator .acceptance_failure(buf.as_mut_slice(), &token.request_id(), 0, 0, params) .map_err(PusError::ByteConversion)?; self.tm_hook.modify_tm(&mut tm_creator); @@ -1050,7 +1046,7 @@ pub mod alloc_mod { ) -> Result, EcssTmtcError> { let mut buf = self.source_data_buf.borrow_mut(); let mut tm_creator = self - .reporter_creator + .report_creator .start_success(buf.as_mut_slice(), &token.request_id(), 0, 0, time_stamp) .map_err(PusError::ByteConversion)?; self.tm_hook.modify_tm(&mut tm_creator); @@ -1070,7 +1066,7 @@ pub mod alloc_mod { ) -> Result<(), EcssTmtcError> { let mut buf = self.source_data_buf.borrow_mut(); let mut tm_creator = self - .reporter_creator + .report_creator .start_failure(buf.as_mut_slice(), &token.request_id(), 0, 0, params) .map_err(PusError::ByteConversion)?; self.tm_hook.modify_tm(&mut tm_creator); @@ -1090,7 +1086,7 @@ pub mod alloc_mod { ) -> Result<(), EcssTmtcError> { let mut buf = self.source_data_buf.borrow_mut(); let mut tm_creator = self - .reporter_creator + .report_creator .step_success( buf.as_mut_slice(), &token.request_id(), @@ -1117,7 +1113,7 @@ pub mod alloc_mod { ) -> Result<(), EcssTmtcError> { let mut buf = self.source_data_buf.borrow_mut(); let mut tm_creator = self - .reporter_creator + .report_creator .step_failure(buf.as_mut_slice(), token, 0, 0, params) .map_err(PusError::ByteConversion)?; self.tm_hook.modify_tm(&mut tm_creator); @@ -1138,7 +1134,7 @@ pub mod alloc_mod { ) -> Result<(), EcssTmtcError> { let mut buf = self.source_data_buf.borrow_mut(); let mut tm_creator = self - .reporter_creator + .report_creator .completion_success(buf.as_mut_slice(), &token.request_id(), 0, 0, time_stamp) .map_err(PusError::ByteConversion)?; self.tm_hook.modify_tm(&mut tm_creator); @@ -1158,7 +1154,7 @@ pub mod alloc_mod { ) -> Result<(), EcssTmtcError> { let mut buf = self.source_data_buf.borrow_mut(); let mut tm_creator = self - .reporter_creator + .report_creator .completion_failure(buf.as_mut_slice(), &token.request_id(), 0, 00, params) .map_err(PusError::ByteConversion)?; self.tm_hook.modify_tm(&mut tm_creator);