Thumbnail

steew/gilgamesh.git

Clone URL: https://git.buni.party/steew/gilgamesh.git

commit e63c44c1195e86ceeed629cb16fae93965db8c00 Author: Daniel P. <daniel@steew.eu> Date: Sat Nov 01 18:45:07 2025 +0000 First embassy version diff --git a/fw/RustFM/.cargo/config.toml b/fw/RustFM/.cargo/config.toml index 70caeff..d33ad48 100644 --- a/fw/RustFM/.cargo/config.toml +++ b/fw/RustFM/.cargo/config.toml @@ -109 +109 @@  # runner = "gdb -q -x openocd.gdb"  runner = "probe-rs run --chip STM32L431RCTx"   -rustflags = [ +# rustflags = [   # LLD (shipped with the Rust toolchain) is used as the default linker - "-C", "link-arg=-Tlink.x", + # "-C", "link-arg=-Tlink.x",     # if you run into problems with LLD switch to the GNU linker by commenting out   # this line @@ -247 +247 @@ rustflags = [   # "-C", "linker=arm-none-eabi-gcc",   # "-C", "link-arg=-Wl,-Tlink.x",   # "-C", "link-arg=-nostartfiles", -] +# ]    [build]  # Pick ONE of these compilation targets diff --git a/fw/RustFM/.cargo/config.toml~ b/fw/RustFM/.cargo/config.toml~ new file mode 100644 index 0000000..70caeff --- /dev/null +++ b/fw/RustFM/.cargo/config.toml~ @@ -00 +132 @@ +#[target.thumbv7m-none-eabi] +# uncomment this to make `cargo run` execute programs on QEMU +# runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel" + +[target.'cfg(all(target_arch = "arm", target_os = "none"))'] +# uncomment ONE of these three option to make `cargo run` start a GDB session +# which option to pick depends on your system +# runner = "arm-none-eabi-gdb -q -x openocd.gdb" +# runner = "gdb-multiarch -q -x openocd.gdb" +# runner = "gdb -q -x openocd.gdb" +runner = "probe-rs run --chip STM32L431RCTx" + +rustflags = [ + # LLD (shipped with the Rust toolchain) is used as the default linker + "-C", "link-arg=-Tlink.x", + + # if you run into problems with LLD switch to the GNU linker by commenting out + # this line + # "-C", "linker=arm-none-eabi-ld", + + # if you need to link to pre-compiled C libraries provided by a C toolchain + # use GCC as the linker by commenting out both lines above and then + # uncommenting the three lines below + # "-C", "linker=arm-none-eabi-gcc", + # "-C", "link-arg=-Wl,-Tlink.x", + # "-C", "link-arg=-nostartfiles", +] + +[build] +# Pick ONE of these compilation targets +# target = "thumbv7em-none-eabi" # Cortex-M4 and Cortex-M7 (no FPU) +target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU) \ No newline at end of file diff --git a/fw/RustFM/Cargo.lock b/fw/RustFM/Cargo.lock index 25fbd5c..44e17d5 100644 --- a/fw/RustFM/Cargo.lock +++ b/fw/RustFM/Cargo.lock @@ -328 +343 @@  version = 4    [[package]] -name = "aho-corasick" -version = "1.1.3" +name = "aligned" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "377e4c0ba83e4431b10df45c1d4666f178ea9c552cac93e60c3a88bf32785923" +dependencies = [ + "as-slice", +] + +[[package]] +name = "as-slice" +version = "0.2.1"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516"  dependencies = [ - "memchr", + "stable_deref_trait",  ]   +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +  [[package]]  name = "bare-metal"  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]] -name = "bare-metal" -version = "1.0.0" +name = "bit_field" +version = "0.10.3"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8fe8f5a8a398345e52358e18ff07cc17a568fbca5c6f73873d3a62056309603" +checksum = "1e4b40c7323adcfc0a41c4b88143ed58346ff65a288fc144329c5c45e05d70c6"    [[package]]  name = "bitfield" @@ -3914 +5418 @@ source = "registry+https://github.com/rust-lang/crates.io-index"  checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"    [[package]] -name = "bxcan" -version = "0.6.2" +name = "bitflags" +version = "2.10.0"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b13b4b2ea9ab2ba924063ebb86ad895cb79f4a79bf90f27949eb20c335b30f9" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" + +[[package]] +name = "block-device-driver" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c051592f59fe68053524b4c4935249b806f72c1f544cfb7abe4f57c3be258e"  dependencies = [ - "bitflags", - "nb 1.1.0", - "vcell", + "aligned",  ]    [[package]] @@ -5637 +7527 @@ source = "registry+https://github.com/rust-lang/crates.io-index"  checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"    [[package]] -name = "cast" -version = "0.2.7" +name = "cfg-if" +version = "1.0.4"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c24dab4283a142afa2fdca129b80ad2c6284e073930f964c3a1293c225ee39a" -dependencies = [ - "rustc_version 0.4.1", -] +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"    [[package]] -name = "cc" -version = "1.2.41" +name = "chrono" +version = "0.4.42"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac9fe6cdbb24b6ade63616c0a0688e45bb56732262c158df3c0c4bea4ca47cb7" +checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2"  dependencies = [ - "find-msvc-tools", - "shlex", + "num-traits",  ]   -[[package]] -name = "cfg-if" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" -  [[package]]  name = "cortex-m"  version = "0.7.7"  source = "registry+https://github.com/rust-lang/crates.io-index"  checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9"  dependencies = [ - "bare-metal 0.2.5", + "bare-metal",   "bitfield",   "critical-section",   "embedded-hal 0.2.7", @@ -11315 +1226 @@ dependencies = [   "syn",  ]   -[[package]] -name = "cortex-m-semihosting" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c23234600452033cc77e4b761e740e02d2c4168e11dbf36ab14a0f58973592b0" -dependencies = [ - "cortex-m", -] -  [[package]]  name = "critical-section"  version = "1.2.0" @@ -129666 +129645 @@ source = "registry+https://github.com/rust-lang/crates.io-index"  checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b"    [[package]] -name = "embedded-dma" -version = "0.1.2" +name = "darling" +version = "0.20.11"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c8c02e4347a0267ca60813c952017f4c5948c232474c6010a381a337f1bda4" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee"  dependencies = [ - "stable_deref_trait", + "darling_core", + "darling_macro",  ]    [[package]] -name = "embedded-hal" -version = "0.2.7" +name = "darling_core" +version = "0.20.11"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e"  dependencies = [ - "nb 0.1.3", - "void", + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn",  ]    [[package]] -name = "embedded-hal" -version = "1.0.0" +name = "darling_macro" +version = "0.20.11"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" - -[[package]] -name = "embedded-hal-async" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead"  dependencies = [ - "embedded-hal 1.0.0", + "darling_core", + "quote", + "syn",  ]    [[package]] -name = "embedded-hal-bus" -version = "0.3.0" +name = "defmt" +version = "1.0.1"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "513e0b3a8fb7d3013a8ae17a834283f170deaf7d0eeab0a7c1a36ad4dd356d22" +checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78"  dependencies = [ - "critical-section", - "embedded-hal 1.0.0", - "embedded-hal-async", + "bitflags 1.3.2", + "defmt-macros",  ]    [[package]] -name = "equivalent" -version = "1.0.2" +name = "defmt-macros" +version = "1.0.1"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" - -[[package]] -name = "fctrl" -version = "0.1.0" +checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e"  dependencies = [ - "cortex-m", - "cortex-m-rt", - "cortex-m-semihosting", - "critical-section", - "embedded-hal 0.2.7", - "mpu6050-dmp", - "nb 1.1.0", - "panic-halt", - "panic-semihosting", - "rtic", - "rtic-sync", - "stm32l4xx-hal", + "defmt-parser", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn",  ]    [[package]] -name = "find-msvc-tools" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127" - -[[package]] -name = "fugit" -version = "0.3.7" +name = "defmt-parser" +version = "1.0.0"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17186ad64927d5ac8f02c1e77ccefa08ccd9eaa314d5a4772278aa204a22f7e7" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e"  dependencies = [ - "gcd", + "thiserror",  ]    [[package]] -name = "gcd" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" - -[[package]] -name = "generator" -version = "0.8.7" +name = "defmt-rtt" +version = "1.1.0"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "605183a538e3e2a9c1038635cc5c2d194e2ee8fd0d1b66b8349fad7dbacce5a2" +checksum = "93d5a25c99d89c40f5676bec8cefe0614f17f0f40e916f98e345dae941807f9e"  dependencies = [ - "cc", - "cfg-if", - "libc", - "log", - "rustversion", - "windows", + "critical-section", + "defmt",  ]    [[package]] -name = "hash32" -version = "0.3.1" +name = "document-features" +version = "0.2.12"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" +checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61"  dependencies = [ - "byteorder", + "litrs",  ]    [[package]] -name = "hashbrown" -version = "0.16.0" +name = "embassy-embedded-hal" +version = "0.5.0"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" +checksum = "554e3e840696f54b4c9afcf28a0f24da431c927f4151040020416e7393d6d0d8" +dependencies = [ + "embassy-futures", + "embassy-hal-internal", + "embassy-sync", + "embassy-time", + "embedded-hal 0.2.7", + "embedded-hal 1.0.0", + "embedded-hal-async", + "embedded-storage", + "embedded-storage-async", + "nb 1.1.0", +]    [[package]] -name = "heapless" -version = "0.8.0" +name = "embassy-executor" +version = "0.9.1"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" +checksum = "06070468370195e0e86f241c8e5004356d696590a678d47d6676795b2e439c6b"  dependencies = [ - "hash32", - "stable_deref_trait", + "cortex-m", + "critical-section", + "defmt", + "document-features", + "embassy-executor-macros", + "embassy-executor-timer-queue",  ]    [[package]] -name = "indexmap" -version = "2.12.0" +name = "embassy-executor-macros" +version = "0.7.0"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f" +checksum = "dfdddc3a04226828316bf31393b6903ee162238576b1584ee2669af215d55472"  dependencies = [ - "equivalent", - "hashbrown", + "darling", + "proc-macro2", + "quote", + "syn",  ]    [[package]] -name = "lazy_static" -version = "1.5.0" +name = "embassy-executor-timer-queue" +version = "0.1.0"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +checksum = "2fc328bf943af66b80b98755db9106bf7e7471b0cf47dc8559cd9a6be504cc9c"    [[package]] -name = "libc" -version = "0.2.177" +name = "embassy-futures" +version = "0.1.2"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" +checksum = "dc2d050bdc5c21e0862a89256ed8029ae6c290a93aecefc73084b3002cdebb01"    [[package]] -name = "libm" -version = "0.2.15" +name = "embassy-hal-internal" +version = "0.3.0"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" +checksum = "95285007a91b619dc9f26ea8f55452aa6c60f7115a4edc05085cd2bd3127cd7a" +dependencies = [ + "cortex-m", + "critical-section", + "num-traits", +]    [[package]] -name = "log" -version = "0.4.28" +name = "embassy-net-driver" +version = "0.2.0"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" +checksum = "524eb3c489760508f71360112bca70f6e53173e6fe48fc5f0efd0f5ab217751d"    [[package]] -name = "loom" -version = "0.7.2" +name = "embassy-stm32" +version = "0.4.0"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "419e0dc8046cb947daa77eb95ae174acfbddb7673b4151f56d1eed8e93fbfaca" +checksum = "0d972eab325cc96afee98f80a91ca6b00249b6356dc0fdbff68b70c200df9fae"  dependencies = [ + "aligned", + "bit_field", + "bitflags 2.10.0", + "block-device-driver",   "cfg-if", - "generator", - "pin-utils", - "scoped-tls", - "tracing", - "tracing-subscriber", + "chrono", + "cortex-m", + "cortex-m-rt", + "critical-section", + "document-features", + "embassy-embedded-hal", + "embassy-futures", + "embassy-hal-internal", + "embassy-net-driver", + "embassy-sync", + "embassy-time", + "embassy-time-driver", + "embassy-time-queue-utils", + "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 = "matchers" -version = "0.2.0" +name = "embassy-sync" +version = "0.7.2"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" +checksum = "73974a3edbd0bd286759b3d483540f0ebef705919a5f56f4fc7709066f71689b"  dependencies = [ - "regex-automata", + "cfg-if", + "critical-section", + "defmt", + "embedded-io-async", + "futures-core", + "futures-sink", + "heapless",  ]    [[package]] -name = "memchr" -version = "2.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" - -[[package]] -name = "mpu6050-dmp" -version = "0.3.0" +name = "embassy-time" +version = "0.5.0"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ad9db142f17e7e850abb7089a683396a7c5e89cb3b51d5512ded0b844551e4" +checksum = "f4fa65b9284d974dad7a23bb72835c4ec85c0b540d86af7fc4098c88cff51d65"  dependencies = [ + "cfg-if", + "critical-section", + "defmt", + "document-features", + "embassy-time-driver",   "embedded-hal 0.2.7", - "libm", + "embedded-hal 1.0.0", + "embedded-hal-async", + "futures-core",  ]    [[package]] -name = "nb" -version = "0.1.3" +name = "embassy-time-driver" +version = "0.2.1"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" +checksum = "a0a244c7dc22c8d0289379c8d8830cae06bb93d8f990194d0de5efb3b5ae7ba6"  dependencies = [ - "nb 1.1.0", + "document-features",  ]    [[package]] -name = "nb" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" - -[[package]] -name = "nu-ansi-term" -version = "0.50.3" +name = "embassy-time-queue-utils" +version = "0.3.0"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" +checksum = "80e2ee86063bd028a420a5fb5898c18c87a8898026da1d4c852af2c443d0a454"  dependencies = [ - "windows-sys", + "embassy-executor-timer-queue", + "heapless",  ]    [[package]] -name = "once_cell" -version = "1.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" - -[[package]] -name = "panic-halt" +name = "embassy-usb-driver"  version = "0.2.0"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de96540e0ebde571dc55c73d60ef407c653844e6f9a1e2fdbd40c07b9252d812" +checksum = "17119855ccc2d1f7470a39756b12068454ae27a3eabb037d940b5c03d9c77b7a" +dependencies = [ + "embedded-io-async", +]    [[package]] -name = "panic-semihosting" -version = "0.6.0" +name = "embassy-usb-synopsys-otg" +version = "0.3.1"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee8a3e1233d9073d76a870223512ce4eeea43c067a94a445c13bd6d792d7b1ab" +checksum = "288751f8eaa44a5cf2613f13cee0ca8e06e6638cb96e897e6834702c79084b23"  dependencies = [ - "cortex-m", - "cortex-m-semihosting", + "critical-section", + "embassy-sync", + "embassy-usb-driver",  ]    [[package]] -name = "pin-project-lite" -version = "0.2.16" +name = "embedded-can" +version = "0.4.1"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" +checksum = "e9d2e857f87ac832df68fa498d18ddc679175cf3d2e4aa893988e5601baf9438" +dependencies = [ + "nb 1.1.0", +]    [[package]] -name = "pin-utils" -version = "0.1.0" +name = "embedded-hal" +version = "0.2.7"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff" +dependencies = [ + "nb 0.1.3", + "void", +]    [[package]] -name = "portable-atomic" -version = "1.11.1" +name = "embedded-hal" +version = "1.0.0"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" +checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89"    [[package]] -name = "proc-macro-error-attr2" -version = "2.0.0" +name = "embedded-hal-async" +version = "1.0.0"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" +checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884"  dependencies = [ - "proc-macro2", - "quote", + "embedded-hal 1.0.0",  ]    [[package]] -name = "proc-macro-error2" -version = "2.0.1" +name = "embedded-hal-bus" +version = "0.1.0"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" +checksum = "57b4e6ede84339ebdb418cd986e6320a34b017cdf99b5cc3efceec6450b06886"  dependencies = [ - "proc-macro-error-attr2", - "proc-macro2", - "quote", - "syn", + "critical-section", + "embedded-hal 1.0.0", + "embedded-hal-async",  ]    [[package]] -name = "proc-macro2" -version = "1.0.102" +name = "embedded-hal-nb" +version = "1.0.0"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e0f6df8eaa422d97d72edcd152e1451618fed47fabbdbd5a8864167b1d4aff7" +checksum = "fba4268c14288c828995299e59b12babdbe170f6c6d73731af1b4648142e8605"  dependencies = [ - "unicode-ident", + "embedded-hal 1.0.0", + "nb 1.1.0",  ]    [[package]] -name = "quote" -version = "1.0.41" +name = "embedded-io" +version = "0.6.1"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" +checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" + +[[package]] +name = "embedded-io-async" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f"  dependencies = [ - "proc-macro2", + "embedded-io",  ]    [[package]] -name = "rand_core" -version = "0.6.4" +name = "embedded-storage" +version = "0.3.1"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +checksum = "a21dea9854beb860f3062d10228ce9b976da520a73474aed3171ec276bc0c032"    [[package]] -name = "regex-automata" -version = "0.4.13" +name = "embedded-storage-async" +version = "0.4.1"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" +checksum = "1763775e2323b7d5f0aa6090657f5e21cfa02ede71f5dc40eead06d64dcd15cc"  dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", + "embedded-storage",  ]    [[package]] -name = "regex-syntax" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" - -[[package]] -name = "rtic" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bc68b1fa2eefbb7ad6747b299b79c8fca92163dfa46f0e279f39109cf272186" +name = "fctrl" +version = "0.1.0"  dependencies = [ - "bare-metal 1.0.0",   "cortex-m", - "critical-section", - "portable-atomic", - "rtic-core", - "rtic-macros", + "cortex-m-rt", + "defmt", + "defmt-rtt", + "embassy-executor", + "embassy-stm32", + "embassy-sync", + "embassy-time", + "embedded-hal 0.2.7", + "embedded-hal 1.0.0", + "embedded-hal-async", + "embedded-hal-bus", + "panic-probe",  ]    [[package]] -name = "rtic-common" -version = "1.1.0" +name = "fnv" +version = "1.0.7"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67caeecca87cb20e1101eb104b0f05604633b7ab1035cce777417c6fb7c8f9a0" -dependencies = [ - "critical-section", - "portable-atomic", -] +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"    [[package]] -name = "rtic-core" -version = "1.0.0" +name = "futures-core" +version = "0.3.31"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9369355b04d06a3780ec0f51ea2d225624db777acbc60abd8ca4832da5c1a42" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"    [[package]] -name = "rtic-macros" -version = "2.2.0" +name = "futures-sink" +version = "0.3.31"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f387b12bd6c01d2c9d4776dddeefaf0ae51b9497c83c0186b1693f6821ff3c4a" -dependencies = [ - "indexmap", - "proc-macro-error2", - "proc-macro2", - "quote", - "syn", -] +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7"    [[package]] -name = "rtic-sync" -version = "1.4.0" +name = "futures-task" +version = "0.3.31"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d378d811a8e25411a139f1428804e390fb2dc9b5bcf84e880a19c25feaa89a2a" -dependencies = [ - "critical-section", - "embedded-hal 1.0.0", - "embedded-hal-async", - "embedded-hal-bus", - "heapless", - "loom", - "portable-atomic", - "rtic-common", -] +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988"    [[package]] -name = "rustc_version" -version = "0.2.3" +name = "futures-util" +version = "0.3.31"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81"  dependencies = [ - "semver 0.9.0", + "futures-core", + "futures-task", + "pin-project-lite", + "pin-utils",  ]    [[package]] -name = "rustc_version" -version = "0.4.1" +name = "hash32" +version = "0.3.1"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606"  dependencies = [ - "semver 1.0.27", + "byteorder",  ]    [[package]] -name = "rustversion" -version = "1.0.22" +name = "heapless" +version = "0.8.0"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" +checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" +dependencies = [ + "hash32", + "stable_deref_trait", +]    [[package]] -name = "scoped-tls" +name = "ident_case"  version = "1.0.1"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"    [[package]] -name = "semver" -version = "0.9.0" +name = "litrs" +version = "1.0.0"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] +checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092"    [[package]] -name = "semver" -version = "1.0.27" +name = "nb" +version = "0.1.3"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" +checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" +dependencies = [ + "nb 1.1.0", +]    [[package]] -name = "semver-parser" -version = "0.7.0" +name = "nb" +version = "1.1.0"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d"    [[package]] -name = "sharded-slab" -version = "0.1.7" +name = "num-traits" +version = "0.2.19"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"  dependencies = [ - "lazy_static", + "autocfg",  ]    [[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" +name = "panic-probe" +version = "1.0.0"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" +checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" +dependencies = [ + "cortex-m", + "defmt", +]    [[package]] -name = "stable_deref_trait" -version = "1.2.1" +name = "pin-project-lite" +version = "0.2.16"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b"    [[package]] -name = "stm32l4" -version = "0.14.0" +name = "pin-utils" +version = "0.1.0"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c67adac30ec976cdc3cd1189cc0dd52c37db34c83083456f7fd8fc985d6706c0" -dependencies = [ - "bare-metal 1.0.0", - "cortex-m", - "cortex-m-rt", - "vcell", -] +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"    [[package]] -name = "stm32l4xx-hal" -version = "0.7.1" +name = "proc-macro-error-attr2" +version = "2.0.0"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08b0f9e87e996030e3382b0f086429691ba61c5f594b65f45e76414246201d93" +checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5"  dependencies = [ - "bxcan", - "cast", - "cortex-m", - "embedded-dma", - "embedded-hal 0.2.7", - "fugit", - "nb 0.1.3", - "rand_core", - "stable_deref_trait", - "stm32l4", - "void", + "proc-macro2", + "quote",  ]    [[package]] -name = "syn" -version = "2.0.108" +name = "proc-macro-error2" +version = "2.0.1"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917" +checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802"  dependencies = [ + "proc-macro-error-attr2",   "proc-macro2",   "quote", - "unicode-ident", + "syn",  ]    [[package]] -name = "thread_local" -version = "1.1.9" +name = "proc-macro2" +version = "1.0.102"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" +checksum = "8e0f6df8eaa422d97d72edcd152e1451618fed47fabbdbd5a8864167b1d4aff7"  dependencies = [ - "cfg-if", + "unicode-ident",  ]    [[package]] -name = "tracing" -version = "0.1.41" +name = "quote" +version = "1.0.41"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1"  dependencies = [ - "pin-project-lite", - "tracing-core", + "proc-macro2",  ]    [[package]] -name = "tracing-core" -version = "0.1.34" +name = "rand_core" +version = "0.6.4"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" -dependencies = [ - "once_cell", - "valuable", -] +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"    [[package]] -name = "tracing-log" -version = "0.2.0" +name = "rand_core" +version = "0.9.3"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" -dependencies = [ - "log", - "once_cell", - "tracing-core", -] +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38"    [[package]] -name = "tracing-subscriber" -version = "0.3.20" +name = "rustc_version" +version = "0.2.3"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"  dependencies = [ - "matchers", - "nu-ansi-term", - "once_cell", - "regex-automata", - "sharded-slab", - "smallvec", - "thread_local", - "tracing", - "tracing-core", - "tracing-log", + "semver",  ]    [[package]] -name = "unicode-ident" -version = "1.0.20" +name = "sdio-host" +version = "0.9.0"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "462eeb75aeb73aea900253ce739c8e18a67423fadf006037cd3ff27e82748a06" +checksum = "b328e2cb950eeccd55b7f55c3a963691455dcd044cfb5354f0c5e68d2c2d6ee2"    [[package]] -name = "valuable" -version = "0.1.1" +name = "semver" +version = "0.9.0"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +]    [[package]] -name = "vcell" -version = "0.1.3" +name = "semver-parser" +version = "0.7.0"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"    [[package]] -name = "void" -version = "1.0.2" +name = "stable_deref_trait" +version = "1.2.1"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"    [[package]] -name = "volatile-register" -version = "0.2.2" +name = "static_assertions" +version = "1.1.0"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de437e2a6208b014ab52972a27e59b33fa2920d3e00fe05026167a1c509d19cc" -dependencies = [ - "vcell", -] +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"    [[package]] -name = "windows" -version = "0.61.3" +name = "stm32-fmc" +version = "0.3.2"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" +checksum = "c7f0639399e2307c2446c54d91d4f1596343a1e1d5cab605b9cce11d0ab3858c"  dependencies = [ - "windows-collections", - "windows-core", - "windows-future", - "windows-link 0.1.3", - "windows-numerics", + "embedded-hal 0.2.7",  ]    [[package]] -name = "windows-collections" -version = "0.2.0" +name = "stm32-metapac" +version = "18.0.0"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" +checksum = "6fd8ec3a292a0d9fc4798416a61b21da5ae50341b2e7b8d12e662bf305366097"  dependencies = [ - "windows-core", + "cortex-m", + "cortex-m-rt",  ]    [[package]] -name = "windows-core" -version = "0.61.2" +name = "strsim" +version = "0.11.1"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" -dependencies = [ - "windows-implement", - "windows-interface", - "windows-link 0.1.3", - "windows-result", - "windows-strings", -] +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"    [[package]] -name = "windows-future" -version = "0.2.1" +name = "syn" +version = "2.0.108"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" +checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917"  dependencies = [ - "windows-core", - "windows-link 0.1.3", - "windows-threading", + "proc-macro2", + "quote", + "unicode-ident",  ]    [[package]] -name = "windows-implement" -version = "0.60.2" +name = "thiserror" +version = "2.0.17"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8"  dependencies = [ - "proc-macro2", - "quote", - "syn", + "thiserror-impl",  ]    [[package]] -name = "windows-interface" -version = "0.59.3" +name = "thiserror-impl" +version = "2.0.17"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913"  dependencies = [   "proc-macro2",   "quote", @@ -79659 +77528 @@ dependencies = [  ]    [[package]] -name = "windows-link" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" - -[[package]] -name = "windows-link" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" - -[[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 0.1.3", -] - -[[package]] -name = "windows-result" -version = "0.3.4" +name = "unicode-ident" +version = "1.0.20"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" -dependencies = [ - "windows-link 0.1.3", -] +checksum = "462eeb75aeb73aea900253ce739c8e18a67423fadf006037cd3ff27e82748a06"    [[package]] -name = "windows-strings" -version = "0.4.2" +name = "vcell" +version = "0.1.3"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" -dependencies = [ - "windows-link 0.1.3", -] +checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002"    [[package]] -name = "windows-sys" -version = "0.61.2" +name = "void" +version = "1.0.2"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" -dependencies = [ - "windows-link 0.2.1", -] +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"    [[package]] -name = "windows-threading" -version = "0.1.0" +name = "volatile-register" +version = "0.2.2"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" +checksum = "de437e2a6208b014ab52972a27e59b33fa2920d3e00fe05026167a1c509d19cc"  dependencies = [ - "windows-link 0.1.3", + "vcell",  ] diff --git a/fw/RustFM/Cargo.toml b/fw/RustFM/Cargo.toml index bda5274..b509328 100644 --- a/fw/RustFM/Cargo.toml +++ b/fw/RustFM/Cargo.toml @@ -422 +430 @@ version = "0.1.0"  edition = "2021"    [dependencies] -embedded-hal = "0.2.7" -nb = "1.1.0" -cortex-m = {version = "0.7.7", features = ["critical-section-single-core"]} -critical-section = { version = "1.2.0" } -cortex-m-rt ="0.7.5" -panic-halt = "0.2.0" -panic-semihosting = "0.6.0" -cortex-m-semihosting = "0.5.0" +# panic-halt = "0.2.0" +# panic-semihosting = "0.6.0" +# cortex-m-semihosting = "0.5.0"  # mpu6050 = "0.1.6" -mpu6050-dmp = "0.3.0" +# mpu6050-dmp = "0.3.0"  # embedded-hal-compat = "0.13.0" -rtic = {version = "2.2.0", features=["thumbv7-backend"]} -rtic-sync = "1.4.0" -rtic-monotonics = {version = "2.1.0", features = ["stm32_tim2", "stm32l431rc"]} +embassy-executor = { version = "0.9.0", features = ["defmt", "arch-cortex-m", "executor-thread"] } +embassy-time = { version = "0.5.0", features = ["defmt"] } +embassy-sync = { version = "0.7.2", features = [ "defmt" ] }   -[dependencies.stm32l4xx-hal] -version = "0.7.1" -features = ["stm32l431", "rt"] +cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } +cortex-m-rt = "0.7.0" + +embedded-hal = "0.2.6" +embedded-hal-1 = { package = "embedded-hal", version = "1.0" } +embedded-hal-async = { version = "1.0" } +embedded-hal-bus = { version = "0.1", features = ["async"] } + +panic-probe = { version = "1.0.0", features = ["print-defmt"] } +defmt-rtt = "1.1.0" +defmt = "1.0.1" + +[dependencies.embassy-stm32] +version = "0.4.0" +features = ["stm32l431rc", "unstable-pac", "memory-x", "time-driver-any", "exti", "chrono"] +# features = ["stm32l431rc", "unstable-pac", "time-driver-any", "exti", "chrono"]   diff --git a/fw/RustFM/build.rs b/fw/RustFM/build.rs new file mode 100644 index 0000000..8cd32d7 --- /dev/null +++ b/fw/RustFM/build.rs @@ -00 +15 @@ +fn main() { + println!("cargo:rustc-link-arg-bins=--nmagic"); + println!("cargo:rustc-link-arg-bins=-Tlink.x"); + println!("cargo:rustc-link-arg-bins=-Tdefmt.x"); +} diff --git a/fw/RustFM/memory.x b/fw/RustFM/memorydotx similarity index 100% rename from fw/RustFM/memory.x rename to fw/RustFM/memorydotx diff --git a/fw/RustFM/src/main.rs b/fw/RustFM/src/main.rs index 5c50a94..4a070f9 100644 --- a/fw/RustFM/src/main.rs +++ b/fw/RustFM/src/main.rs @@ -1324 +165 @@  #![no_std]  #![no_main]   -use panic_halt as _; -extern crate cortex_m; -// #[macro_use] -extern crate cortex_m_rt as rt; -extern crate cortex_m_semihosting as sh; - -#[rtic::app(device = stm32l4xx_hal::pac, peripherals = true, dispatchers = [SAI1, ADC1_2, SPI1])] -mod app { - - use cortex_m_semihosting::hprintln; - // use embedded_hal_compat::{ForwardCompat, ReverseCompat}; - // use critical_section::*; - // use mpu6050::{device::CLKSEL, Mpu6050}; - use mpu6050_dmp::{address::Address, sensor::Mpu6050}; - use rtic_monotonics::{stm32::prelude::*, stm32_tim2_monotonic}; - stm32_tim2_monotonic!(Mono, 100); - - use rtic_sync::{ - channel::{Receiver, Sender}, - make_channel, - }; - use stm32l4xx_hal::{ - delay::Delay, - flash::FlashExt, - gpio::{ - Alternate, Input, OpenDrain, Output, PullDown, PushPull, PA10, PA12, PA6, PA9, PC14, - PC15, - }, - i2c::{self, I2c}, - pac::{I2C1, NVIC, TIM7}, - prelude::*, - pwr::PwrExt, - rcc::{ClockSecuritySystem, CrystalBypass, RccExt}, - stm32, - timer::{Event, Timer}, - }; - - #[allow(non_camel_case_types)] - #[repr(u8)] - // MPU6050 registers - pub enum MpuRegs { - INT_PIN_CFG = 55, - INT_ENABLE = 56, - INT_STATUS = 58, - } - - pub enum MpuFields {} - - impl From<MpuRegs> for u8 { - fn from(r: MpuRegs) -> u8 { - r as u8 - } - } - - pub enum LEDS { - RED, - GREEN, - } - - // Led blink speeds in Hz - #[derive(Copy, Clone)] - pub enum BlinkSpeed { - SLOW = 1, - MEDIUM = 3, - FAST = 5, - HOLD = 0, - } - - #[derive(Clone, Copy, Debug)] - pub enum SysStatus { - IDLE, - OK, - FAIL, - BOOT, - TX, - } - - #[shared] - struct Shared { - status: SysStatus, - } - - #[local] - struct Local { - timer7: Timer<TIM7>, // led blink timer - led_ok: PC14<Output<PushPull>>, // green led - led_fail: PC15<Output<PushPull>>, // red led - txpin: PA6<Output<PushPull>>, // outgoing transmit data - imu_int: PA12<Input<PullDown>>, - mpu: Mpu6050<I2c<I2C1, (PA9<Alternate<OpenDrain, 4>>, PA10<Alternate<OpenDrain, 4>>)>>, // mpu: Mpu6050<I2c>, - } - - const CAPACITY: usize = 1; - #[init] - fn init(c: init::Context) -> (Shared, Local) { - let mut dp = c.device; - let mut flash = dp.FLASH.constrain(); // .constrain(); - let mut rcc = dp.RCC.constrain(); - let mut pwr = dp.PWR.constrain(&mut rcc.apb1r1); - - let clocks = rcc - .cfgr - .hse( - 12.MHz(), - CrystalBypass::Disable, - ClockSecuritySystem::Disable, - ) - .sysclk(48.MHz()) - .pclk1(24.MHz()) - .pclk2(48.MHz()) - .freeze(&mut flash.acr, &mut pwr); - - let mut timer7 = Timer::tim7(dp.TIM7, 1.Hz(), clocks, &mut rcc.apb1r1); - timer7.listen(stm32l4xx_hal::timer::Event::TimeOut); - - let mut gpioc = dp.GPIOC.split(&mut rcc.ahb2); - let mut gpioa = dp.GPIOA.split(&mut rcc.ahb2); - let mut gpiob = dp.GPIOB.split(&mut rcc.ahb2); - - let led_ok = gpioc - .pc14 - .into_push_pull_output(&mut gpioc.moder, &mut gpioc.otyper); - let led_fail = gpioc - .pc15 - .into_push_pull_output(&mut gpioc.moder, &mut gpioc.otyper); - let mut txpin = gpioa - .pa6 - .into_push_pull_output(&mut gpioa.moder, &mut gpioa.otyper); - let mut rxen = gpiob - .pb0 - .into_push_pull_output(&mut gpiob.moder, &mut gpiob.otyper); - let mut txen = gpiob - .pb1 - .into_push_pull_output(&mut gpiob.moder, &mut gpiob.otyper); - - // setup for transmission - rxen.set_high(); - txen.set_low(); - - // initialize i2c peripheral - let scl = gpioa.pa9.into_alternate_open_drain::<4>( - &mut gpioa.moder, - &mut gpioa.otyper, - &mut gpioa.afrh, - ); - let sda = gpioa.pa10.into_alternate_open_drain::<4>( - &mut gpioa.moder, - &mut gpioa.otyper, - &mut gpioa.afrh, - ); - - // Configure the external interrupt for MPU6050 data - let mut imu_int = gpioa - .pa12 - .into_pull_down_input(&mut gpioa.moder, &mut gpioa.pupdr); - imu_int.make_interrupt_source(&mut dp.SYSCFG, &mut rcc.apb2); - imu_int.trigger_on_edge(&mut dp.EXTI, stm32l4xx_hal::gpio::Edge::Rising); - imu_int.enable_interrupt(&mut dp.EXTI); - unsafe { - NVIC::unmask(stm32::interrupt::EXTI15_10); - } - - let iic = i2c::I2c::i2c1( - dp.I2C1, - (scl, sda), - i2c::Config::new(400.kHz(), clocks), - &mut rcc.apb1r1, - ); - let mut mpu_slave_add_lsb = gpioa - .pa11 - .into_push_pull_output(&mut gpioa.moder, &mut gpioa.otyper); - // Force low the address of the I2C IMU peripheral - mpu_slave_add_lsb.set_low(); - // let mut mpu = Mpu6050::new(iic); - let mut delay = Delay::new(c.core.SYST, clocks); - - // init sequence for max7044 - txpin.set_low(); - delay.delay_ms(1_u32); - txpin.set_high(); - delay.delay_ms(1_u32); - txpin.set_low(); - - // let init_result = mpu.init(&mut timer); - // // Set the mpu clock source to the x axis gyroscope - // mpu.set_clock_source(CLKSEL::GXAXIS).unwrap(); - // hprintln!("Initialized MPU peripheral: {:?}", init_result); - - // // Enable clear interrupt on read operation - // mpu.write_bit(MpuRegs::INT_PIN_CFG.into(), 4, true).unwrap(); - // // Enable interrupt on data ready - // mpu.write_bit(MpuRegs::INT_ENABLE.into(), 0, false).unwrap(); - - let mut mpu = Mpu6050::new(iic, Address::default()).unwrap(); - mpu.initialize_dmp(&mut delay).unwrap(); - mpu.enable_dmp().unwrap(); - mpu.boot_firmware().unwrap(); - mpu.set_clock_source(mpu6050_dmp::clock_source::ClockSource::Xgyro) - .unwrap(); - - Mono::start(12_000_000); - - // mpu.disable_dmp - - #[allow(unused_variables)] - let (send, receive) = make_channel!(usize, CAPACITY); - transmitter::spawn(receive).unwrap(); - // sender1::spawn(send).unwrap(); - - let status = SysStatus::FAIL; - ( - Shared { status }, - Local { - timer7, - led_ok, - led_fail, - txpin, - imu_int, - mpu, - }, - ) - } - - #[idle] - fn idle(_: idle::Context) -> ! { - loop {} - } - - #[task(priority = 1)] - async fn sender1(_: sender1::Context, mut sender: Sender<'static, usize, CAPACITY>) { - loop { - // hprintln!("Sender 1 sending: 1"); - sender.send(1).await.unwrap(); - Mono::delay(50_u64.millis()).await - } - } +use core::{any::Any, ops::Deref}; + +use defmt::*; +use embassy_executor::Spawner; +use embassy_stm32::{ + gpio::{AnyPin, Level, Output, Speed}, rcc::{self}, time::hz, timer::simple_pwm::{PwmPin, SimplePwm}, Config, Peri +}; +use embassy_time::{Timer, WithTimeout}; +use {defmt_rtt as _, panic_probe as _}; + +#[embassy_executor::main] +async fn main(spawner: Spawner) { + let mut config = Config::default(); + + config.rcc.hse = Some(rcc::Hse { + freq: embassy_stm32::time::Hertz(12_000_000), + mode: rcc::HseMode::Oscillator, + }); + let p = embassy_stm32::init(config); + + let ok_pin = p.PC14; + let fail_pin = p.PC15; + let txpin = p.PA6; + + let rxen = Output::new(p.PB0, Level::High, Speed::Low); + let txen = Output::new(p.PB1, Level::Low, Speed::Low); + + spawner.spawn(status_leds(ok_pin.into())).unwrap(); + Timer::after_millis(500).await; + spawner.spawn(status_leds(fail_pin.into())).unwrap(); + spawner.spawn(transmit(txpin.into())).unwrap(); + + // loop { + // } +}   - #[task(binds = EXTI15_10, priority = 7, local = [mpu, imu_int])] - fn mpu_read(c: mpu_read::Context) { - // let acc = c.local.mpu.get_acc(); - let acc = c.local.mpu.gyro(); - c.local.mpu.get_fifo_count().unwrap(); - hprintln!("Read MPU value: {:?}", acc.unwrap()); - // hprintln!("Read TEMP value: {:?}", c.local.mpu.get_temp().unwrap()); +#[embassy_executor::task(pool_size = 2)] +async fn status_leds(p: Peri<'static, AnyPin>) { + let mut led = Output::new(p, Level::Low, Speed::Low);   - // c.local.imu_int.clear_interrupt_pending_bit(); - // Clear the interrupt after reading the INT status register - // c.local - // .mpu - // .read_bits(MpuRegs::INT_STATUS.into(), 0, 0) - // .unwrap(); + loop { + led.set_high(); + Timer::after_millis(500).await; + led.set_low(); + Timer::after_millis(500).await; } +}   - #[task(priority = 5, local = [txpin], shared = [status])] - async fn transmitter( - mut ctx: transmitter::Context, - mut receiver: Receiver<'static, usize, CAPACITY>, - ) { - hprintln!("Waiting for data to transmit"); - // Wait until we receive data to send - while let Ok(_data) = receiver.recv().await { - // hprintln!("Got data to transmit: {}", data); - ctx.shared.status.lock(|s| { - *s = SysStatus::TX; - }); - ctx.local.txpin.toggle(); - } - hprintln!("No more data received."); - ctx.shared.status.lock(|s| { - *s = SysStatus::IDLE; - }); - } - - #[task(binds = TIM7, local = [led_ok, led_fail, timer7], shared = [status])] - fn status_leds(mut ctx: status_leds::Context) { - let mut led: LEDS = LEDS::RED; - let mut speed: BlinkSpeed = BlinkSpeed::FAST; - - // Match the curren system status and assign a led and speed - ctx.shared.status.lock(|status| match status { - SysStatus::IDLE => { - led = LEDS::GREEN; - speed = BlinkSpeed::SLOW; - } - SysStatus::FAIL => { - led = LEDS::RED; - speed = BlinkSpeed::HOLD; - } - SysStatus::BOOT => { - led = LEDS::GREEN; - speed = BlinkSpeed::MEDIUM; - } - SysStatus::TX => { - led = LEDS::GREEN; - speed = BlinkSpeed::FAST; - } - - _ => { - led = LEDS::RED; - speed = BlinkSpeed::HOLD; - } - }); - - // Activate selected led and force off the other - match led { - LEDS::GREEN => { - ctx.local.led_ok.toggle(); - ctx.local.led_fail.set_low(); - } - LEDS::RED => { - ctx.local.led_fail.toggle(); - ctx.local.led_ok.set_low(); - } - } - // ctx.local.timer7.clear_update_interrupt_flag(); - // ctx.local.timer7.clear_interrupt(Event::TimeOut); - // hprintln!("{}", speed as u32); - ctx.local.timer7.start((speed as u32).Hz()); - ctx.local.timer7.listen(Event::TimeOut); +#[embassy_executor::task] +async fn transmit(p: Peri<'static, AnyPin>) { + let mut txpin = Output::new(p, Level::Low, Speed::Medium); + txpin.set_low(); + Timer::after_millis(1).await; + txpin.set_high(); + Timer::after_millis(1).await; + txpin.set_low(); + + loop { + txpin.toggle(); + Timer::after_millis(1).await; }  }