From 8355cc1f249f833476462f4eb970f76749576cd1 Mon Sep 17 00:00:00 2001 From: Zachary Sunforge Date: Mon, 12 Jun 2023 09:33:01 -0700 Subject: [PATCH] Project setup --- Cargo.toml | 97 +++++++++++++++++++++++++++++++++++++++++--- commander/Cargo.toml | 9 ++-- node/Cargo.toml | 16 ++++++-- rust-toolchain.toml | 14 +++++++ 4 files changed, 122 insertions(+), 14 deletions(-) create mode 100644 rust-toolchain.toml diff --git a/Cargo.toml b/Cargo.toml index 407368e..58382fb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,6 @@ +#--------------------------------------------------------------------------------------------------------------------- +#----- Workspace ------------------------ +#--------------------------------------------------------------------------------------------------------------------- [workspace] members = [ # Device types @@ -15,20 +18,84 @@ readme = "README.md" license = "MIT" [workspace.dependencies] -##### no-std ##### -# Error handling -[workspace.dependencies.thiserror] -version = "1.0.*" +#----- no-std ---------------------------------- +# Math +[workspace.dependencies.libm] +version = "0.2.*" # Units of measurement [workspace.dependencies.uom] version = "0.34.*" +default-features = false +features = ["f32", "si"] # Logging [workspace.dependencies.tracing] version = "0.1.*" +[workspace.dependencies.defmt] +version = "0.3.*" +[workspace.dependencies.defmt-rtt] +version = "0.4.*" # Serialization [workspace.dependencies.parity-scale-codec] version = "3.5.*" +# Embedded-HAL +[workspace.dependencies.embedded-hal] +version = "1.0.0-alpha.10" +[workspace.dependencies.embedded-hal-async] +version = "0.2.0-alpha.1" +# Memory +[workspace.dependencies.static_cell] +version = "1.1.*" +[workspace.dependencies.heapless] +version = "0.7.*" +# Other embedded utilities +[workspace.dependencies.cortex-m] +version = "0.7.*" +[workspace.dependencies.cortex-m-rt] +version = "0.7.*" +[workspace.dependencies.panic-probe] +version = "0.3.*" +features = ["print-defmt"] +# Embassy +[workspace.dependencies.embassy-futures] +version = "0.1.*" +[workspace.dependencies.embassy-time] +version = "0.1.*" +features = ["defmt", "defmt-timestamp-uptime", "unstable-traits", "nightly", ] +[workspace.dependencies.embassy-sync] +version = "0.1.*" +features = ["defmt"] +[workspace.dependencies.embassy-embedded-hal] +version = "0.1.*" +features = ["nightly"] +[workspace.dependencies.embassy-executor] +version = "0.1.*" +features = ["defmt", "arch-cortex-m", "integrated-timers", "executor-interrupt", "executor-thread", "nightly"] +[workspace.dependencies.embassy-stm32] +version = "0.1.*" +features = ["defmt", "unstable-traits", "unstable-pac", "nightly"] +[workspace.dependencies.embassy-nrf] +version = "0.1.*" +features = ["defmt", "unstable-traits", "nightly"] +#--------------------------------------------------------------------------------------------------------------------- +#----- Patch ------------------------ +#--------------------------------------------------------------------------------------------------------------------- +[patch.crates-io] +embassy-executor = { git = "https://github.com/embassy-rs/embassy", rev = "047ea9066f0d946fd4d706577b21df38fd3b1647" } +embassy-time = { git = "https://github.com/embassy-rs/embassy", rev = "047ea9066f0d946fd4d706577b21df38fd3b1647" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy", rev = "047ea9066f0d946fd4d706577b21df38fd3b1647" } +embassy-sync = { git = "https://github.com/embassy-rs/embassy", rev = "047ea9066f0d946fd4d706577b21df38fd3b1647" } +embassy-embedded-hal = { git = "https://github.com/embassy-rs/embassy", rev = "047ea9066f0d946fd4d706577b21df38fd3b1647" } +embassy-net = { git = "https://github.com/embassy-rs/embassy", rev = "047ea9066f0d946fd4d706577b21df38fd3b1647" } +embassy-net-driver = { git = "https://github.com/embassy-rs/embassy", rev = "047ea9066f0d946fd4d706577b21df38fd3b1647" } +embassy-net-driver-channel = { git = "https://github.com/embassy-rs/embassy", rev = "047ea9066f0d946fd4d706577b21df38fd3b1647" } +embassy-nrf = { git = "https://github.com/embassy-rs/embassy", rev = "047ea9066f0d946fd4d706577b21df38fd3b1647" } +embassy-stm32 = { git = "https://github.com/embassy-rs/embassy", rev = "047ea9066f0d946fd4d706577b21df38fd3b1647" } +embassy-rp = { git = "https://github.com/embassy-rs/embassy", rev = "047ea9066f0d946fd4d706577b21df38fd3b1647" } + +#--------------------------------------------------------------------------------------------------------------------- +#----- Package ------------------------ +#--------------------------------------------------------------------------------------------------------------------- [package] name = "physical" description = "Physical is a library for interacting with the physical world." @@ -39,4 +106,24 @@ readme.workspace = true license.workspace = true [dependencies] -uom = { workspace = true } \ No newline at end of file +uom = { workspace = true } +parity-scale-codec = { workspace = true } + +#--------------------------------------------------------------------------------------------------------------------- +#----- Profiles ------------------------ +#--------------------------------------------------------------------------------------------------------------------- +[profile.release] +opt-level = 3 +lto = true +codegen-units = 1 +panic = "abort" + +[profile.dev] +opt-level = 3 +debug = true +debug-assertions = true +overflow-checks = true +lto = true +panic = "abort" +incremental = false +codegen-units = 1 \ No newline at end of file diff --git a/commander/Cargo.toml b/commander/Cargo.toml index 0c727d9..70fdefb 100644 --- a/commander/Cargo.toml +++ b/commander/Cargo.toml @@ -7,8 +7,7 @@ repository.workspace = true readme.workspace = true license.workspace = true -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -physical = { path = ".." } -tracing.workspace = true \ No newline at end of file +[dependencies.physical] +path = ".." +[dependencies.tracing] +workspace = true \ No newline at end of file diff --git a/node/Cargo.toml b/node/Cargo.toml index 6bbbb9e..ba7f818 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -7,7 +7,15 @@ repository.workspace = true readme.workspace = true license.workspace = true -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -physical = { path = ".." } \ No newline at end of file +[dependencies.physical] +path = ".." +[dependencies.embedded-hal] +workspace = true +[dependencies.embedded-hal-async] +workspace = true +[dependencies.defmt] +workspace = true +[dependencies.uom] +workspace = true +[dependencies.embassy-sync] +workspace = true \ No newline at end of file diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..2301ddc --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,14 @@ +# Before upgrading check that everything is available on all tier1 targets here: +# https://rust-lang.github.io/rustup-components-history +[toolchain] +channel = "nightly-2023-04-18" +components = [ "rust-src", "rustfmt", "llvm-tools-preview" ] +targets = [ + "thumbv7em-none-eabi", + "thumbv7m-none-eabi", + "thumbv6m-none-eabi", + "thumbv7em-none-eabihf", + "thumbv8m.main-none-eabihf", + "riscv32imac-unknown-none-elf", + "wasm32-unknown-unknown", +]