Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
Upgrade to latest crates; fix compilation issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmarkov committed Oct 19, 2023
1 parent e223792 commit 359bc82
Show file tree
Hide file tree
Showing 4 changed files with 242 additions and 195 deletions.
29 changes: 14 additions & 15 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,28 @@ target = "xtensa-esp32-espidf"

[target.xtensa-esp32-espidf]
linker = "ldproxy"
# Uncomment for ESP-IDF 5 and later. Don't forget to also uncomment the `ESP_IDF_VERSION = "release/v5.0"`parameter in the `[env]` section below
#rustflags = ["--cfg", "espidf_time64"]
# Comment the line below for ESP IDF 4. Don't forget to also uncomment the `ESP_IDF_VERSION = "v4.4.6"` parameter in the `[env]` section below
rustflags = ["--cfg", "espidf_time64"]

[target.xtensa-esp32s2-espidf]
linker = "ldproxy"
# Uncomment for ESP-IDF 5 and later. Don't forget to also uncomment the `ESP_IDF_VERSION = "release/v5.0"`parameter in the `[env]` section below
#rustflags = ["--cfg", "espidf_time64"]
# Comment the line below for ESP IDF 4. Don't forget to also uncomment the `ESP_IDF_VERSION = "v4.4.6"` parameter in the `[env]` section below
rustflags = ["--cfg", "espidf_time64"]

[target.xtensa-esp32s3-espidf]
linker = "ldproxy"
# Uncomment for ESP-IDF 5 and later. Don't forget to also uncomment the `ESP_IDF_VERSION = "release/v5.0"`parameter in the `[env]` section below
#rustflags = ["--cfg", "espidf_time64"]
# Comment the line below for ESP IDF 4. Don't forget to also uncomment the `ESP_IDF_VERSION = "v4.4.6"` parameter in the `[env]` section below
rustflags = ["--cfg", "espidf_time64"]

[target.riscv32imc-esp-espidf]
linker = "ldproxy"
# TODO: Is `["-C", "default-linker-libraries"]` still necessary? See https://github.com/ivmarkov/embuild/issues/16
# Uncomment for ESP-IDF 5 and later. Don't forget to also uncomment the `ESP_IDF_VERSION = "release/v5.0"`parameter in the `[env]` section below
#rustflags = ["--cfg", "espidf_time64"]
# Comment the line below for ESP IDF 4. Don't forget to also uncomment the `ESP_IDF_VERSION = "v4.4.6"` parameter in the `[env]` section below
rustflags = ["--cfg", "espidf_time64"]

[target.riscv32imac-esp-espidf]
linker = "ldproxy"
# Uncomment for ESP-IDF 5 and later. Don't forget to also uncomment the `ESP_IDF_VERSION = "release/v5.0"`parameter in the `[env]` section below
#rustflags = ["--cfg", "espidf_time64"]
# Comment the line below for ESP IDF 4. Don't forget to also uncomment the `ESP_IDF_VERSION = "v4.4.6"` parameter in the `[env]` section below
rustflags = ["--cfg", "espidf_time64"]

[unstable]
build-std = ["std", "panic_abort"]
Expand All @@ -47,15 +46,15 @@ build-std = ["std", "panic_abort"]
#
# Uncomment this to build against ESP-IDF 5.0
# Don't forget to uncomment also the `rustflags` parameter in your "target" section above
#ESP_IDF_VERSION = "release/v5.0"
#ESP_IDF_VERSION = "v5.0.4"
#
# Uncomment this to build against ESP-IDF 5.1
# Don't forget to uncomment also the `rustflags` parameter in your "target" section above
#ESP_IDF_VERSION = "release/v5.1"
#ESP_IDF_VERSION = "v5.1.1"
#
# Comment out this when using the PlatformIO build, i.e. `cargo build --features pio` (it only supports `v4.3.2`)
ESP_IDF_VERSION = "release/v4.4"
#ESP_IDF_VERSION = "master"
#ESP_IDF_VERSION = "v4.4.6"
ESP_IDF_VERSION = "v5.1.1"

