Skip to content

Refactor xtask to bind and compile for every target. #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 32 additions & 3 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[target.xtensa-esp32-none-elf]
runner = "espflash flash --monitor"
runner = "espflash flash --monitor --baud 921600"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to not have a hardcoded baud-rate here (and in the other places)


rustflags = [
"-C", "link-arg=-Tlinkall.x",
Expand All @@ -9,7 +9,7 @@ rustflags = [
]

[target.riscv32imc-unknown-none-elf]
runner = "espflash flash --monitor"
runner = "espflash flash --monitor --baud 921600"

rustflags = [
"-C", "link-arg=-Tlinkall.x",
Expand All @@ -36,8 +36,34 @@ rustflags = [
"--cfg", 'target_has_atomic="ptr"',
]

[target.xtensa-esp32s2-none-elf]
runner = "espflash flash --monitor --baud 921600"

rustflags = [
#"-C", "linker=rust-lld",

"-C", "link-arg=-Tlinkall.x",
"-C", "link-arg=-Trom_functions.x",

# Enable the atomic codegen option for Xtensa
"-C", "target-feature=+s32c1i",

# tell the core library have atomics even though it's not specified in the target definition
"--cfg", "target_has_atomic_load_store",
"--cfg", 'target_has_atomic_load_store="8"',
"--cfg", 'target_has_atomic_load_store="16"',
"--cfg", 'target_has_atomic_load_store="32"',
"--cfg", 'target_has_atomic_load_store="ptr"',
# enable cas
"--cfg", "target_has_atomic",
"--cfg", 'target_has_atomic="8"',
"--cfg", 'target_has_atomic="16"',
"--cfg", 'target_has_atomic="32"',
"--cfg", 'target_has_atomic="ptr"',
]

[target.xtensa-esp32s3-none-elf]
runner = "espflash flash --monitor"
runner = "espflash flash --monitor --baud 921600"

rustflags = [
"-C", "link-arg=-Tlinkall.x",
Expand All @@ -48,3 +74,6 @@ rustflags = [

[unstable]
build-std = ["core"]

[alias]
xtask = "run --manifest-path ./xtask/Cargo.toml --"
16 changes: 9 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,18 @@ lto = false
opt-level = 3

[dependencies]
esp32-hal = { version = "0.13.0", optional = true }
esp32c3-hal = { version = "0.10.0", optional = true }
esp32s3-hal = { version = "0.10.0", optional = true }
esp32-hal = { version = "0.15.0", optional = true }
esp32c3-hal = { version = "0.12.0", optional = true }
esp32s2-hal = { version = "0.12.0", optional = true }
esp32s3-hal = { version = "0.12.0", optional = true }
esp-backtrace = { version = "0.6.0", features = ["panic-handler", "print-uart", "exception-handler"] }
esp-println = { version = "0.4.0", features = ["log"] }

embassy-time = { version = "0.1.0", features = ["nightly"], optional = true }
embassy-executor = { version = "0.2.0", package = "embassy-executor", features = ["nightly", "executor-thread", "integrated-timers"], optional = true }
embassy-net = { version = "0.1.0", features = ["nightly", "tcp", "udp", "dhcpv4", "medium-ethernet"], optional = true }

esp-wifi = { git = "https://github.com/esp-rs/esp-wifi.git", features = ["big-heap", "phy-enable-usb", "embedded-svc", "wifi"], rev = "68dc11bbb2c0efa29c4acbbf134d6f142441065e" }
esp-wifi = { git = "https://github.com/esp-rs/esp-wifi.git", features = ["big-heap", "phy-enable-usb", "embedded-svc", "wifi"], rev = "fbb8417fc450ec0701067b36629770c11338231c" }
smoltcp = { version = "0.10.0", default-features=false, features = ["proto-igmp", "proto-ipv4", "socket-tcp", "socket-icmp", "socket-udp", "medium-ethernet", "proto-dhcpv4", "socket-raw", "socket-dhcpv4"] }
embedded-svc = { version = "0.25.0", default-features = false}
log = "0.4.16"
Expand Down Expand Up @@ -59,8 +60,9 @@ name = "async_server_mTLS"
required-features = ["async"]

[features]
esp32 = ["esp32-hal/embassy-time-timg0", "esp-backtrace/esp32", "esp-println/esp32", "embassy-executor?/arch-xtensa", "esp-wifi/esp32"]
esp32c3 = ["esp32c3-hal/embassy-time-timg0", "esp-backtrace/esp32c3", "esp-println/esp32c3", "embassy-executor?/arch-riscv32", "esp-wifi/esp32c3"]
esp32s3 = ["esp32s3-hal/embassy-time-timg0", "esp-backtrace/esp32s3", "esp-println/esp32s3", "embassy-executor?/arch-xtensa", "esp-wifi/esp32s3"]
esp32 = ["esp32-hal/embassy-time-timg0", "esp-backtrace/esp32", "esp-println/esp32", "embassy-executor?/arch-xtensa", "esp-wifi/esp32", "esp-mbedtls/esp32"]
esp32c3 = ["esp32c3-hal/embassy-time-timg0", "esp-backtrace/esp32c3", "esp-println/esp32c3", "embassy-executor?/arch-riscv32", "esp-wifi/esp32c3", "esp-mbedtls/esp32c3"]
esp32s2 = ["esp32s2-hal/embassy-time-timg0", "esp-backtrace/esp32s2", "esp-println/esp32s2", "embassy-executor?/arch-xtensa", "esp-wifi/esp32s2", "esp-mbedtls/esp32s2"]
esp32s3 = ["esp32s3-hal/embassy-time-timg0", "esp-backtrace/esp32s3", "esp-println/esp32s3", "embassy-executor?/arch-xtensa", "esp-wifi/esp32s3", "esp-mbedtls/esp32s3"]
async = ["esp-wifi/async", "esp-wifi/embassy-net", "embassy-executor", "embassy-net", "embassy-time", "embedded-io/async", "esp-mbedtls/async"]

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Examples are available for:
- esp32c3
- esp32s3

Limited support is also available for `esp32s2` but it won't compile for async.

To run examples, you need to specify the architecture as a feature, the example name, the target and the toolchain.

You also need to set `SSID` and `PASSWORD` as your environment variables
Expand Down
64 changes: 0 additions & 64 deletions build_mbedtls/build_all.sh

This file was deleted.

9 changes: 9 additions & 0 deletions esp-mbedtls-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,12 @@ edition = "2021"
anyhow = "1.0.68"

[dependencies]

[features]
default = []

# Exactly *one* chip MUST be selected via its feature:
esp32 = []
esp32c3 = []
esp32s2 = []
esp32s3 = []
2 changes: 1 addition & 1 deletion esp-mbedtls-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ fn main() -> Result<()> {
println!("cargo:rustc-link-lib={}", "mbedx509");
println!("cargo:rustc-link-lib={}", "mbedcrypto");
println!("cargo:rustc-link-search={}", out.display());

println!("cargo:rerun-if-changed=../libs");
Ok(())
}

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3918,3 +3918,4 @@
//#define MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED

/** \} name SECTION: Module configuration options */

Loading