From 9773e4bec2003cf2588ec6feeb629fa8bbfca680 Mon Sep 17 00:00:00 2001 From: irriden Date: Sat, 21 Oct 2023 01:28:28 +0000 Subject: [PATCH] factory: no std --- Cargo.toml | 26 - deploy.sh | 4 +- factory/.cargo/config.toml | 6 +- factory/Cargo.lock | 1445 +++++++++++++++++ factory/Cargo.toml | 27 +- factory/build.rs | 7 +- .../rust-toolchain.toml | 0 factory/src/colors.rs | 29 + factory/src/led.rs | 69 +- factory/src/main.rs | 93 +- factory/src/ota.rs | 100 +- factory/src/sdcard.rs | 180 +- factory/table.csv | 4 +- sphinx-key/.cargo/config.toml | 2 +- Cargo.lock => sphinx-key/Cargo.lock | 15 - sphinx-key/Cargo.toml | 29 +- sphinx-key/rust-toolchain.toml | 3 + sphinx-key/up.sh | 4 +- 18 files changed, 1735 insertions(+), 308 deletions(-) delete mode 100644 Cargo.toml create mode 100644 factory/Cargo.lock rename rust-toolchain.toml => factory/rust-toolchain.toml (100%) create mode 100644 factory/src/colors.rs rename Cargo.lock => sphinx-key/Cargo.lock (99%) create mode 100644 sphinx-key/rust-toolchain.toml diff --git a/Cargo.toml b/Cargo.toml deleted file mode 100644 index fb07912..0000000 --- a/Cargo.toml +++ /dev/null @@ -1,26 +0,0 @@ -[workspace] -members = ["factory", "sphinx-key"] -exclude = ["broker", "tester"] -resolver = "2" - -[workspace.dependencies] -anyhow = { version = "1", features = ["backtrace"] } -bitflags = "1.3.2" -embedded-hal = "=1.0.0-alpha.10" -embedded-svc = "0.25.0" -embuild = "0.31.2" -esp-idf-hal = "0.41.1" -esp-idf-svc = { version = "0.46.0", features = ["experimental", "alloc"] } -esp-idf-sys = { version = "0.33.1", features = ["binstart"] } -log = "0.4.17" - -[profile.release] -codegen-units = 1 -lto = true -opt-level = "z" # Optimize for size. -panic = "abort" -strip = true # Automatically strip symbols from the binary. - -[profile.dev] -debug = true # Symbols are nice and they don't increase the size on Flash -opt-level = "z" diff --git a/deploy.sh b/deploy.sh index 9665dc8..25450ef 100755 --- a/deploy.sh +++ b/deploy.sh @@ -85,6 +85,6 @@ else cargo build --bin $BIN fi && -esptool.py --chip esp32-c3 elf2image ../target/riscv32imc-esp-espidf/$MODE/$BIN && -esptool.py --chip esp32c3 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 4MB 0x90000 ../target/riscv32imc-esp-espidf/$MODE/$BIN.bin && +esptool.py --chip esp32-c3 elf2image target/riscv32imc-esp-espidf/$MODE/$BIN && +esptool.py --chip esp32c3 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 4MB 0x50000 target/riscv32imc-esp-espidf/$MODE/$BIN.bin && cargo espflash monitor --port $PORT diff --git a/factory/.cargo/config.toml b/factory/.cargo/config.toml index b2278c2..a107432 100644 --- a/factory/.cargo/config.toml +++ b/factory/.cargo/config.toml @@ -7,9 +7,9 @@ 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 = ["core", "alloc", "panic_abort"] [env] -ESP_IDF_SDKCONFIG_DEFAULTS = "factory/sdkconfig.defaults" ESP_IDF_VERSION = "tag:v5.0.2" -MCU = { value = "esp32c3" } +MCU = "esp32c3" +ESP_IDF_TOOLS_INSTALL_DIR = "custom:../.embuild/espressif" diff --git a/factory/Cargo.lock b/factory/Cargo.lock new file mode 100644 index 0000000..515ea61 --- /dev/null +++ b/factory/Cargo.lock @@ -0,0 +1,1445 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "aho-corasick" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +dependencies = [ + "memchr", +] + +[[package]] +name = "aligned" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80a21b9440a626c7fc8573a9e3d3a06b75c7c97754c2949bc7857b90353ca655" +dependencies = [ + "as-slice", +] + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anyhow" +version = "1.0.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" + +[[package]] +name = "as-slice" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516" +dependencies = [ + "stable_deref_trait", +] + +[[package]] +name = "atomic-polyfill" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ff7eb3f316534d83a8a2c3d1674ace8a5a71198eba31e2e2b597833f699b28" +dependencies = [ + "critical-section", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "bindgen" +version = "0.63.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36d860121800b2a9a94f9b5604b332d5cffb234ce17609ea479d723dbc9d3885" +dependencies = [ + "bitflags 1.3.2", + "cexpr", + "clang-sys", + "lazy_static", + "lazycell", + "log", + "peeking_take_while", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 1.0.109", + "which", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" + +[[package]] +name = "bstr" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c79ad7fb2dd38f3dabd76b09c6a5a20c038fc0213ef1e9afd30eb777f120f019" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "build-time" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1219c19fc29b7bfd74b7968b420aff5bc951cf517800176e795d6b2300dd382" +dependencies = [ + "chrono", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "bumpalo" +version = "3.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "camino" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-platform" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12024c4645c97566567129c204f65d5815a8c9aecf30fcbe682b2fe034996d36" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.15.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eee4243f1f26fc7a42710e7439c149e2b10b05472f88090acce52632f231a73a" +dependencies = [ + "camino", + "cargo-platform", + "semver", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "cc" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "num-traits", + "windows-targets 0.48.5", +] + +[[package]] +name = "clang-sys" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[package]] +name = "cmake" +version = "0.1.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31c789563b815f77f4250caee12365734369f942439b7defd71e18a48197130" +dependencies = [ + "cc", +] + +[[package]] +name = "const_format" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a214c7af3d04997541b18d432afaff4c455e79e2029079647e72fc2bd27673" +dependencies = [ + "const_format_proc_macros", +] + +[[package]] +name = "const_format_proc_macros" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7f6ff08fd20f4f299298a28e2dfa8a8ba1036e6cd2460ac1de7b425d76f2500" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" + +[[package]] +name = "critical-section" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" + +[[package]] +name = "cvt" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2ae9bf77fbf2d39ef573205d554d87e86c12f1994e9ea335b0651b9b278bcf1" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "darling" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "darling_macro" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "either" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" + +[[package]] +name = "embassy-futures" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e5367165d347c039360f784812f493b001583ab6a3dd8622f4ce9c30374ec3" + +[[package]] +name = "embassy-sync" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0525b466ca3ace30b57f2db868a35215dfaecd038d8668cb2db03feb7c069a0" +dependencies = [ + "cfg-if", + "critical-section", + "futures-util", + "heapless", +] + +[[package]] +name = "embedded-can" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9d2e857f87ac832df68fa498d18ddc679175cf3d2e4aa893988e5601baf9438" +dependencies = [ + "nb 1.1.0", +] + +[[package]] +name = "embedded-hal" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff" +dependencies = [ + "nb 0.1.3", + "void", +] + +[[package]] +name = "embedded-hal" +version = "1.0.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2894bc2f0457b8ca3d6b8ab8aad64d9337583672494013457f86c5a9146c0e22" + +[[package]] +name = "embedded-hal-nb" +version = "1.0.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "257e3bb0163c69195acb0ebe0083b017b963235861d5ea9741626abdc55f39c9" +dependencies = [ + "embedded-hal 1.0.0-rc.1", + "nb 1.1.0", +] + +[[package]] +name = "embedded-io" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa9417478b5440a2c25f95b25e3ec6ec92e7f9a7ae90c9719e434daeec4ece71" + +[[package]] +name = "embedded-sdmmc" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f4d14180a76a8af24a45a0e1a4f9c97491b05a3b962d59d5e4ce0e6ab103736" +dependencies = [ + "byteorder", + "embedded-hal 0.2.7", + "log", +] + +[[package]] +name = "embedded-svc" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15b1a857f242e7cfeaeae173f8618750b496de21f43ac3e8963404a17498e2e1" +dependencies = [ + "atomic-waker", + "embedded-io", + "enumset", + "heapless", + "no-std-net", + "serde", +] + +[[package]] +name = "embuild" +version = "0.31.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "781ccceeeb5ec01843b78b12b39cab4c90d6dbf853e1e8c2536cdb16e9da642a" +dependencies = [ + "anyhow", + "bindgen", + "bitflags 1.3.2", + "cmake", + "filetime", + "globwalk", + "home", + "log", + "remove_dir_all", + "serde", + "serde_json", + "shlex", + "strum", + "tempfile", + "thiserror", + "which", +] + +[[package]] +name = "enumset" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "226c0da7462c13fb57e5cc9e0dc8f0635e7d27f276a3a7fd30054647f669007d" +dependencies = [ + "enumset_derive", +] + +[[package]] +name = "enumset_derive" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08b6c6ab82d70f08844964ba10c7babb716de2ecaeab9be5717918a5177d3af" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "envy" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f47e0157f2cb54f5ae1bd371b30a2ae4311e1c028f575cd4e81de7353215965" +dependencies = [ + "serde", +] + +[[package]] +name = "errno" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "esp-idf-hal" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d73423bcc800c4045bfe8a67283338cfea0756c238802efd44c8da77b5b714" +dependencies = [ + "atomic-waker", + "embassy-sync", + "embedded-can", + "embedded-hal 0.2.7", + "embedded-hal 1.0.0-rc.1", + "embedded-hal-nb", + "embedded-io", + "embuild", + "enumset", + "esp-idf-sys", + "heapless", + "log", + "nb 1.1.0", + "num_enum", +] + +[[package]] +name = "esp-idf-svc" +version = "0.47.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08bc6a63b023585d3ccad0a1cf22531495a45b6554c051c3a14b71879da12827" +dependencies = [ + "embassy-futures", + "embedded-svc", + "embuild", + "enumset", + "esp-idf-hal", + "heapless", + "log", + "num_enum", + "uncased", +] + +[[package]] +name = "esp-idf-sys" +version = "0.33.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee72f44dbf6e77ccaee0c6f0a0e4f2ccfad184ef4ccb678491b4f4570c2c1d4" +dependencies = [ + "anyhow", + "bindgen", + "build-time", + "cargo_metadata", + "const_format", + "embuild", + "envy", + "libc", + "regex", + "serde", + "strum", + "which", +] + +[[package]] +name = "esp-println" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79b429ea925356d60c10d7214cf0e1777d9578c1287cd50aad09df3c22c4c2f1" + +[[package]] +name = "fastrand" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" + +[[package]] +name = "filetime" +version = "0.2.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "windows-sys 0.48.0", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "fs_at" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "982f82cc75107eef84f417ad6c53ae89bf65b561937ca4a3b3b0fd04d0aa2425" +dependencies = [ + "aligned", + "cfg-if", + "cvt", + "libc", + "nix", + "windows-sys 0.48.0", +] + +[[package]] +name = "futures-core" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" + +[[package]] +name = "futures-task" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" + +[[package]] +name = "futures-util" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "pin-utils", +] + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "globset" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "759c97c1e17c55525b57192c06a267cda0ac5210b222d6b82189a2338fa1c13d" +dependencies = [ + "aho-corasick", + "bstr", + "fnv", + "log", + "regex", +] + +[[package]] +name = "globwalk" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93e3af942408868f6934a7b85134a3230832b9977cf66125df2f9edcfce4ddcc" +dependencies = [ + "bitflags 1.3.2", + "ignore", + "walkdir", +] + +[[package]] +name = "hash32" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" +dependencies = [ + "byteorder", +] + +[[package]] +name = "heapless" +version = "0.7.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db04bc24a18b9ea980628ecf00e6c0264f3c1426dac36c00cb49b6fbad8b0743" +dependencies = [ + "atomic-polyfill", + "hash32", + "rustc_version", + "spin", + "stable_deref_trait", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "home" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +dependencies = [ + "windows-sys 0.48.0", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "ignore" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbe7873dab538a9a44ad79ede1faf5f30d49f9a5c883ddbab48bce81b64b7492" +dependencies = [ + "globset", + "lazy_static", + "log", + "memchr", + "regex", + "same-file", + "thread_local", + "walkdir", + "winapi-util", +] + +[[package]] +name = "itoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" + +[[package]] +name = "js-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + +[[package]] +name = "libc" +version = "0.2.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" + +[[package]] +name = "libloading" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +dependencies = [ + "cfg-if", + "winapi", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" + +[[package]] +name = "lock_api" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "memchr" +version = "2.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "nb" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" +dependencies = [ + "nb 1.1.0", +] + +[[package]] +name = "nb" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" + +[[package]] +name = "nix" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" +dependencies = [ + "bitflags 1.3.2", + "cfg-if", + "libc", +] + +[[package]] +name = "no-std-net" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bcece43b12349917e096cddfa66107277f123e6c96a5aea78711dc601a47152" + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "normpath" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec60c60a693226186f5d6edf073232bfb6464ed97eb22cf3b01c1e8198fd97f5" +dependencies = [ + "windows-sys 0.48.0", +] + +[[package]] +name = "num-traits" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_enum" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70bf6736f74634d299d00086f02986875b3c2d924781a6a2cb6c201e73da0ceb" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56ea360eafe1022f7cc56cd7b869ed57330fb2453d0c7831d99b74c65d2f5597" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "once_cell" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" + +[[package]] +name = "peeking_take_while" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "proc-macro2" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "regex" +version = "1.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" + +[[package]] +name = "remove_dir_all" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23895cfadc1917fed9c6ed76a8c2903615fa3704f7493ff82b364c6540acc02b" +dependencies = [ + "aligned", + "cfg-if", + "cvt", + "fs_at", + "lazy_static", + "libc", + "normpath", + "windows-sys 0.45.0", +] + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67ce50cb2e16c2903e30d1cbccfd8387a74b9d4c938b6a4c5ec6cc7556f7a8a0" +dependencies = [ + "bitflags 2.4.1", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.48.0", +] + +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + +[[package]] +name = "ryu" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "semver" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" +dependencies = [ + "serde", +] + +[[package]] +name = "serde" +version = "1.0.189" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.189" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "serde_json" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "shlex" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" + +[[package]] +name = "sphinx-key-factory" +version = "0.1.0" +dependencies = [ + "embedded-sdmmc", + "embuild", + "esp-idf-svc", + "esp-println", +] + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "strum" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 1.0.109", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tempfile" +version = "3.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" +dependencies = [ + "cfg-if", + "fastrand", + "redox_syscall", + "rustix", + "windows-sys 0.48.0", +] + +[[package]] +name = "thiserror" +version = "1.0.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "thread_local" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "uncased" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b9bc53168a4be7402ab86c3aad243a84dd7381d09be0eddc81280c1da95ca68" +dependencies = [ + "version_check", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + +[[package]] +name = "walkdir" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.38", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" + +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-core" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" diff --git a/factory/Cargo.toml b/factory/Cargo.toml index 64c7816..708aab9 100644 --- a/factory/Cargo.toml +++ b/factory/Cargo.toml @@ -2,21 +2,28 @@ authors = ["decentclock "] edition = "2021" name = "sphinx-key-factory" -rust-version = "1.66" +rust-version = "1.71" version = "0.1.0" +resolver = "2" [dependencies] -anyhow.workspace = true -bitflags.workspace = true -embedded-hal.workspace = true -embedded-svc.workspace = true -esp-idf-hal.workspace = true -esp-idf-svc.workspace = true -esp-idf-sys.workspace = true -log.workspace = true +esp-idf-svc = { version = "0.47.1", default-features = false, features = ["panic_handler", "libstart", "native"] } +embedded-sdmmc = "0.5.0" +esp-println = { version = "0.6.0", default-features = false, features = ["esp32c3", "uart"] } [build-dependencies] -embuild.workspace = true +embuild = "0.31.3" [package.metadata.espflash] partition_table = "table.csv" + +[profile.release] +codegen-units = 1 +lto = true +opt-level = "z" # Optimize for size. +panic = "abort" +strip = true # Automatically strip symbols from the binary. + +[profile.dev] +debug = true # Symbols are nice and they don't increase the size on Flash +opt-level = "z" diff --git a/factory/build.rs b/factory/build.rs index ccb6e75..112ec3f 100644 --- a/factory/build.rs +++ b/factory/build.rs @@ -1,6 +1,3 @@ -// Necessary because of this issue: https://github.com/rust-lang/cargo/issues/9641 -fn main() -> Result<(), Box> { - embuild::build::CfgArgs::output_propagated("ESP_IDF")?; - embuild::build::LinkArgs::output_propagated("ESP_IDF")?; - Ok(()) +fn main() { + embuild::espidf::sysenv::output(); } diff --git a/rust-toolchain.toml b/factory/rust-toolchain.toml similarity index 100% rename from rust-toolchain.toml rename to factory/rust-toolchain.toml diff --git a/factory/src/colors.rs b/factory/src/colors.rs new file mode 100644 index 0000000..e9cf2b2 --- /dev/null +++ b/factory/src/colors.rs @@ -0,0 +1,29 @@ +pub(crate) struct RGB { + pub(crate) r: u8, + pub(crate) g: u8, + pub(crate) b: u8, +} + +pub(crate) const BLUE: RGB = RGB { + r: 00, + g: 00, + b: 255, +}; + +pub(crate) const GREEN: RGB = RGB { + r: 00, + g: 255, + b: 00, +}; + +pub(crate) const ORANGE: RGB = RGB { + r: 255, + g: 55, + b: 00, +}; + +pub(crate) const WHITE: RGB = RGB { + r: 255, + g: 255, + b: 255, +}; diff --git a/factory/src/led.rs b/factory/src/led.rs index 5ee2df2..87cb9c4 100644 --- a/factory/src/led.rs +++ b/factory/src/led.rs @@ -1,47 +1,54 @@ -use esp_idf_hal::delay::Ets; -use esp_idf_hal::delay::FreeRtos; -use esp_idf_hal::peripherals::Peripherals; -use esp_idf_hal::rmt::config::TransmitConfig; -use esp_idf_hal::rmt::*; -use std::time::Duration; +use crate::{colors::*, FactoryError}; +use core::time::Duration; +use esp_idf_svc::hal::{ + delay::FreeRtos, + gpio::Gpio0, + rmt::{config::TransmitConfig, FixedLengthSignal, PinState, Pulse, TxRmtDriver, CHANNEL0}, + sys::EspError, +}; -pub fn set_ota_led() -> anyhow::Result<()> { - let peripherals = Peripherals::take().unwrap(); - let led = peripherals.pins.gpio0; - let channel = peripherals.rmt.channel0; +pub(crate) struct Peripherals { + pub led: Gpio0, + pub channel: CHANNEL0, +} + +pub(crate) fn setup(peripherals: Peripherals) -> Result, FactoryError> { + let led = peripherals.led; + let channel = peripherals.channel; let config = TransmitConfig::new().clock_divider(1); - let mut tx = TxRmtDriver::new(channel, led, &config).unwrap(); + let tx = TxRmtDriver::new(channel, led, &config).map_err(|e| FactoryError::EspError(e))?; + Ok(tx) +} - neopixel( - RGB { - r: 255, - g: 55, - b: 00, - }, - &mut tx, - )?; +pub(crate) fn setup_complete(led_tx: &mut TxRmtDriver) -> Result<(), FactoryError> { + neopixel(BLUE, led_tx).map_err(|e| FactoryError::EspError(e))?; FreeRtos::delay_ms(10); - Ok(()) } -struct RGB { - r: u8, - g: u8, - b: u8, +pub(crate) fn update_launch(led_tx: &mut TxRmtDriver) -> Result<(), FactoryError> { + neopixel(ORANGE, led_tx).map_err(|e| FactoryError::EspError(e))?; + FreeRtos::delay_ms(10); + Ok(()) +} + +pub(crate) fn update_complete(led_tx: &mut TxRmtDriver) -> Result<(), FactoryError> { + neopixel(GREEN, led_tx).map_err(|e| FactoryError::EspError(e))?; + FreeRtos::delay_ms(10); + Ok(()) +} + +pub(crate) fn main_app_launch(led_tx: &mut TxRmtDriver) -> Result<(), FactoryError> { + neopixel(WHITE, led_tx).map_err(|e| FactoryError::EspError(e))?; + FreeRtos::delay_ms(10); + Ok(()) } fn ns(nanos: u64) -> Duration { Duration::from_nanos(nanos) } -fn rotate_rgb(rgb: u32) -> u32 { - let b_mask: u32 = 0xff; - let blue = (rgb & b_mask) << 16; - blue | (rgb >> 8) -} - -fn neopixel(rgb: RGB, tx: &mut TxRmtDriver) -> anyhow::Result<()> { +fn neopixel(rgb: RGB, tx: &mut TxRmtDriver) -> Result<(), EspError> { // e.g. rgb: (1,2,4) // G R B // 7 0 7 0 7 0 diff --git a/factory/src/main.rs b/factory/src/main.rs index 194f812..bbd1234 100644 --- a/factory/src/main.rs +++ b/factory/src/main.rs @@ -1,37 +1,68 @@ +#![no_std] +#![no_main] + +mod colors; mod led; mod ota; mod sdcard; -use crate::led::set_ota_led; -use esp_idf_sys as _; // If using the `binstart` feature of `esp-idf-sys`, always keep this module imported -use log::{error, info, warn}; -use ota::{run_sdcard_ota_update, set_boot_main_app, UPDATE_BIN_PATH}; -use std::path::Path; -use std::thread; -use std::time::Duration; -fn main() { - // Temporary. Will disappear once ESP-IDF 4.4 is released, but for now it is necessary to call this function once, - // or else some patches to the runtime implemented by esp-idf-sys might not link properly. - esp_idf_svc::log::EspLogger::initialize_default(); - esp_idf_sys::link_patches(); +use embedded_sdmmc::{Error, SdCardError}; +use esp_idf_svc::{ + hal::{delay::FreeRtos, prelude::Peripherals}, + sys::EspError, +}; +use esp_println::println; - thread::sleep(Duration::from_secs(10)); - set_ota_led(); - info!("Hello, world! Mounting sd card..."); - sdcard::mount_sd_card(); - info!("SD card mounted! Checking for update..."); - if let Ok(true) = Path::new(UPDATE_BIN_PATH).try_exists() { - info!("Found update.bin file! Launching the update process..."); - while let Err(e) = run_sdcard_ota_update() { - error!("OTA update failed: {}", e.to_string()); - error!("Trying again..."); - thread::sleep(Duration::from_secs(5)); - } - info!("OTA update complete!"); - } else { - warn!("Update file not found! Setting up main app boot..."); - set_boot_main_app(); - } - info!("Restarting ESP, booting the main app..."); - unsafe { esp_idf_sys::esp_restart() }; +#[derive(Debug)] +pub(crate) enum FactoryError { + SdCardError(Error), + OtaError(EspError), + EspError(EspError), +} + +#[no_mangle] +fn main() -> Result<(), FactoryError> { + esp_idf_svc::sys::link_patches(); + println!("Launcher started"); + let (sd_card_peripherals, led_peripherals) = assign_peripherals()?; + println!("Assigned peripherals"); + let mut manager = sdcard::setup(sd_card_peripherals)?; + println!("Setup sdcard"); + let mut led_tx = led::setup(led_peripherals)?; + println!("Setup led"); + led::setup_complete(&mut led_tx)?; // BLUE + println!("Setup complete"); + FreeRtos::delay_ms(5000u32); + if ota::update_present(&mut manager)? { + led::update_launch(&mut led_tx)?; // ORANGE + println!("Update present, proceeding with update"); + ota::write_update(&mut manager)?; + led::update_complete(&mut led_tx)?; // GREEN + println!("Update finished, restarting the chip"); + } else { + println!("No update present, setting boot to main app"); + ota::set_boot_main_app()?; + led::main_app_launch(&mut led_tx)?; // WHITE + println!("Boot set to main app"); + } + println!("Restarting esp"); + FreeRtos::delay_ms(5000u32); + unsafe { esp_idf_svc::sys::esp_restart() }; +} + +fn assign_peripherals() -> Result<(sdcard::Peripherals, led::Peripherals), FactoryError> { + // this function here must be called only once + let peripherals = Peripherals::take().map_err(|e| FactoryError::EspError(e))?; + let sd_card_peripherals = sdcard::Peripherals { + spi: peripherals.spi2, + sck: peripherals.pins.gpio6, + mosi: peripherals.pins.gpio7, + miso: peripherals.pins.gpio2, + cs: peripherals.pins.gpio10, + }; + let led_peripherals = led::Peripherals { + led: peripherals.pins.gpio0, + channel: peripherals.rmt.channel0, + }; + Ok((sd_card_peripherals, led_peripherals)) } diff --git a/factory/src/ota.rs b/factory/src/ota.rs index db603fa..5b432ce 100644 --- a/factory/src/ota.rs +++ b/factory/src/ota.rs @@ -1,51 +1,69 @@ -use anyhow::Result; -use embedded_svc::io::Write; -use embedded_svc::ota::Ota; -use embedded_svc::ota::OtaUpdate; -use esp_idf_svc::ota::EspOta; -use esp_idf_sys::{esp, esp_ota_get_next_update_partition, esp_ota_set_boot_partition}; -use log::info; -use std::fs::File; -use std::io::BufReader; -use std::io::Read; -use std::ptr; +use crate::sdcard::Manager; +use crate::FactoryError; +use core::ptr; +use embedded_sdmmc::{Error::FileNotFound, Mode, VolumeIdx}; +use esp_idf_svc::{ + ota::EspOta, + sys::{esp, esp_ota_get_next_update_partition, esp_ota_set_boot_partition}, +}; -pub const UPDATE_BIN_PATH: &str = "/sdcard/update.bin"; +const FILE: &str = "update.bin"; const BUFFER_LEN: usize = 1024; -pub fn run_sdcard_ota_update() -> Result<()> { - let f = File::open(UPDATE_BIN_PATH)?; - let mut reader = BufReader::with_capacity(BUFFER_LEN, f); +pub(crate) fn update_present(volume_mgr: &mut Manager) -> Result { + let volume0 = volume_mgr + .get_volume(VolumeIdx(0)) + .map_err(|e| FactoryError::SdCardError(e))?; + let root_dir = volume_mgr + .open_root_dir(&volume0) + .map_err(|e| FactoryError::SdCardError(e))?; + let ret = match volume_mgr.find_directory_entry(&volume0, &root_dir, FILE) { + Ok(_) => Ok(true), + Err(FileNotFound) => Ok(false), + Err(e) => Err(FactoryError::SdCardError(e)), + }; + volume_mgr.close_dir(&volume0, root_dir); + ret +} - let mut ota = EspOta::new()?; - let mut ota = ota.initiate_update()?; +pub(crate) fn write_update(volume_mgr: &mut Manager) -> Result<(), FactoryError> { + let mut volume0 = volume_mgr + .get_volume(VolumeIdx(0)) + .map_err(|e| FactoryError::SdCardError(e))?; + let root_dir = volume_mgr + .open_root_dir(&volume0) + .map_err(|e| FactoryError::SdCardError(e))?; + let mut my_file = volume_mgr + .open_file_in_dir(&mut volume0, &root_dir, FILE, Mode::ReadOnly) + .map_err(|e| FactoryError::SdCardError(e))?; - let mut buf = [0_u8; BUFFER_LEN]; - let mut read_tot: usize = 0; - let mut write_tot: usize = 0; - let mut i = 0; - loop { - let r = reader.read(&mut buf)?; - if r == 0 { - break; - } - let w = ota.write(&buf[..r])?; - read_tot += r; - write_tot += w; - i += 1; - if i % 20 == 0 { - info!("Cumulative bytes read: {}", read_tot); - info!("Cumulative bytes written: {}", write_tot); - } + let mut ota = EspOta::new().map_err(|e| FactoryError::OtaError(e))?; + let mut ota = ota + .initiate_update() + .map_err(|e| FactoryError::OtaError(e))?; + + let mut buffer = [0u8; BUFFER_LEN]; + while !my_file.eof() { + let r = volume_mgr + .read(&volume0, &mut my_file, &mut buffer) + .map_err(|e| FactoryError::SdCardError(e))?; + ota.write(&buffer[..r]) + .map_err(|e| FactoryError::OtaError(e))?; } - info!("TOTAL read: {}", read_tot); - info!("TOTAL write: {}", write_tot); - ota.complete()?; + + ota.complete().map_err(|e| FactoryError::OtaError(e))?; + + volume_mgr + .close_file(&volume0, my_file) + .map_err(|e| FactoryError::SdCardError(e))?; + volume_mgr.close_dir(&volume0, root_dir); Ok(()) } -pub fn set_boot_main_app() { - let partition = unsafe { esp_ota_get_next_update_partition(ptr::null()) }; - esp!(unsafe { esp_ota_set_boot_partition(partition) }) - .expect("Couldn't set next boot partition..."); +pub(crate) fn set_boot_main_app() -> Result<(), FactoryError> { + esp!(unsafe { + let partition = esp_ota_get_next_update_partition(ptr::null()); + esp_ota_set_boot_partition(partition) + }) + .map_err(|e| FactoryError::OtaError(e)) } diff --git a/factory/src/sdcard.rs b/factory/src/sdcard.rs index d3b8bc3..c167c2c 100644 --- a/factory/src/sdcard.rs +++ b/factory/src/sdcard.rs @@ -1,139 +1,59 @@ -use bitflags::bitflags; -use core::ffi::c_char; -use esp_idf_sys::{ - esp, esp_vfs_fat_sdmmc_mount_config_t, esp_vfs_fat_sdspi_mount, gpio_num_t, sdmmc_card_t, - sdmmc_host_t, sdspi_device_config_t, spi_bus_config_t, spi_bus_initialize, spi_host_device_t, - spi_host_device_t_SPI2_HOST, +use crate::FactoryError; +use embedded_sdmmc::{SdCard, TimeSource, Timestamp, VolumeManager}; +use esp_idf_svc::hal::{ + delay::Ets, + gpio::{Gpio10, Gpio2, Gpio6, Gpio7, Output, PinDriver}, + spi::{ + config::{DriverConfig, Duplex}, + SpiConfig, SpiDeviceDriver, SpiDriver, SPI2, + }, + units::FromValueType, }; -use std::ptr; -use std::thread; -use std::time::Duration; -const C_MOUNT_POINT: &'static [u8] = b"/sdcard\0"; +pub(crate) type Manager<'a> = VolumeManager< + SdCard>, PinDriver<'a, Gpio10, Output>, Ets>, + SdMmcClock, +>; -const SPI_HOST_SLOT: spi_host_device_t = spi_host_device_t_SPI2_HOST; -const SPI_GPIO_MOSI: gpio_num_t = 7; -const SPI_GPIO_CLK: gpio_num_t = 6; -const SPI_GPIO_MISO: gpio_num_t = 2; -const SPI_GPIO_CS: gpio_num_t = 10; - -bitflags! { - struct SDMMCHostFlag: u32 { - /// host supports 1-line SD and MMC protocol - const BIT1 = 1 << 0; - /// host supports 4-line SD and MMC protocol - const BIT4 = 1 << 1; - /// host supports 8-line MMC protocol - const BIT8 = 1 << 2; - /// host supports SPI protocol - const SPI = 1 << 3; - /// host supports DDR mode for SD/MMC - const DDR = 1 << 4; - /// host `deinit` function called with the slot argument - const DEINIT_ARG = 1 << 5; - } +pub(crate) struct Peripherals { + pub spi: SPI2, + pub sck: Gpio6, + pub mosi: Gpio7, + pub miso: Gpio2, + pub cs: Gpio10, } -#[allow(dead_code)] -enum SDMMCFreq { - /// SD/MMC Default speed (limited by clock divider) - Default = 20000, - /// SD High speed (limited by clock divider) - HighSPeed = 40000, - /// SD/MMC probing speed - Probing = 400, - /// MMC 52MHz speed - _52M = 52000, - /// MMC 26MHz speed - _26M = 26000, -} +pub(crate) struct SdMmcClock; -#[allow(unused)] -pub fn mount_sd_card() { - while let Err(e) = setup() { - println!("Failed to mount sd card. Make sure it is connected, trying again..."); - thread::sleep(Duration::from_secs(5)); - } -} - -fn setup() -> anyhow::Result<()> { - let mount_config = esp_vfs_fat_sdmmc_mount_config_t { - 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(); - - let bus_cfg = spi_bus_config_t { - __bindgen_anon_1: esp_idf_sys::spi_bus_config_t__bindgen_ty_1 { - mosi_io_num: SPI_GPIO_MOSI, - }, - __bindgen_anon_2: esp_idf_sys::spi_bus_config_t__bindgen_ty_2 { - miso_io_num: SPI_GPIO_MISO, - }, - sclk_io_num: SPI_GPIO_CLK, - __bindgen_anon_3: esp_idf_sys::spi_bus_config_t__bindgen_ty_3 { quadwp_io_num: -1 }, - __bindgen_anon_4: esp_idf_sys::spi_bus_config_t__bindgen_ty_4 { quadhd_io_num: -1 }, - data4_io_num: -1, - data5_io_num: -1, - data6_io_num: -1, - data7_io_num: -1, - max_transfer_sz: 4000, - flags: 0, - intr_flags: 0, - }; - - if let Err(error) = esp!(unsafe { - spi_bus_initialize( - SPI_HOST_SLOT as u32, - &bus_cfg, - esp_idf_sys::spi_common_dma_t_SPI_DMA_CH_AUTO, - ) - }) { - if error.code() != 259 { - return Err(anyhow::Error::new(error)); +impl TimeSource for SdMmcClock { + fn get_timestamp(&self) -> Timestamp { + Timestamp { + year_since_1970: 0, + zero_indexed_month: 0, + zero_indexed_day: 0, + hours: 0, + minutes: 0, + seconds: 0, } } - - println!("Initialized SPI BUS!"); - - let slot_config = sdspi_device_config_t { - host_id: SPI_HOST_SLOT, - gpio_cs: SPI_GPIO_CS, - gpio_cd: -1, - gpio_wp: -1, - gpio_int: -1, - }; - - let host = sdmmc_host_t { - flags: (SDMMCHostFlag::SPI | SDMMCHostFlag::DEINIT_ARG).bits, //SDMMC_HOST_FLAG_SPI | SDMMC_HOST_FLAG_DEINIT_ARG, - slot: SPI_HOST_SLOT as i32, - max_freq_khz: SDMMCFreq::Default as i32, //SDMMC_FREQ_DEFAULT, - io_voltage: 3.3f32, - init: Some(esp_idf_sys::sdspi_host_init), - set_bus_width: None, - get_bus_width: None, - set_bus_ddr_mode: None, - set_card_clk: Some(esp_idf_sys::sdspi_host_set_card_clk), - do_transaction: Some(esp_idf_sys::sdspi_host_do_transaction), - __bindgen_anon_1: esp_idf_sys::sdmmc_host_t__bindgen_ty_1 { - deinit_p: Some(esp_idf_sys::sdspi_host_remove_device), - }, - io_int_enable: Some(esp_idf_sys::sdspi_host_io_int_enable), - io_int_wait: Some(esp_idf_sys::sdspi_host_io_int_wait), - command_timeout_ms: 0, - }; - - esp!(unsafe { - esp_vfs_fat_sdspi_mount( - C_MOUNT_POINT.as_ptr() as *const c_char, - &host, - &slot_config, - &mount_config, - &mut card as *mut *mut sdmmc_card_t, - ) - })?; - Ok(()) +} + +pub(crate) fn setup(peripherals: Peripherals) -> Result, FactoryError> { + let driver = SpiDriver::new( + peripherals.spi, + peripherals.sck, + peripherals.mosi, + Some(peripherals.miso), + &DriverConfig::default(), + ) + .map_err(|e| FactoryError::EspError(e))?; + let mut spi_config = SpiConfig::new(); + spi_config.duplex = Duplex::Full; + spi_config = spi_config.baudrate(24.MHz().into()); + let spi = SpiDeviceDriver::new(driver, Option::::None, &spi_config) + .map_err(|e| FactoryError::EspError(e))?; + let sdmmc_cs = PinDriver::output(peripherals.cs).map_err(|e| FactoryError::EspError(e))?; + let sdcard = SdCard::new(spi, sdmmc_cs, Ets {}); + let volume_mgr = VolumeManager::new(sdcard, SdMmcClock {}); + Ok(volume_mgr) } diff --git a/factory/table.csv b/factory/table.csv index b88bbcb..bce5f85 100644 --- a/factory/table.csv +++ b/factory/table.csv @@ -3,8 +3,8 @@ nvs, data, nvs, 0x9000, 0x4000, otadata, data, ota, 0xd000, 0x2000, phy_init, data, phy, 0xf000, 0x1000, -factory, app, factory, 0x10000, 0x80000, -ota_0, app, ota_0, 0x90000, 0x370000, +factory, app, factory, 0x10000, 0x40000, +ota_0, app, ota_0, 0x50000, 0x3b0000, # Total flash size is 0x400000 # Partitions of type app have to be placed at offsets aligned to 0x10000 (64 K). # See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/partition-tables.html diff --git a/sphinx-key/.cargo/config.toml b/sphinx-key/.cargo/config.toml index 355b4b8..98db7ef 100644 --- a/sphinx-key/.cargo/config.toml +++ b/sphinx-key/.cargo/config.toml @@ -12,6 +12,6 @@ build-std = ["std", "panic_abort"] [env] CC = { value = "../.embuild/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/riscv32-esp-elf-gcc", relative = true } CFLAGS = { value = "-fno-pic" } -ESP_IDF_SDKCONFIG_DEFAULTS = "sphinx-key/sdkconfig.defaults" ESP_IDF_VERSION = "tag:v5.0.2" MCU = { value = "esp32c3" } +ESP_IDF_TOOLS_INSTALL_DIR = "custom:../.embuild/espressif" diff --git a/Cargo.lock b/sphinx-key/Cargo.lock similarity index 99% rename from Cargo.lock rename to sphinx-key/Cargo.lock index 4ff5081..9eb6251 100644 --- a/Cargo.lock +++ b/sphinx-key/Cargo.lock @@ -1848,21 +1848,6 @@ dependencies = [ "url", ] -[[package]] -name = "sphinx-key-factory" -version = "0.1.0" -dependencies = [ - "anyhow", - "bitflags", - "embedded-hal 1.0.0-alpha.10", - "embedded-svc", - "embuild", - "esp-idf-hal", - "esp-idf-svc", - "esp-idf-sys", - "log", -] - [[package]] name = "sphinx-signer" version = "0.1.0" diff --git a/sphinx-key/Cargo.toml b/sphinx-key/Cargo.toml index 533d45f..78fa681 100644 --- a/sphinx-key/Cargo.toml +++ b/sphinx-key/Cargo.toml @@ -4,6 +4,7 @@ edition = "2021" name = "sphinx-key" rust-version = "1.66" version = "0.1.0" +resolver = "2" [features] default = ["std"] @@ -28,17 +29,17 @@ sphinx-signer = { git = "https://github.com/stakwork/sphinx-rs.git", optional = # sphinx-crypter = { path = "../../sphinx-rs/crypter" } # sphinx-signer = { path = "../../sphinx-rs/signer", optional = true } -anyhow.workspace = true -bitflags.workspace = true -embedded-hal.workspace = true -embedded-svc.workspace = true -esp-idf-hal.workspace = true -esp-idf-svc.workspace = true -esp-idf-sys.workspace = true -log.workspace = true +anyhow = { version = "1", features = ["backtrace"] } +bitflags = "1.3.2" +embedded-hal = "=1.0.0-alpha.10" +embedded-svc = "0.25.0" +esp-idf-hal = "0.41.1" +esp-idf-svc = { version = "0.46.0", features = ["experimental", "alloc"] } +esp-idf-sys = { version = "0.33.1", features = ["binstart"] } +log = "0.4.17" [build-dependencies] -embuild.workspace = true +embuild = "0.31.2" [[bin]] name = "clear" @@ -48,3 +49,13 @@ path = "src/clear.rs" name = "btn" path = "src/btn.rs" +[profile.release] +codegen-units = 1 +lto = true +opt-level = "z" # Optimize for size. +panic = "abort" +strip = true # Automatically strip symbols from the binary. + +[profile.dev] +debug = true # Symbols are nice and they don't increase the size on Flash +opt-level = "z" diff --git a/sphinx-key/rust-toolchain.toml b/sphinx-key/rust-toolchain.toml new file mode 100644 index 0000000..33fa244 --- /dev/null +++ b/sphinx-key/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "nightly-2023-06-13" +components = ["rust-src"] diff --git a/sphinx-key/up.sh b/sphinx-key/up.sh index 943954a..1cf0990 100755 --- a/sphinx-key/up.sh +++ b/sphinx-key/up.sh @@ -68,6 +68,6 @@ then else cargo build --bin sphinx-key fi && -esptool.py --chip esp32-c3 elf2image ../target/riscv32imc-esp-espidf/$MODE/sphinx-key && -esptool.py --chip esp32c3 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 4MB 0x90000 ../target/riscv32imc-esp-espidf/$MODE/sphinx-key.bin && +esptool.py --chip esp32-c3 elf2image target/riscv32imc-esp-espidf/$MODE/sphinx-key && +esptool.py --chip esp32c3 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 4MB 0x50000 target/riscv32imc-esp-espidf/$MODE/sphinx-key.bin && cargo espflash monitor --port $PORT