diff --git a/embedded-examples/stm32h7-rtic/Cargo.lock b/embedded-examples/stm32h7-rtic/Cargo.lock index 107b689..862eb61 100644 --- a/embedded-examples/stm32h7-rtic/Cargo.lock +++ b/embedded-examples/stm32h7-rtic/Cargo.lock @@ -2,6 +2,21 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "atomic-polyfill" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cf2bce30dfe09ef0bfaef228b9d414faaf7e563035494d7fe092dba54b300f4" +dependencies = [ + "critical-section", +] + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + [[package]] name = "bare-metal" version = "0.2.5" @@ -29,12 +44,30 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + [[package]] name = "cast" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cobs" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" + [[package]] name = "cortex-m" version = "0.7.7" @@ -44,7 +77,7 @@ dependencies = [ "bare-metal 0.2.5", "bitfield", "critical-section", - "embedded-hal", + "embedded-hal 0.2.7", "volatile-register", ] @@ -77,6 +110,21 @@ dependencies = [ "cortex-m", ] +[[package]] +name = "crc" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" + [[package]] name = "critical-section" version = "1.1.2" @@ -93,6 +141,16 @@ dependencies = [ "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.3.9" @@ -115,16 +173,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "defmt-rtt" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab697b3dbbc1750b7c8b821aa6f6e7f2480b47a99bc057a2ed7b170ebef0c51" -dependencies = [ - "critical-section", - "defmt", -] - [[package]] name = "defmt-test" version = "0.3.2" @@ -148,6 +196,28 @@ dependencies = [ "syn 2.0.64", ] +[[package]] +name = "delegate" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee5df75c70b95bd3aacc8e2fd098797692fb1d54121019c4de481e42f04c8a1" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "derive-new" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d150dea618e920167e5973d70ae6ece4385b7164e0d799fe7c122dd0a5d912ad" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.64", +] + [[package]] name = "embedded-dma" version = "0.2.0" @@ -167,12 +237,24 @@ dependencies = [ "void", ] +[[package]] +name = "embedded-hal" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" + [[package]] name = "embedded-storage" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a21dea9854beb860f3062d10228ce9b976da520a73474aed3171ec276bc0c032" +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "fugit" version = "0.3.7" @@ -182,12 +264,52 @@ dependencies = [ "gcd", ] +[[package]] +name = "futures-core" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" + +[[package]] +name = "futures-task" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" + +[[package]] +name = "futures-util" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "pin-utils", +] + [[package]] name = "gcd" version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "indexmap" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +dependencies = [ + "equivalent", + "hashbrown", +] + [[package]] name = "nb" version = "0.1.3" @@ -203,6 +325,35 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_enum" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.64", +] + [[package]] name = "panic-probe" version = "0.3.2" @@ -219,6 +370,18 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -261,6 +424,73 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rtic" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c443db16326376bdd64377da268f6616d5f804aba8ce799bac7d1f7f244e9d51" +dependencies = [ + "atomic-polyfill", + "bare-metal 1.0.0", + "cortex-m", + "critical-section", + "rtic-core", + "rtic-macros", +] + +[[package]] +name = "rtic-common" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0786b50b81ef9d2a944a000f60405bb28bf30cd45da2d182f3fe636b2321f35c" +dependencies = [ + "critical-section", +] + +[[package]] +name = "rtic-core" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9369355b04d06a3780ec0f51ea2d225624db777acbc60abd8ca4832da5c1a42" + +[[package]] +name = "rtic-macros" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54053598ea24b1b74937724e366558412a1777eb2680b91ef646db540982789a" +dependencies = [ + "indexmap", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.64", +] + +[[package]] +name = "rtic-monotonics" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "058c2397dbd5bb4c5650a0e368c3920953e458805ff5097a0511b8147b3619d7" +dependencies = [ + "atomic-polyfill", + "cfg-if", + "cortex-m", + "embedded-hal 1.0.0", + "fugit", + "rtic-time", +] + +[[package]] +name = "rtic-time" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b232e7aebc045cfea81cdd164bc2727a10aca9a4568d406d0a5661cdfd0f19" +dependencies = [ + "critical-section", + "futures-util", + "rtic-common", +] + [[package]] name = "rustc_version" version = "0.2.3" @@ -270,6 +500,34 @@ dependencies = [ "semver", ] +[[package]] +name = "satrs" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "866fcae3b683ccc37b5ad77982483a0ee01d5dc408dea5aad2117ad404b60fe1" +dependencies = [ + "cobs", + "crc", + "defmt", + "delegate", + "derive-new", + "num-traits", + "num_enum", + "paste", + "satrs-shared", + "smallvec", + "spacepackets", +] + +[[package]] +name = "satrs-shared" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6042477018c2d43fffccaaa5099bc299a58485139b4d31c5b276889311e474f1" +dependencies = [ + "spacepackets", +] + [[package]] name = "satrs-stm32h7-rtic" version = "0.1.0" @@ -278,9 +536,12 @@ dependencies = [ "cortex-m-rt", "cortex-m-semihosting", "defmt", - "defmt-rtt", + "defmt-brtt", "defmt-test", "panic-probe", + "rtic", + "rtic-monotonics", + "satrs", "stm32h7xx-hal", ] @@ -299,6 +560,26 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e85574d113a06312010c0ba51aadccd4ba2806231ebe9a49fc6473d0534d8696" +dependencies = [ + "crc", + "defmt", + "delegate", + "num-traits", + "num_enum", + "zerocopy", +] + [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -327,7 +608,7 @@ dependencies = [ "cast", "cortex-m", "embedded-dma", - "embedded-hal", + "embedded-hal 0.2.7", "embedded-storage", "fugit", "nb 1.1.0", @@ -410,3 +691,24 @@ checksum = "de437e2a6208b014ab52972a27e59b33fa2920d3e00fe05026167a1c509d19cc" dependencies = [ "vcell", ] + +[[package]] +name = "zerocopy" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.64", +] diff --git a/embedded-examples/stm32h7-rtic/Cargo.toml b/embedded-examples/stm32h7-rtic/Cargo.toml index 4b21fab..d9d2bd6 100644 --- a/embedded-examples/stm32h7-rtic/Cargo.toml +++ b/embedded-examples/stm32h7-rtic/Cargo.toml @@ -17,11 +17,25 @@ harness = false cortex-m = { version = "0.7", features = ["critical-section-single-core"] } cortex-m-rt = "0.7" defmt = "0.3" -defmt-rtt = "0.4" +defmt-brtt = { version = "0.1", default-features = false, features = ["rtt"] } panic-probe = { version = "0.3", features = ["print-defmt"] } cortex-m-semihosting = "0.5.0" stm32h7xx-hal = { version="0.16", features= ["stm32h743v"] } +[dependencies.rtic] +version = "2" +features = ["thumbv7-backend"] + +[dependencies.rtic-monotonics] +version = "1" +features = ["cortex-m-systick"] + +[dependencies.satrs] +# path = "satrs" +version = "0.2" +default-features = false +features = ["defmt"] + [dev-dependencies] defmt-test = "0.3" diff --git a/embedded-examples/stm32h7-rtic/docs/um1974-stm32-nucleo144-boards-mb1137-stmicroelectronics.pdf b/embedded-examples/stm32h7-rtic/docs/um1974-stm32-nucleo144-boards-mb1137-stmicroelectronics.pdf new file mode 100644 index 0000000..57d4957 Binary files /dev/null and b/embedded-examples/stm32h7-rtic/docs/um1974-stm32-nucleo144-boards-mb1137-stmicroelectronics.pdf differ diff --git a/embedded-examples/stm32h7-rtic/src/lib.rs b/embedded-examples/stm32h7-rtic/src/lib.rs index b20492b..f539b89 100644 --- a/embedded-examples/stm32h7-rtic/src/lib.rs +++ b/embedded-examples/stm32h7-rtic/src/lib.rs @@ -3,7 +3,7 @@ use cortex_m_semihosting::debug; -use defmt_rtt as _; // global logger +use defmt_brtt as _; // global logger // TODO(5) adjust HAL import use stm32h7xx_hal as _; // memory layout diff --git a/embedded-examples/stm32h7-rtic/src/main.rs b/embedded-examples/stm32h7-rtic/src/main.rs index 7bc9992..2bc7ab2 100644 --- a/embedded-examples/stm32h7-rtic/src/main.rs +++ b/embedded-examples/stm32h7-rtic/src/main.rs @@ -1,11 +1,25 @@ #![no_main] #![no_std] -use satrs_stm32h7_rtic as _; // global logger + panicking-behavior + memory layout +use rtic::app; +use satrs_stm32h7_rtic as _; -#[cortex_m_rt::entry] -fn main() -> ! { - defmt::println!("Hello, world!"); +#[app(device = stm32h7xx_hal::pac)] +mod app { + use cortex_m_semihosting::debug; - satrs_stm32h7_rtic::exit() + #[shared] + struct Shared {} + + #[local] + struct Local {} + + #[init] + fn init(_: init::Context) -> (Shared, Local) { + debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator + (Shared {}, Local {}) + } + + //#[task(local = [leds, curr_dir, last_dir], shared=[blink_freq])] + //async fn blink(mut cx: blink::Context) {} }