# These configurations will pick up your custom "sdkconfig.release", "sdkconfig.debug" or "sdkconfig.defaults[.*]" files
# that you might put in the root of the project
Expand Down
24 changes: 6 additions & 18 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ repository = "https://github.com/ivmarkov/rust-esp32-std-demo"
license = "MIT OR Apache-2.0"
readme = "README.md"

[patch.crates-io]
smol = { git = "https://github.com/esp-rs-compat/smol" }
polling = { git = "https://github.com/esp-rs-compat/polling" }
socket2 = { git = "https://github.com/esp-rs-compat/socket2" }
#getrandom = { version = "0.2", git = "https://github.com/esp-rs-compat/getrandom.git" }
#getrandom1 = { version = "0.1", git = "https://github.com/esp-rs-compat/getrandom.git", package = "getrandom", branch = "0.1" }
esp-idf-sys = { git = "https://github.com/esp-rs/esp-idf-sys" }

[profile.release]
opt-level = "s"

Expand All @@ -29,7 +21,7 @@ opt-level = "z"
default = []

# Enable this feature for the build to use the PlatformIO tooling instead of the native ESP-IDF tooling under the hood
pio = ["esp-idf-sys/pio"]
pio = ["esp-idf-svc/pio"]

# Enable this feature if you are building for QEMU
qemu = []
Expand Down Expand Up @@ -64,23 +56,19 @@ w5500 = []
anyhow = {version = "1", features = ["backtrace"]}
log = "0.4"
url = "2"
esp-idf-sys = { version = "0.33", features = ["binstart"] }
esp-idf-svc = "0.46"
esp-idf-hal = "0.41"
embedded-svc = "0.25"
embedded-hal = "0.2"
esp-idf-svc = { version = "0.47", features = ["nightly"] }
embedded-graphics = "0.7"
display-interface = "0.4"
display-interface-spi = "0.4"
mipidsi = "0.5"
ssd1306 = "0.7"
epd-waveshare = "0.5.0"
smol = "1.2"
async-io = "=1.12"
async-io = "2"
async-executor = "1"
futures-lite = "1"

[build-dependencies]
embuild = { version = "0.31.2", features = ["elf"] }
anyhow = "1"
embuild = { version = "0.31.3", features = ["elf"] }

# Future; might be possible once https://github.com/rust-lang/cargo/issues/9096 hits Cargo nightly:
#rust-esp32-ulp-blink = { git = "https://github.com/ivmarkov/rust-esp32-ulp-blink", artifact = "bin" }
24 changes: 8 additions & 16 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
use std::path::PathBuf;

use embuild::{
self, bingen,
build::{CfgArgs, LinkArgs},
cargo, symgen,
};
use embuild::{self, bingen, cargo, symgen};

fn main() -> anyhow::Result<()> {
// Necessary because of this issue: https://github.com/rust-lang/cargo/issues/9641
LinkArgs::output_propagated("ESP_IDF")?;

let cfg = CfgArgs::try_from_env("ESP_IDF")?;
fn main() {
embuild::espidf::sysenv::output();

let cfg = embuild::espidf::sysenv::cfg_args().unwrap();
if cfg.get("esp32s2").is_some() {
// Future; might be possible once https://github.com/rust-lang/cargo/issues/9096 hits Cargo nightly:
//let ulp_elf = PathBuf::from(env::var_os("CARGO_BIN_FILE_RUST_ESP32_ULP_BLINK_rust_esp32_ulp_blink").unwrap());
Expand All @@ -20,14 +14,12 @@ fn main() -> anyhow::Result<()> {
cargo::track_file(&ulp_elf);

// This is where the RTC Slow Mem is mapped within the ESP32-S2 memory space
let ulp_bin = symgen::Symgen::new(&ulp_elf, 0x5000_0000_u64).run()?;
let ulp_bin = symgen::Symgen::new(&ulp_elf, 0x5000_0000_u64)
.run()
.unwrap();
cargo::track_file(ulp_bin);

let ulp_sym = bingen::Bingen::new(ulp_elf).run()?;
let ulp_sym = bingen::Bingen::new(ulp_elf).run().unwrap();
cargo::track_file(ulp_sym);
}

cfg.output();

Ok(())
}
Loading

0 comments on commit 359bc82

Please sign in to comment.