From 4c042d8e8ae68a9fef2a600aca524c4b628c39d9 Mon Sep 17 00:00:00 2001 From: Julien Cretin Date: Tue, 23 Jul 2024 16:54:52 +0200 Subject: [PATCH 1/4] Release the provenance attestation (#547) --- .github/workflows/ci.yml | 3 +++ scripts/artifacts.sh | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 218d60ff..9b15f164 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -107,9 +107,12 @@ jobs: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - run: ./scripts/artifacts.sh - uses: actions/attest-build-provenance@897ed5eab6ed058a474202017ada7f40bfa52940 # v1.0.0 + id: attest with: subject-path: 'artifacts/*' - run: | + mv ${{ steps.attest.outputs.bundle-path }} attestation.intoto.jsonl + echo 'attestation.intoto.jsonl#Provenance attestation' >> artifacts.txt COMMIT=$(git rev-parse -q --verify HEAD) DATE=$(git log -1 --pretty=%cs) xargs --arg-file=artifacts.txt --delimiter='\n' \ diff --git a/scripts/artifacts.sh b/scripts/artifacts.sh index 11e63928..a3c9d672 100755 --- a/scripts/artifacts.sh +++ b/scripts/artifacts.sh @@ -27,6 +27,10 @@ You can use the following command to verify a downloaded asset: gh attestation verify --repo=google/wasefire +You may also download the provenance attestation and use the \`--bundle\` flag: + + gh attestation verify --owner=google --bundle=attestation.intoto.jsonl + [changelog]: https://github.com/google/wasefire/blob/main/docs/releases/$DATE.md EOF From c8499ddf3a1046982dc9a81313f64b701876e4cb Mon Sep 17 00:00:00 2001 From: Julien Cretin Date: Sun, 28 Jul 2024 13:01:40 +0200 Subject: [PATCH 2/4] Fix copy_if_changed with multiple sources (#550) When using `copy_if_changed()` from 2 different sources `a.src` and `b.src` to `x.dst` in an ABA scenario, it is possible that the modification timestamp of `a.src` is not updated on the last run, and will thus not be copied. We introduce a copy of the source file next to the destination file to fix this issue. --- crates/cli-tools/CHANGELOG.md | 6 ++++++ crates/cli-tools/Cargo.lock | 2 +- crates/cli-tools/Cargo.toml | 2 +- crates/cli-tools/src/fs.rs | 13 +++++++++++-- crates/cli-tools/src/lib.rs | 2 ++ crates/cli/CHANGELOG.md | 1 + crates/cli/Cargo.lock | 2 +- crates/cli/Cargo.toml | 2 +- crates/protocol/crates/schema/Cargo.lock | 2 +- crates/xtask/Cargo.lock | 2 +- crates/xtask/Cargo.toml | 2 +- 11 files changed, 27 insertions(+), 9 deletions(-) diff --git a/crates/cli-tools/CHANGELOG.md b/crates/cli-tools/CHANGELOG.md index 049134bc..71b50688 100644 --- a/crates/cli-tools/CHANGELOG.md +++ b/crates/cli-tools/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 0.1.1-git + +### Minor + +- Change the behavior of `fs::copy_if_changed()` to keep an original source + ## 0.1.0 diff --git a/crates/cli-tools/Cargo.lock b/crates/cli-tools/Cargo.lock index 600c1734..9b2f1589 100644 --- a/crates/cli-tools/Cargo.lock +++ b/crates/cli-tools/Cargo.lock @@ -374,7 +374,7 @@ dependencies = [ [[package]] name = "wasefire-cli-tools" -version = "0.1.0" +version = "0.1.1-git" dependencies = [ "anyhow", "cargo_metadata", diff --git a/crates/cli-tools/Cargo.toml b/crates/cli-tools/Cargo.toml index 5a229a61..044970df 100644 --- a/crates/cli-tools/Cargo.toml +++ b/crates/cli-tools/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasefire-cli-tools" -version = "0.1.0" +version = "0.1.1-git" authors = ["Julien Cretin "] license = "Apache-2.0" publish = true diff --git a/crates/cli-tools/src/fs.rs b/crates/cli-tools/src/fs.rs index 44ef1489..b04d6072 100644 --- a/crates/cli-tools/src/fs.rs +++ b/crates/cli-tools/src/fs.rs @@ -66,9 +66,18 @@ pub fn copy(from: impl AsRef, to: impl AsRef) -> Result { } pub fn copy_if_changed(src: impl AsRef, dst: impl AsRef) -> Result { - let changed = !exists(&dst) || metadata(&dst)?.modified()? < metadata(&src)?.modified()?; + let dst_orig = dst.as_ref().with_added_extension("orig"); + let mut changed = !exists(&dst) + || metadata(&dst)?.modified()? < metadata(&src)?.modified()? + || !exists(&dst_orig); + if !changed { + let src_data = std::fs::read(&src)?; + let dst_data = std::fs::read(&dst_orig)?; + changed = src_data != dst_data; + } if changed { - copy(src, dst)?; + copy(&src, dst)?; + std::fs::copy(src, dst_orig)?; } Ok(changed) } diff --git a/crates/cli-tools/src/lib.rs b/crates/cli-tools/src/lib.rs index e2172c3b..6f7b0670 100644 --- a/crates/cli-tools/src/lib.rs +++ b/crates/cli-tools/src/lib.rs @@ -16,6 +16,8 @@ //! //! This library is also used for the internal maintenance CLI of Wasefire called xtask. +#![feature(path_add_extension)] + macro_rules! debug { ($($x:tt)*) => { print!("\x1b[1;36m"); diff --git a/crates/cli/CHANGELOG.md b/crates/cli/CHANGELOG.md index 4d01be2c..ab5c0a1d 100644 --- a/crates/cli/CHANGELOG.md +++ b/crates/cli/CHANGELOG.md @@ -4,6 +4,7 @@ ### Patch +- Update dependencies - Restore release builds to the default ## 0.1.1 diff --git a/crates/cli/Cargo.lock b/crates/cli/Cargo.lock index 7f62c7a6..c0b90887 100644 --- a/crates/cli/Cargo.lock +++ b/crates/cli/Cargo.lock @@ -479,7 +479,7 @@ dependencies = [ [[package]] name = "wasefire-cli-tools" -version = "0.1.0" +version = "0.1.1-git" dependencies = [ "anyhow", "cargo_metadata", diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 500acf9c..91f3af0a 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -22,7 +22,7 @@ clap_complete = { version = "4.5.2", default-features = false } data-encoding = { version = "2.6.0", default-features = false, features = ["std"] } humantime = { version = "2.1.0", default-features = false } rusb = { version = "0.9.4", default-features = false } -wasefire-cli-tools = { version = "0.1.0", path = "../cli-tools" } +wasefire-cli-tools = { version = "0.1.1-git", path = "../cli-tools" } wasefire-protocol = { version = "0.1.0", path = "../protocol", features = ["host"] } wasefire-protocol-usb = { version = "0.1.0", path = "../protocol-usb", features = ["host"] } diff --git a/crates/protocol/crates/schema/Cargo.lock b/crates/protocol/crates/schema/Cargo.lock index a4fb91dd..863c5ca3 100644 --- a/crates/protocol/crates/schema/Cargo.lock +++ b/crates/protocol/crates/schema/Cargo.lock @@ -385,7 +385,7 @@ dependencies = [ [[package]] name = "wasefire-cli-tools" -version = "0.1.0" +version = "0.1.1-git" dependencies = [ "anyhow", "cargo_metadata", diff --git a/crates/xtask/Cargo.lock b/crates/xtask/Cargo.lock index fa205ac8..db0bab43 100644 --- a/crates/xtask/Cargo.lock +++ b/crates/xtask/Cargo.lock @@ -1686,7 +1686,7 @@ dependencies = [ [[package]] name = "wasefire-cli-tools" -version = "0.1.0" +version = "0.1.1-git" dependencies = [ "anyhow", "cargo_metadata", diff --git a/crates/xtask/Cargo.toml b/crates/xtask/Cargo.toml index f7f6c680..ed3cf93f 100644 --- a/crates/xtask/Cargo.toml +++ b/crates/xtask/Cargo.toml @@ -16,7 +16,7 @@ probe-rs = "0.24.0" rustc-demangle = "0.1.24" serde = { version = "1.0.202", features = ["derive"] } stack-sizes = "0.5.0" -wasefire-cli-tools = { version = "0.1.0", path = "../cli-tools" } +wasefire-cli-tools = { path = "../cli-tools" } [lints] clippy.unit-arg = "allow" From 474cf67f8ef8f5cd1b10f7ed911f317e9027316c Mon Sep 17 00:00:00 2001 From: Julien Cretin Date: Wed, 31 Jul 2024 11:33:20 +0200 Subject: [PATCH 3/4] Add WASM benchmarks using wasm-coremark (#552) Co-authored-by: zhouwfang <33002388+zhouwfang@users.noreply.github.com> --- .gitmodules | 3 + crates/wasm-bench/.cargo/config.toml | 3 + crates/wasm-bench/Cargo.lock | 1720 +++++++++++++++++++++ crates/wasm-bench/Cargo.toml | 64 + crates/wasm-bench/build.rs | 32 + crates/wasm-bench/memory-nordic.x | 6 + crates/wasm-bench/memory-riscv.x | 13 + crates/wasm-bench/run.sh | 42 + crates/wasm-bench/src/allocator.rs | 44 + crates/wasm-bench/src/main.rs | 61 + crates/wasm-bench/src/runtime/base.rs | 52 + crates/wasm-bench/src/runtime/wasm3.rs | 25 + crates/wasm-bench/src/runtime/wasmi.rs | 32 + crates/wasm-bench/src/runtime/wasmtime.rs | 32 + crates/wasm-bench/src/target/linux.rs | 27 + crates/wasm-bench/src/target/nordic.rs | 72 + crates/wasm-bench/src/target/riscv.rs | 41 + crates/wasm-bench/test.sh | 46 + scripts/sync.sh | 1 + third_party/wasm3/wasm-coremark | 1 + 20 files changed, 2317 insertions(+) create mode 100644 crates/wasm-bench/.cargo/config.toml create mode 100644 crates/wasm-bench/Cargo.lock create mode 100644 crates/wasm-bench/Cargo.toml create mode 100644 crates/wasm-bench/build.rs create mode 100644 crates/wasm-bench/memory-nordic.x create mode 100644 crates/wasm-bench/memory-riscv.x create mode 100755 crates/wasm-bench/run.sh create mode 100644 crates/wasm-bench/src/allocator.rs create mode 100644 crates/wasm-bench/src/main.rs create mode 100644 crates/wasm-bench/src/runtime/base.rs create mode 100644 crates/wasm-bench/src/runtime/wasm3.rs create mode 100644 crates/wasm-bench/src/runtime/wasmi.rs create mode 100644 crates/wasm-bench/src/runtime/wasmtime.rs create mode 100644 crates/wasm-bench/src/target/linux.rs create mode 100644 crates/wasm-bench/src/target/nordic.rs create mode 100644 crates/wasm-bench/src/target/riscv.rs create mode 100755 crates/wasm-bench/test.sh create mode 160000 third_party/wasm3/wasm-coremark diff --git a/.gitmodules b/.gitmodules index 404bee9f..f72f46fd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "third_party/rust-lang/rustup"] path = third_party/rust-lang/rustup url = https://github.com/rust-lang/rustup.git +[submodule "third_party/wasm3/wasm-coremark"] + path = third_party/wasm3/wasm-coremark + url = https://github.com/wasm3/wasm-coremark.git diff --git a/crates/wasm-bench/.cargo/config.toml b/crates/wasm-bench/.cargo/config.toml new file mode 100644 index 00000000..d20babeb --- /dev/null +++ b/crates/wasm-bench/.cargo/config.toml @@ -0,0 +1,3 @@ +[target.thumbv7em-none-eabi] +runner = "probe-rs run --chip=nRF52840_xxAA" +rustflags = ["-Clink-arg=-Tlink.x"] diff --git a/crates/wasm-bench/Cargo.lock b/crates/wasm-bench/Cargo.lock new file mode 100644 index 00000000..a155217f --- /dev/null +++ b/crates/wasm-bench/Cargo.lock @@ -0,0 +1,1720 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi", +] + +[[package]] +name = "anyhow" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" + +[[package]] +name = "arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" + +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi", +] + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "az" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973" + +[[package]] +name = "bare-metal" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3" +dependencies = [ + "rustc_version", +] + +[[package]] +name = "bindgen" +version = "0.59.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bd2a9a458e8f4304c52c43ebb0cfbd520289f8379a52e329a38afda99bf8eb8" +dependencies = [ + "bitflags 1.3.2", + "cexpr", + "clang-sys", + "clap", + "env_logger", + "lazy_static", + "lazycell", + "log", + "peeking_take_while", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex 1.3.0", + "which", +] + +[[package]] +name = "bitfield" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + +[[package]] +name = "bytemuck" +version = "1.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e" + +[[package]] +name = "cast" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" + +[[package]] +name = "cc" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74b6a57f98764a267ff415d50a25e6e166f3831a5071af4995296ea97d210490" + +[[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 = "clang-sys" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[package]] +name = "clap" +version = "2.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +dependencies = [ + "ansi_term", + "atty", + "bitflags 1.3.2", + "strsim", + "textwrap", + "unicode-width", + "vec_map", +] + +[[package]] +name = "cobs" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" + +[[package]] +name = "cortex-m" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9" +dependencies = [ + "bare-metal", + "bitfield", + "critical-section", + "embedded-hal 0.2.7", + "volatile-register", +] + +[[package]] +name = "cortex-m-rt" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee84e813d593101b1723e13ec38b6ab6abbdbaaa4546553f5395ed274079ddb1" +dependencies = [ + "cortex-m-rt-macros", +] + +[[package]] +name = "cortex-m-rt-macros" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f6f3e36f203cfedbc78b357fb28730aa2c6dc1ab060ee5c2405e843988d3c7" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "cranelift-bforest" +version = "0.109.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b6b33d7e757a887989eb18b35712b2a67d96171ec3149d1bfb657b29b7b367c" +dependencies = [ + "cranelift-entity", +] + +[[package]] +name = "cranelift-codegen" +version = "0.109.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9acf15cb22be42d07c3b57d7856329cb228b7315d385346149df2566ad5e4aa" +dependencies = [ + "bumpalo", + "cranelift-bforest", + "cranelift-codegen-meta", + "cranelift-codegen-shared", + "cranelift-control", + "cranelift-entity", + "cranelift-isle", + "gimli", + "hashbrown 0.14.5", + "log", + "regalloc2", + "rustc-hash", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-codegen-meta" +version = "0.109.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e934d301392b73b3f8b0540391fb82465a0f179a3cee7c726482ac4727efcc97" +dependencies = [ + "cranelift-codegen-shared", +] + +[[package]] +name = "cranelift-codegen-shared" +version = "0.109.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb2a2566b3d54b854dfb288b3b187f6d3d17d6f762c92898207eba302931da" + +[[package]] +name = "cranelift-control" +version = "0.109.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0100f33b704cdacd01ad66ff41f8c5030d57cbff078e2a4e49ab1822591299fa" +dependencies = [ + "arbitrary", +] + +[[package]] +name = "cranelift-entity" +version = "0.109.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8cfdc315e5d18997093e040a8d234bea1ac1e118a716d3e30f40d449e78207b" +dependencies = [ + "serde", + "serde_derive", +] + +[[package]] +name = "cranelift-frontend" +version = "0.109.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f74b84f16af2e982b0c0c72233503d9d55cbfe3865dbe807ca28dc6642a28b5" +dependencies = [ + "cranelift-codegen", + "log", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-isle" +version = "0.109.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adf306d3dde705fb94bd48082f01d38c4ededc74293a4c007805f610bf08bc6e" + +[[package]] +name = "cranelift-native" +version = "0.109.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ea0ebdef7aff4a79bcbc8b6495f31315f16b3bf311152f472eaa8d679352581" +dependencies = [ + "cranelift-codegen", + "libc", + "target-lexicon", +] + +[[package]] +name = "cranelift-wasm" +version = "0.109.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d549108a1942065cdbac3bb96c2952afa0e1b9a3beff4b08c4308ac72257576d" +dependencies = [ + "cranelift-codegen", + "cranelift-entity", + "cranelift-frontend", + "itertools", + "log", + "smallvec", + "wasmparser", + "wasmtime-types", +] + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "critical-section" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "cty" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" + +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" + +[[package]] +name = "embedded-alloc" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddae17915accbac2cfbc64ea0ae6e3b330e6ea124ba108dada63646fd3c6f815" +dependencies = [ + "critical-section", + "linked_list_allocator", +] + +[[package]] +name = "embedded-dma" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "994f7e5b5cb23521c22304927195f236813053eb9c065dd2226a32ba64695446" +dependencies = [ + "stable_deref_trait", +] + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" + +[[package]] +name = "embedded-io" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" + +[[package]] +name = "embedded-storage" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21dea9854beb860f3062d10228ce9b976da520a73474aed3171ec276bc0c032" + +[[package]] +name = "env_logger" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + +[[package]] +name = "fixed" +version = "1.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fc715d38bea7b5bf487fcd79bcf8c209f0b58014f3018a7a19c2b855f472048" +dependencies = [ + "az", + "bytemuck", + "half", + "typenum", +] + +[[package]] +name = "gimli" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +dependencies = [ + "fallible-iterator", + "indexmap", + "stable_deref_trait", +] + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "half" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" +dependencies = [ + "cfg-if", + "crunchy", +] + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", + "serde", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + +[[package]] +name = "id-arena" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" + +[[package]] +name = "indexmap" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +dependencies = [ + "equivalent", + "hashbrown 0.14.5", + "serde", +] + +[[package]] +name = "indexmap-nostd" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" + +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + +[[package]] +name = "leb128" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" + +[[package]] +name = "libc" +version = "0.2.155" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" + +[[package]] +name = "libloading" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e310b3a6b5907f99202fcdb4960ff45b93735d7c7d96b760fcff8db2dc0e103d" +dependencies = [ + "cfg-if", + "windows-targets", +] + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "linked_list_allocator" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afa463f5405ee81cdb9cc2baf37e08ec7e4c8209442b5d72c04cfb2cd6e6286" + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "mach2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709" +dependencies = [ + "libc", +] + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "memfd" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" +dependencies = [ + "rustix", +] + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "multi-stash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "685a9ac4b61f4e728e1d2c6a7844609c16527aeb5e6c865915c08e619c16410f" + +[[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 = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "nrf-hal-common" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ea48ed7f0843fe6ec5aac0c42701e9194adfa1ee82ce6d028d64e5f68542be4" +dependencies = [ + "cast", + "cfg-if", + "cortex-m", + "embedded-dma", + "embedded-hal 0.2.7", + "embedded-storage", + "fixed", + "nb 1.1.0", + "nrf-usbd", + "nrf52840-pac", + "rand_core", + "void", +] + +[[package]] +name = "nrf-usbd" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66b2907c0b3ec4d264981c1fc5a2321d51c463d5a63d386e573f00e84d5495e6" +dependencies = [ + "cortex-m", + "critical-section", + "usb-device", + "vcell", +] + +[[package]] +name = "nrf52840-hal" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "709f85690f7f8d04612a18838785ee9176e1292ce3e53f0c68692b4cf5b4948e" +dependencies = [ + "embedded-hal 0.2.7", + "nrf-hal-common", + "nrf52840-pac", +] + +[[package]] +name = "nrf52840-pac" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30713f36f1be02e5bc9abefa30eae4a1f943d810f199d4923d3ad062d1be1b3d" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "vcell", +] + +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_enum" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "object" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "081b846d1d56ddfc18fdf1a922e4f6e07a11768ea1b92dec44e42b72712ccfce" +dependencies = [ + "crc32fast", + "hashbrown 0.14.5", + "indexmap", + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "panic-rtt-target" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608d1d809dd8960d5e8364981279c7ab280a13d98b99eae049885a7ab2b1cbfe" +dependencies = [ + "critical-section", + "rtt-target", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "peeking_take_while" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" + +[[package]] +name = "portable-atomic" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" +dependencies = [ + "critical-section", +] + +[[package]] +name = "postcard" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a55c51ee6c0db07e68448e336cf8ea4131a620edefebf9893e759b2d793420f8" +dependencies = [ + "cobs", + "embedded-io", + "serde", +] + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "psm" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" +dependencies = [ + "cc", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" + +[[package]] +name = "regalloc2" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad156d539c879b7a24a363a2016d77961786e71f48f2e2fc8302a92abd2429a6" +dependencies = [ + "hashbrown 0.13.2", + "log", + "rustc-hash", + "slice-group-by", + "smallvec", +] + +[[package]] +name = "regex" +version = "1.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" + +[[package]] +name = "riscv" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f5c1b8bf41ea746266cdee443d1d1e9125c86ce1447e1a2615abd34330d33a9" +dependencies = [ + "critical-section", + "embedded-hal 1.0.0", +] + +[[package]] +name = "riscv-rt" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0d35e32cf1383183e8885d8a9aa4402a087fd094dc34c2cb6df6687d0229dfe" +dependencies = [ + "riscv", + "riscv-rt-macros", +] + +[[package]] +name = "riscv-rt-macros" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d100d466dbb76681ef6a9386f3da9abc570d57394e86da0ba5af8c4408486d" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "rtt-target" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10b34c9e6832388e45f3c01f1bb60a016384a0a4ad80cdd7d34913bed25037f0" +dependencies = [ + "critical-section", + "ufmt-write", +] + +[[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.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver 0.9.0", +] + +[[package]] +name = "rustix" +version = "0.38.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +dependencies = [ + "bitflags 2.6.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + +[[package]] +name = "serde" +version = "1.0.204" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.204" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "serde_json" +version = "1.0.120" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "shlex" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "slice-group-by" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +dependencies = [ + "serde", +] + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + +[[package]] +name = "sptr" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b9b39299b249ad65f3b7e96443bad61c02ca5cd3589f46cb6d610a0fd6c0d6a" + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "string-interner" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c6a0d765f5807e98a091107bae0a56ea3799f66a5de47b2c84c94a39c09974e" +dependencies = [ + "cfg-if", + "hashbrown 0.14.5", +] + +[[package]] +name = "strsim" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" + +[[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.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "target-lexicon" +version = "0.12.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4873307b7c257eddcb50c9bedf158eb669578359fb28428bef438fec8e6ba7c2" + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "thiserror" +version = "1.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "ufmt-write" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e87a2ed6b42ec5e28cc3b94c09982969e9227600b2e3dcbc1db927a84c06bd69" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-width" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "usb-device" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f6cc3adc849b5292b4075fc0d5fdcf2f24866e88e336dd27a8943090a520508" + +[[package]] +name = "vcell" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" + +[[package]] +name = "vec_map" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" + +[[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 = "volatile-register" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de437e2a6208b014ab52972a27e59b33fa2920d3e00fe05026167a1c509d19cc" +dependencies = [ + "vcell", +] + +[[package]] +name = "wasefire-interpreter" +version = "0.3.0" +dependencies = [ + "libm", + "num_enum", + "paste", + "portable-atomic", +] + +[[package]] +name = "wasm-bench" +version = "0.1.0" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "embedded-alloc", + "nrf52840-hal", + "panic-rtt-target", + "portable-atomic", + "riscv", + "riscv-rt", + "rtt-target", + "wasefire-interpreter", + "wasm3", + "wasmi", + "wasmtime", +] + +[[package]] +name = "wasm-encoder" +version = "0.209.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4a05336882dae732ce6bd48b7e11fe597293cb72c13da4f35d7d5f8d53b2a7" +dependencies = [ + "leb128", +] + +[[package]] +name = "wasm3" +version = "0.5.0" +source = "git+https://github.com/wasm3/wasm3-rs.git#df74c2a17ed8831595de43db98c406da4633e32a" +dependencies = [ + "cty", + "wasm3-sys", +] + +[[package]] +name = "wasm3-sys" +version = "0.5.0" +source = "git+https://github.com/wasm3/wasm3-rs.git#df74c2a17ed8831595de43db98c406da4633e32a" +dependencies = [ + "bindgen", + "cc", + "cty", + "shlex 0.1.1", +] + +[[package]] +name = "wasmi" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dae81666d9dc76cb125fe16fa3e2f0fe08d15cd7b2ad9a5013cadf31826edee5" +dependencies = [ + "arrayvec", + "multi-stash", + "num-derive", + "num-traits", + "smallvec", + "spin", + "wasmi_collections", + "wasmi_core", + "wasmparser-nostd", +] + +[[package]] +name = "wasmi_collections" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b422568fe52d13bc889033799e548c43032ee71836c6e9bb7261c1fc039327b9" +dependencies = [ + "ahash", + "hashbrown 0.14.5", + "string-interner", +] + +[[package]] +name = "wasmi_core" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fa2efecce566705221bc05f518b124ceb7d94b78f4e9035cb0572d9f369982e" +dependencies = [ + "downcast-rs", + "libm", + "num-traits", + "paste", +] + +[[package]] +name = "wasmparser" +version = "0.209.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07035cc9a9b41e62d3bb3a3815a66ab87c993c06fe1cf6b2a3f2a18499d937db" +dependencies = [ + "ahash", + "bitflags 2.6.0", + "hashbrown 0.14.5", + "indexmap", + "semver 1.0.23", + "serde", +] + +[[package]] +name = "wasmparser-nostd" +version = "0.100.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5a015fe95f3504a94bb1462c717aae75253e39b9dd6c3fb1062c934535c64aa" +dependencies = [ + "indexmap-nostd", +] + +[[package]] +name = "wasmprinter" +version = "0.209.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ceca8ae6eaa8c7c87b33c25c53bdf299f8c2a764aee1179402ff7652ef3a6859" +dependencies = [ + "anyhow", + "wasmparser", +] + +[[package]] +name = "wasmtime" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "786d8b5e7a4d54917c5ebe555b9667337e5f93383f49bddaaeec2eba68093b45" +dependencies = [ + "anyhow", + "bumpalo", + "cc", + "cfg-if", + "hashbrown 0.14.5", + "indexmap", + "libc", + "libm", + "log", + "mach2", + "memfd", + "memoffset", + "object", + "once_cell", + "paste", + "postcard", + "psm", + "rustix", + "serde", + "serde_derive", + "smallvec", + "sptr", + "target-lexicon", + "wasmparser", + "wasmtime-asm-macros", + "wasmtime-component-macro", + "wasmtime-cranelift", + "wasmtime-environ", + "wasmtime-jit-icache-coherence", + "wasmtime-slab", + "wasmtime-versioned-export-macros", + "windows-sys", +] + +[[package]] +name = "wasmtime-asm-macros" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d697d99c341d4a9ffb72f3af7a02124d233eeb59aee010f36d88e97cca553d5e" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "wasmtime-component-macro" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b29b462b068e73b5b27fae092a27f47e5937cabf6b26be2779c978698a52feca" +dependencies = [ + "anyhow", + "proc-macro2", + "quote", + "syn 2.0.68", + "wasmtime-component-util", + "wasmtime-wit-bindgen", + "wit-parser", +] + +[[package]] +name = "wasmtime-component-util" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9d2912c53d9054984b380dfbd7579f9c3681b2a73b903a56bd71a1c4f175f1e" + +[[package]] +name = "wasmtime-cranelift" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3975deafea000457ba84355c7c0fce0372937204f77026510b7b454f28a3a65" +dependencies = [ + "anyhow", + "cfg-if", + "cranelift-codegen", + "cranelift-control", + "cranelift-entity", + "cranelift-frontend", + "cranelift-native", + "cranelift-wasm", + "gimli", + "log", + "object", + "target-lexicon", + "thiserror", + "wasmparser", + "wasmtime-environ", + "wasmtime-versioned-export-macros", +] + +[[package]] +name = "wasmtime-environ" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f444e900e848b884d8a8a2949b6f5b92af642a3e663ff8fbe78731143a55be61" +dependencies = [ + "anyhow", + "cranelift-entity", + "gimli", + "indexmap", + "log", + "object", + "postcard", + "serde", + "serde_derive", + "target-lexicon", + "wasm-encoder", + "wasmparser", + "wasmprinter", + "wasmtime-types", +] + +[[package]] +name = "wasmtime-jit-icache-coherence" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5afe2f0499542f9a4bcfa1b55bfdda803b6ade4e7c93c6b99e0f39dba44b0a91" +dependencies = [ + "anyhow", + "cfg-if", + "libc", + "windows-sys", +] + +[[package]] +name = "wasmtime-slab" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a7de1f2bec5bbb35d532e61c85c049dc84ae671df60492f90b954ecf21169e7" + +[[package]] +name = "wasmtime-types" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "412463e9000e14cf6856be48628d2213c20c153e29ffc22b036980c892ea6964" +dependencies = [ + "cranelift-entity", + "serde", + "serde_derive", + "smallvec", + "wasmparser", +] + +[[package]] +name = "wasmtime-versioned-export-macros" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de5a9bc4f44ceeb168e9e8e3be4e0b4beb9095b468479663a9e24c667e36826f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "wasmtime-wit-bindgen" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70dc077306b38288262e5ba01d4b21532a6987416cdc0aedf04bb06c22a68fdc" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "wit-parser", +] + +[[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.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +dependencies = [ + "windows-sys", +] + +[[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-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "wit-parser" +version = "0.209.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e79b9e3c0b6bb589dec46317e645851e0db2734c44e2be5e251b03ff4a51269" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver 1.0.23", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] diff --git a/crates/wasm-bench/Cargo.toml b/crates/wasm-bench/Cargo.toml new file mode 100644 index 00000000..ccc686fb --- /dev/null +++ b/crates/wasm-bench/Cargo.toml @@ -0,0 +1,64 @@ +[package] +name = "wasm-bench" +version = "0.1.0" +authors = ["Julien Cretin "] +license = "Apache-2.0" +publish = false +edition = "2021" + +[dependencies] +cortex-m = { version = "0.7.7", features = ["critical-section-single-core"], optional = true } +cortex-m-rt = { version = "0.7.3", optional = true } +embedded-alloc = { version = "0.5.1", optional = true } +nrf52840-hal = { version = "0.16.0", optional = true } +panic-rtt-target = { version = "0.1.3", optional = true } +riscv = { version = "0.11.0", features = ["critical-section-single-hart"], optional = true } +riscv-rt = { version = "0.12.1", optional = true } +rtt-target = { version = "0.5.0", optional = true } +wasefire-interpreter = { path = "../interpreter", features = ["float-types"], optional = true } +wasmi = { version = "0.34.0", default-features = false, optional = true } + +[dependencies.portable-atomic] +version = "1.6.0" +default-features = false +features = ["critical-section"] +optional = true + +[dependencies.wasm3] +git = "https://github.com/wasm3/wasm3-rs.git" +default-features = false +features = ["build-bindgen", "use-32bit-slots"] +optional = true + +[dependencies.wasmtime] +version = "22.0.0" +default-features = false +features = ["cranelift", "runtime"] +optional = true + +[features] +runtime-base = ["dep:wasefire-interpreter"] +runtime-wasm3 = ["dep:wasm3"] +runtime-wasmi = ["dep:wasmi"] +runtime-wasmtime = ["dep:wasmtime"] +target-linux = [] +target-nordic = [ + "dep:cortex-m", + "dep:cortex-m-rt", + "dep:embedded-alloc", + "dep:nrf52840-hal", + "dep:panic-rtt-target", + "dep:rtt-target", +] +target-riscv = ["dep:embedded-alloc", "dep:portable-atomic", "dep:riscv", "dep:riscv-rt"] + +[profile.release] +codegen-units = 1 +lto = true +panic = "abort" + +[lints] +clippy.unit-arg = "allow" +rust.unreachable-pub = "warn" +rust.unsafe-op-in-unsafe-fn = "warn" +rust.unused-crate-dependencies = "warn" diff --git a/crates/wasm-bench/build.rs b/crates/wasm-bench/build.rs new file mode 100644 index 00000000..b0a45b5a --- /dev/null +++ b/crates/wasm-bench/build.rs @@ -0,0 +1,32 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use std::fs::File; +use std::io::Write; +use std::path::PathBuf; + +fn main() { + let memory = if std::env::var_os("CARGO_FEATURE_TARGET_NORDIC").is_some() { + Some(include_bytes!("memory-nordic.x").as_slice()) + } else if std::env::var_os("CARGO_FEATURE_TARGET_RISCV").is_some() { + Some(include_bytes!("memory-riscv.x").as_slice()) + } else { + None + }; + if let Some(memory) = memory { + let out = PathBuf::from(std::env::var_os("OUT_DIR").unwrap()); + println!("cargo:rustc-link-search={}", out.display()); + File::create(out.join("memory.x")).unwrap().write_all(memory).unwrap(); + } +} diff --git a/crates/wasm-bench/memory-nordic.x b/crates/wasm-bench/memory-nordic.x new file mode 100644 index 00000000..0c3ac65f --- /dev/null +++ b/crates/wasm-bench/memory-nordic.x @@ -0,0 +1,6 @@ +MEMORY { + FLASH : ORIGIN = 0x00000000, LENGTH = 0x00100000 + RAM : ORIGIN = 0x20000000, LENGTH = 0x00040000 +} + +__eheap = 0x20030000; diff --git a/crates/wasm-bench/memory-riscv.x b/crates/wasm-bench/memory-riscv.x new file mode 100644 index 00000000..9ef32e21 --- /dev/null +++ b/crates/wasm-bench/memory-riscv.x @@ -0,0 +1,13 @@ +MEMORY { + FLASH (RX) : ORIGIN = 0x00000000, LENGTH = 0x00080000 + STACK (W) : ORIGIN = 0x20000000, LENGTH = 0x00004000 + RAM (W) : ORIGIN = 0x20004000, LENGTH = 0x0001c000 +} + +REGION_ALIAS("REGION_TEXT", FLASH); +REGION_ALIAS("REGION_RODATA", FLASH); +REGION_ALIAS("REGION_DATA", RAM); +REGION_ALIAS("REGION_BSS", RAM); +REGION_ALIAS("REGION_HEAP", RAM); +REGION_ALIAS("REGION_STACK", STACK); +_heap_size = 0x8000; diff --git a/crates/wasm-bench/run.sh b/crates/wasm-bench/run.sh new file mode 100755 index 00000000..2abbc001 --- /dev/null +++ b/crates/wasm-bench/run.sh @@ -0,0 +1,42 @@ +#!/bin/sh +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -e + +. "$(git rev-parse --show-toplevel)"/scripts/test-helper.sh + +ensure_submodule third_party/wasm3/wasm-coremark + +case "$1" in + linux) ;; + nordic) TARGET=--target=thumbv7em-none-eabi ;; + riscv) TARGET=--target=riscv32imc-unknown-none-elf ;; + *) e "Unsupported target: $1" ;; +esac + +case "$2" in + base|wasm3|wasmi|wasmtime) ;; + *) e "Unsupported runtime: $2" ;; +esac + +# See test.sh for supported (and tested) combinations. +case $1-$2 in + *-base|nordic-wasmi) ;; + *) e "Unsupported combination: $1 $2" ;; +esac + +FEATURES=--features=target-$1,runtime-$2 + +x cargo run --release $TARGET $FEATURES diff --git a/crates/wasm-bench/src/allocator.rs b/crates/wasm-bench/src/allocator.rs new file mode 100644 index 00000000..dcf66c6f --- /dev/null +++ b/crates/wasm-bench/src/allocator.rs @@ -0,0 +1,44 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use core::ptr::addr_of_mut; + +use embedded_alloc::Heap; + +#[global_allocator] +static ALLOCATOR: Heap = Heap::empty(); + +macro_rules! addr_of_sym { + ($sym:ident) => {{ + extern "C" { + static mut $sym: u32; + } + unsafe { addr_of_mut!($sym) as usize } + }}; +} + +pub(crate) fn init() { + #[cfg(feature = "target-nordic")] + let (sheap, eheap) = (addr_of_sym!(__sheap), addr_of_sym!(__eheap)); + #[cfg(feature = "target-riscv")] + let (sheap, eheap) = (addr_of_sym!(_sheap), addr_of_sym!(_eheap)); + assert!(sheap < eheap); + // SAFETY: Called only once before any allocation. + unsafe { ALLOCATOR.init(sheap, eheap - sheap) }; +} + +#[cfg(feature = "target-nordic")] +pub(crate) fn usage() -> usize { + ALLOCATOR.used() +} diff --git a/crates/wasm-bench/src/main.rs b/crates/wasm-bench/src/main.rs new file mode 100644 index 00000000..a6eadd37 --- /dev/null +++ b/crates/wasm-bench/src/main.rs @@ -0,0 +1,61 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#![no_std] +#![cfg_attr(any(feature = "target-nordic", feature = "target-riscv"), no_main)] + +extern crate alloc; +#[cfg(feature = "target-linux")] +extern crate std; + +#[cfg(any(feature = "target-nordic", feature = "target-riscv"))] +mod allocator; +#[cfg_attr(feature = "runtime-base", path = "runtime/base.rs")] +#[cfg_attr(feature = "runtime-wasm3", path = "runtime/wasm3.rs")] +#[cfg_attr(feature = "runtime-wasmi", path = "runtime/wasmi.rs")] +#[cfg_attr(feature = "runtime-wasmtime", path = "runtime/wasmtime.rs")] +mod runtime; +#[cfg_attr(feature = "target-linux", path = "target/linux.rs")] +#[cfg_attr(feature = "target-nordic", path = "target/nordic.rs")] +#[cfg_attr(feature = "target-riscv", path = "target/riscv.rs")] +mod target; + +const WASM: &[u8] = + include_bytes!("../../../third_party/wasm3/wasm-coremark/coremark-minimal.wasm"); + +fn main() { + println!("Running CoreMark measurement..."); + let start = target::clock_ms(); + let result = runtime::run(WASM); + let duration = target::clock_ms() - start; + println!("CoreMark result: {} (in {}s)", result, duration as f32 / 1000.); +} + +#[cfg(feature = "target-nordic")] +#[cortex_m_rt::entry] +fn entry() -> ! { + target::init(); + loop { + main(); + } +} + +#[cfg(feature = "target-riscv")] +#[riscv_rt::entry] +fn entry() -> ! { + target::init(); + loop { + main(); + } +} diff --git a/crates/wasm-bench/src/runtime/base.rs b/crates/wasm-bench/src/runtime/base.rs new file mode 100644 index 00000000..61087f27 --- /dev/null +++ b/crates/wasm-bench/src/runtime/base.rs @@ -0,0 +1,52 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use alloc::vec; + +use wasefire_interpreter::{FuncType, Module, RunResult, Store, Val, ValType}; + +pub(crate) fn run(wasm: &[u8]) -> f32 { + const MEMORY_SIZE: usize = 0x10000; + #[repr(align(16))] + struct Memory([u8; MEMORY_SIZE]); + static mut MEMORY: Memory = Memory([0; MEMORY_SIZE]); + + let mut store = Store::default(); + store + .link_func_custom( + "env", + "clock_ms", + FuncType { params: ().into(), results: ValType::I64.into() }, + ) + .unwrap(); + let module = Module::new(wasm).unwrap(); + let inst = store.instantiate(module, unsafe { &mut MEMORY.0 }).unwrap(); + let mut state = store.invoke(inst, "run", vec![]).unwrap(); + let results = loop { + let call = match state { + RunResult::Done(results) => break results, + RunResult::Host(call) => call, + }; + assert_eq!(call.inst(), inst); + assert_eq!(call.index(), 0); + assert_eq!(call.args().len(), 0); + let time = crate::target::clock_ms(); + state = call.resume(&[Val::I64(time)]).unwrap(); + }; + assert_eq!(results.len(), 1); + match results[0] { + Val::F32(x) => f32::from_bits(x), + _ => unreachable!(), + } +} diff --git a/crates/wasm-bench/src/runtime/wasm3.rs b/crates/wasm-bench/src/runtime/wasm3.rs new file mode 100644 index 00000000..0e6ddf56 --- /dev/null +++ b/crates/wasm-bench/src/runtime/wasm3.rs @@ -0,0 +1,25 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use wasm3::{Environment, Module}; + +pub(crate) fn run(wasm: &[u8]) -> f32 { + let env = Environment::new().unwrap(); + let rt = env.create_runtime(4096).unwrap(); + let module = Module::parse(&env, wasm).unwrap(); + let mut module = rt.load_module(module).unwrap(); + module.link_closure("env", "clock_ms", |_, ()| Ok(crate::target::clock_ms())).unwrap(); + let func = module.find_function::<(), f32>("run").unwrap(); + func.call().unwrap() +} diff --git a/crates/wasm-bench/src/runtime/wasmi.rs b/crates/wasm-bench/src/runtime/wasmi.rs new file mode 100644 index 00000000..2c054382 --- /dev/null +++ b/crates/wasm-bench/src/runtime/wasmi.rs @@ -0,0 +1,32 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use wasmi::*; + +pub(crate) fn run(wasm: &[u8]) -> f32 { + let engine = Engine::default(); + let module = Module::new(&engine, wasm).unwrap(); + + let mut store = Store::new(&engine, ()); + let mut linker = Linker::<()>::new(&engine); + + let clock_ms = + Func::wrap(&mut store, move |_: Caller<'_, ()>| -> u64 { crate::target::clock_ms() }); + linker.define("env", "clock_ms", clock_ms).unwrap(); + + let instance = linker.instantiate(&mut store, &module).unwrap().start(&mut store).unwrap(); + + let func = instance.get_typed_func::<(), f32>(&store, "run").unwrap(); + func.call(&mut store, ()).unwrap() +} diff --git a/crates/wasm-bench/src/runtime/wasmtime.rs b/crates/wasm-bench/src/runtime/wasmtime.rs new file mode 100644 index 00000000..ab0b1185 --- /dev/null +++ b/crates/wasm-bench/src/runtime/wasmtime.rs @@ -0,0 +1,32 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use wasmtime::*; + +pub(crate) fn run(wasm: &[u8]) -> f32 { + let engine = Engine::default(); + let module = Module::new(&engine, wasm).unwrap(); + + let mut store = Store::new(&engine, ()); + let mut linker = Linker::new(&engine); + + let clock_ms = + Func::wrap(&mut store, move |_: Caller<'_, ()>| -> u64 { crate::target::clock_ms() }); + linker.define(&mut store, "env", "clock_ms", clock_ms).unwrap(); + + let instance = linker.instantiate(&mut store, &module).unwrap(); + + let func = instance.get_typed_func::<(), f32>(&mut store, "run").unwrap(); + func.call(&mut store, ()).unwrap() +} diff --git a/crates/wasm-bench/src/target/linux.rs b/crates/wasm-bench/src/target/linux.rs new file mode 100644 index 00000000..3cc702a0 --- /dev/null +++ b/crates/wasm-bench/src/target/linux.rs @@ -0,0 +1,27 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use std::sync::OnceLock; +use std::time::Instant; + +pub(crate) fn clock_ms() -> u64 { + static START: OnceLock = OnceLock::new(); + let start = *START.get_or_init(Instant::now); + Instant::now().duration_since(start).as_millis() as u64 +} + +#[macro_export] +macro_rules! println { + ($($x:tt)*) => { std::println!($($x)*) }; +} diff --git a/crates/wasm-bench/src/target/nordic.rs b/crates/wasm-bench/src/target/nordic.rs new file mode 100644 index 00000000..caf7a57a --- /dev/null +++ b/crates/wasm-bench/src/target/nordic.rs @@ -0,0 +1,72 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use core::sync::atomic::{AtomicU32, Ordering}; + +use cortex_m::peripheral::SYST; +use cortex_m_rt::exception; +use panic_rtt_target as _; + +pub(crate) fn clock_ms() -> u64 { + // The frequency is 64MHz and we want milli-seconds. + (ticks() >> 6) / 1000 +} + +#[macro_export] +macro_rules! println { + ($($x:tt)*) => { rtt_target::rprintln!($($x)*) }; +} + +pub(crate) fn init() { + rtt_target::rtt_init_print!(); + crate::allocator::init(); + let c = nrf52840_hal::pac::CorePeripherals::take().unwrap(); + let mut syst = c.SYST; + syst.set_reload(0xffffff); + syst.clear_current(); + syst.enable_counter(); + syst.enable_interrupt(); +} + +static COUNT: AtomicU32 = AtomicU32::new(0); + +fn ticks() -> u64 { + let old_low = ticks_low(); + let mut high = ticks_high(); + let low = ticks_low(); + if low < old_low { + // Time wrapped between both low measures. + high = ticks_high(); + } + high | low +} + +fn ticks_high() -> u64 { + // The counter wraps every 2^24 ticks (262.144 milliseconds). + (COUNT.load(Ordering::Relaxed) as u64) << 24 +} + +fn ticks_low() -> u64 { + (0xffffff - SYST::get_current()) as u64 +} + +#[exception] +fn SysTick() { + static USAGE: AtomicU32 = AtomicU32::new(0); + COUNT.fetch_add(1, Ordering::Relaxed); + if COUNT.load(Ordering::Relaxed) & 0xf == 0 { + USAGE.fetch_max(crate::allocator::usage() as u32, Ordering::Relaxed); + println!("Peak RAM usage: {}", USAGE.load(Ordering::Relaxed)); + } +} diff --git a/crates/wasm-bench/src/target/riscv.rs b/crates/wasm-bench/src/target/riscv.rs new file mode 100644 index 00000000..2b10100f --- /dev/null +++ b/crates/wasm-bench/src/target/riscv.rs @@ -0,0 +1,41 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use portable_atomic::AtomicU32; + +pub(crate) fn clock_ms() -> u64 { + // TODO + 0 +} + +static _COUNT: AtomicU32 = AtomicU32::new(0); + +#[macro_export] +macro_rules! println { + ($($x:tt)*) => { + let _msg = alloc::format!($($x)*); + // TODO + }; +} + +pub(crate) fn init() { + crate::allocator::init(); +} + +#[panic_handler] +fn panic(_: &core::panic::PanicInfo) -> ! { + loop { + unsafe { riscv::asm::ebreak() }; + } +} diff --git a/crates/wasm-bench/test.sh b/crates/wasm-bench/test.sh new file mode 100755 index 00000000..a90853a8 --- /dev/null +++ b/crates/wasm-bench/test.sh @@ -0,0 +1,46 @@ +#!/bin/sh +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -e + +. "$(git rev-parse --show-toplevel)"/scripts/test-helper.sh + +ensure_submodule third_party/wasm3/wasm-coremark + +test_helper + +cargo test --bin=wasm-bench --features=target-linux,runtime-base +cargo test --bin=wasm-bench --features=target-linux,runtime-wasm3 +cargo test --bin=wasm-bench --features=target-linux,runtime-wasmi +cargo test --bin=wasm-bench --features=target-linux,runtime-wasmtime + +cargo check --bin=wasm-bench --target=thumbv7em-none-eabi --features=target-nordic,runtime-base +# wasm3/source/wasm3.h:16:10: fatal error: 'stdlib.h' file not found +# cargo check --bin=wasm-bench --target=thumbv7em-none-eabi --features=target-nordic,runtime-wasm3 +cargo check --bin=wasm-bench --target=thumbv7em-none-eabi --features=target-nordic,runtime-wasmi +# error in crate arbitrary: can't find crate for `std` +# cargo check --bin=wasm-bench --target=thumbv7em-none-eabi --features=target-nordic,runtime-wasmtime + +cargo check --bin=wasm-bench --target=riscv32imc-unknown-none-elf \ + --features=target-riscv,runtime-base +# error: unknown target triple 'riscv32imc-unknown-none-elf', please use -triple or -arch +# cargo check --bin=wasm-bench --target=riscv32imc-unknown-none-elf \ +# --features=target-riscv,runtime-wasm3 +# error: no method named `compare_exchange` found for struct `AtomicUsize` in the current scope +# cargo check --bin=wasm-bench --target=riscv32imc-unknown-none-elf \ +# --features=target-riscv,runtime-wasmi +# error in crate once_cell: can't find crate for `std` +# cargo check --bin=wasm-bench --target=riscv32imc-unknown-none-elf \ +# --features=target-riscv,runtime-wasmtime diff --git a/scripts/sync.sh b/scripts/sync.sh index a3433399..c0da221e 100755 --- a/scripts/sync.sh +++ b/scripts/sync.sh @@ -88,6 +88,7 @@ GIT_MODULES=' SchemaStore/schemastore WebAssembly/spec rust-lang/rustup +wasm3/wasm-coremark ' [ "$(echo "$GIT_MODULES" | sort | tail -n+2)" = "$(echo "$GIT_MODULES")" ] \ || e "GIT_MODULES is not sorted" diff --git a/third_party/wasm3/wasm-coremark b/third_party/wasm3/wasm-coremark new file mode 160000 index 00000000..5ee3ca1f --- /dev/null +++ b/third_party/wasm3/wasm-coremark @@ -0,0 +1 @@ +Subproject commit 5ee3ca1f10a7d25067b3bef6fae4df9fa8c3d512 From 5df9140c688899b6cdaf4e00f0e87e2e635ac2dd Mon Sep 17 00:00:00 2001 From: Julien Cretin Date: Wed, 31 Jul 2024 12:21:20 +0200 Subject: [PATCH 4/4] Disable vulnerabilities in wasm-bench (#553) --- crates/wasm-bench/osv-scanner.toml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 crates/wasm-bench/osv-scanner.toml diff --git a/crates/wasm-bench/osv-scanner.toml b/crates/wasm-bench/osv-scanner.toml new file mode 100644 index 00000000..5856a76e --- /dev/null +++ b/crates/wasm-bench/osv-scanner.toml @@ -0,0 +1,12 @@ +# TODO(https://github.com/google/osv-scanner/issues/1155): Simplify this file. + +# This crate (wasm-bench) is used for benchmarks only. Those alerts can't be fixed because one of +# the comparison point (wasm3) is dead. We can't remove it because it is the best benchmark +# reference so far. +IgnoredVulns = [ + { id = "GHSA-crf8-h2wq-2h9x" }, + { id = "GHSA-g98v-hv3f-hcfr" }, + { id = "GHSA-gq4p-4hxv-5rg9" }, + { id = "GHSA-r7qv-8r2h-pg27" }, + { id = "RUSTSEC-2021-0139" }, +]