From f9c50853b113a02d76b4152d41b515a3d280a5ee Mon Sep 17 00:00:00 2001 From: irriden Date: Thu, 15 Jun 2023 17:05:46 +0000 Subject: [PATCH] upgrade to ESP_IDF release/v5.0 also mirror all the config files to the ones created with this command: cargo generate --git https://github.com/esp-rs/esp-idf-template cargo just make sure to select a version 5 esp idf in the prompts --- sphinx-key/.cargo/config.toml | 30 +++--------- sphinx-key/Cargo.lock | 87 +++------------------------------- sphinx-key/Cargo.toml | 6 +-- sphinx-key/build.rs | 5 +- sphinx-key/rust-toolchain.toml | 4 +- sphinx-key/src/periph/sd.rs | 1 + 6 files changed, 21 insertions(+), 112 deletions(-) diff --git a/sphinx-key/.cargo/config.toml b/sphinx-key/.cargo/config.toml index 6d4c078..d8356f2 100644 --- a/sphinx-key/.cargo/config.toml +++ b/sphinx-key/.cargo/config.toml @@ -1,36 +1,18 @@ [build] -# Uncomment the relevant target for your chip here (ESP32, ESP32-S2, ESP32-S3 or ESP32-C3) -#target = "xtensa-esp32-espidf" -#target = "xtensa-esp32s2-espidf" -#target = "xtensa-esp32s3-espidf" target = "riscv32imc-esp-espidf" -[target.xtensa-esp32-espidf] -linker = "ldproxy" - -[target.xtensa-esp32s2-espidf] -linker = "ldproxy" - -[target.xtensa-esp32s3-espidf] -linker = "ldproxy" - [target.riscv32imc-esp-espidf] linker = "ldproxy" - -# Future - necessary for the experimental "native build" of esp-idf-sys with ESP32C3 -# See also https://github.com/ivmarkov/embuild/issues/16 -rustflags = ["-C", "default-linker-libraries"] +# runner = "espflash --monitor" # Select this runner for espflash v1.x.x +runner = "espflash flash --monitor" # Select this runner for espflash v2.x.x +rustflags = ["--cfg", "espidf_time64", "-C", "default-linker-libraries"] [unstable] - build-std = ["std", "panic_abort"] -build-std-features = ["panic_immediate_abort"] # Required for older ESP-IDF versions without a realpath implementation [env] -# Note: these variables are not used when using pio builder -# Enables the esp-idf-sys "native" build feature (`cargo build --features native`) to build against ESP-IDF stable (v4.4) -ESP_IDF_VERSION = { value = "tag:v4.4.2" } -# Enables the esp-idf-sys "native" build feature (`cargo build --features native`) to build against ESP-IDF master (mainline) -#ESP_IDF_VERSION = { value = "master" } +# Note: these variables are not used when using pio builder (`cargo build --features pio`) +ESP_IDF_VERSION = "release/v5.0" CC = { value = "../factory/.embuild/espressif/tools/riscv32-esp-elf/esp-2021r2-patch3-8.4.0/riscv32-esp-elf/bin/riscv32-esp-elf-gcc", relative = true } CFLAGS = { value = "-fno-pic" } +MCU = { value = "esp32c3" } diff --git a/sphinx-key/Cargo.lock b/sphinx-key/Cargo.lock index 321a489..2c79a14 100644 --- a/sphinx-key/Cargo.lock +++ b/sphinx-key/Cargo.lock @@ -290,7 +290,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f83bc2e401ed041b7057345ebc488c005efa0341d5541ce7004d30458d0090b" dependencies = [ "serde", - "toml 0.7.3", + "toml", ] [[package]] @@ -575,26 +575,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "dirs" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - [[package]] name = "edge-executor" version = "0.3.0" @@ -683,26 +663,6 @@ dependencies = [ "strum_macros 0.23.1", ] -[[package]] -name = "embuild" -version = "0.29.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd1dd6c90e28cfc361281a692320fcd820bcae71d327215e87c7d749bf8ddd26" -dependencies = [ - "anyhow", - "bitflags", - "dirs", - "filetime", - "log", - "serde", - "serde_json", - "shlex", - "strum 0.24.1", - "thiserror", - "toml 0.5.11", - "xmas-elf", -] - [[package]] name = "embuild" version = "0.31.2" @@ -725,7 +685,7 @@ dependencies = [ "strum 0.24.1", "tempfile", "thiserror", - "toml 0.7.3", + "toml", "ureq", "which", ] @@ -795,7 +755,7 @@ dependencies = [ "embedded-hal 0.2.7", "embedded-hal 1.0.0-alpha.10", "embedded-hal-nb", - "embuild 0.31.2", + "embuild", "enumset", "esp-idf-sys", "heapless", @@ -811,7 +771,7 @@ dependencies = [ "anyhow", "embassy-futures", "embedded-svc", - "embuild 0.31.2", + "embuild", "enumset", "esp-idf-hal", "esp-idf-sys", @@ -831,7 +791,7 @@ dependencies = [ "build-time", "cargo_metadata", "const_format", - "embuild 0.31.2", + "embuild", "envy", "libc", "regex", @@ -1631,17 +1591,6 @@ dependencies = [ "bitflags", ] -[[package]] -name = "redox_users" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" -dependencies = [ - "getrandom", - "redox_syscall 0.2.16", - "thiserror", -] - [[package]] name = "regex" version = "1.7.3" @@ -2010,7 +1959,7 @@ dependencies = [ "bitflags", "embedded-hal 1.0.0-alpha.10", "embedded-svc", - "embuild 0.29.3", + "embuild", "esp-idf-hal", "esp-idf-svc", "esp-idf-sys", @@ -2229,15 +2178,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" -[[package]] -name = "toml" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" -dependencies = [ - "serde", -] - [[package]] name = "toml" version = "0.7.3" @@ -2756,21 +2696,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "xmas-elf" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d29b4d8e7beaceb4e77447ba941a7600d23d0319ab52da0461abea214832d5a" -dependencies = [ - "zero", -] - -[[package]] -name = "zero" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fe21bcc34ca7fe6dd56cc2cb1261ea59d6b93620215aefb5ea6032265527784" - [[package]] name = "zeroize" version = "1.6.0" diff --git a/sphinx-key/Cargo.toml b/sphinx-key/Cargo.toml index c93d941..a77d06e 100644 --- a/sphinx-key/Cargo.toml +++ b/sphinx-key/Cargo.toml @@ -2,8 +2,9 @@ name = "sphinx-key" version = "0.1.0" authors = ["Evan Feenstra "] -edition = "2018" +edition = "2021" resolver = "2" +rust-version = "1.66" [profile.release] opt-level = "s" @@ -41,8 +42,7 @@ hex = "0.4.3" rmp-serde = "1.1.0" [build-dependencies] -embuild = "0.29" -anyhow = "1" +embuild = "0.31.2" [[bin]] name = "clear" diff --git a/sphinx-key/build.rs b/sphinx-key/build.rs index 4dd5e1f..ccb6e75 100644 --- a/sphinx-key/build.rs +++ b/sphinx-key/build.rs @@ -1,5 +1,6 @@ // Necessary because of this issue: https://github.com/rust-lang/cargo/issues/9641 -fn main() -> anyhow::Result<()> { +fn main() -> Result<(), Box> { embuild::build::CfgArgs::output_propagated("ESP_IDF")?; - embuild::build::LinkArgs::output_propagated("ESP_IDF") + embuild::build::LinkArgs::output_propagated("ESP_IDF")?; + Ok(()) } diff --git a/sphinx-key/rust-toolchain.toml b/sphinx-key/rust-toolchain.toml index f2f405b..f70d225 100644 --- a/sphinx-key/rust-toolchain.toml +++ b/sphinx-key/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] - -channel = "nightly-2022-10-20" +channel = "nightly" +components = ["rust-src"] diff --git a/sphinx-key/src/periph/sd.rs b/sphinx-key/src/periph/sd.rs index 7a64da3..d08ce20 100644 --- a/sphinx-key/src/periph/sd.rs +++ b/sphinx-key/src/periph/sd.rs @@ -58,6 +58,7 @@ pub fn mount_sd_card() -> anyhow::Result<()> { format_if_mount_failed: false, max_files: 5, allocation_unit_size: 16 * 1024, + disk_status_check_enable: false, }; let mut card: *mut sdmmc_card_t = ptr::null_mut();