embassy-rs / embassy

Modern embedded framework, using Rust and async.
https://embassy.dev
Apache License 2.0
5.22k stars 720 forks source link

How can just use same need crates #1738

Open ChinaHDJ1 opened 1 year ago

ChinaHDJ1 commented 1 year ago

I just want use embassy to my stm32f103. but can't use crates.io download need crate. it 404.

always download all embassy project code to my small project. I don't like because it looks so big.

sometime try use git download embassy on Cargo.toml, but it failed

embassy ={git = "https://github.com/embassy-rs/embassy.git/"}

Who can help me ? T_T I need god man

ChinaHDJ1 commented 1 year ago

sorry, title was wrong. it fix 'How can just use some need crates'

abelREK commented 1 year ago

Here is a example cargo.toml.

[package]
name = "example"
version = "0.1.0"
edition = "2021"

[dependencies]
embassy-stm32 = { version = "0.1.0", git = "https://github.com/embassy-rs/embassy", features = ["nightly", "unstable-traits", "defmt", "stm32f405rg", "unstable-pac", "memory-x", "time-driver-any", "exti", "embedded-sdmmc", "chrono"]  }
embassy-sync = { version = "0.2.0", git = "https://github.com/embassy-rs/embassy", features = ["defmt"] }
embassy-executor = { version = "0.3.0", git = "https://github.com/embassy-rs/embassy", features = ["nightly", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] }
embassy-time = { version = "0.1.3", git = "https://github.com/embassy-rs/embassy", features = ["defmt", "defmt-timestamp-uptime", "unstable-traits", "tick-hz-32_768"] }
embassy-usb = { version = "0.1.0", git = "https://github.com/embassy-rs/embassy", features = ["defmt"] }
embassy-net = { version = "0.1.0", git = "https://github.com/embassy-rs/embassy", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "nightly"] }

defmt = "0.3"
defmt-rtt = "0.4"
thiserror-no-std = "2.0.2"

cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] }
cortex-m-rt = "0.7.0"
embedded-hal = "0.2.6"
embedded-io = { version = "0.5.0" }
embedded-io-async = { version = "0.5.0" }
panic-probe = { version = "0.3", features = ["print-defmt"] }
futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
heapless = { version = "0.7.5", default-features = false }
nb = "1.0.0"
embedded-storage = "0.3.0"
micromath = "2.0.0"
static_cell = { version = "1.1", features = ["nightly"]}
chrono = { version = "^0.4", default-features = false}

[profile.release]
debug = 2

Also need a rust-toolchain.toml in the same folder.

# Before upgrading check that everything is available on all tier1 targets here:
# https://rust-lang.github.io/rustup-components-history
[toolchain]
channel = "nightly-2023-08-19"
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",
]