From be4ccd9f2e666bf677508c99bba9a00ae4e5f88c Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Wed, 9 Aug 2023 13:50:58 -0700 Subject: [PATCH] chore: move to One Big Cargo Workspace (#219) This commit changes the Cargo workspace setup to put all crates in One Big Workspace, rather than having separate workspaces for some targets. We now use the `per-package-target` unstable cargo feature to build different crates for different targets. This means that `cargo` commands in the root workspace now work without requiring the user to `cd` into a particular directory to build a platform target --- for example, I can now run: ```shell # in the repo root directory $ cargo build -p mnemos-d1 --bin mq-pro ``` and build a MnemOS binary for the MQ Pro, without having to `cd` into the MQ Pro directory. This is also necessary in order to make the `x86_64` build process added in PR #216 work, since it relies on cargo artifact dependencies, which appear not to work across workspaces. One issue is that `cargo build --workspace` (and `check --workspace`, etc) still does not work correctly, due to some [weird][1] [issues][2] with feature unification which I don't entirely understand. However, as a workaround, I've changed the workspace Cargo.toml to add a [`default-members` field][3], so that running `cargo build` or `cargo check` _without_ `--workspace` will build the subset of crates in the `default-members` key. This way, `cargo {build, check, etc}` in the repo root will do something reasonable by default, and the actual platform targets can be built/checked with `cargo $WHATEVER --package $CRATE`. IMO, this is still substantially nicer than having a bunch of separate workspaces. [1]: https://github.com/ia0/data-encoding/issues/47 [2]: https://github.com/bincode-org/bincode/issues/556 [3]: https://doc.rust-lang.org/cargo/reference/workspaces.html#the-default-members-field --- .cargo/config.toml | 11 +- .github/workflows/ci.yml | 12 +- .vscode/settings.json | 20 + Cargo.lock | 909 ++++++++++++++++-- Cargo.toml | 90 +- default.nix | 1 + justfile | 97 +- platforms/allwinner-d1/README.md | 41 +- .../allwinner-d1/boards/.cargo/config.toml | 2 - platforms/allwinner-d1/boards/Cargo.lock | 1 - platforms/allwinner-d1/boards/Cargo.toml | 42 +- platforms/allwinner-d1/core/Cargo.toml | 2 + platforms/beepy/Cargo.toml | 2 + platforms/esp32c3-buddy/.cargo/config.toml | 21 - platforms/esp32c3-buddy/Cargo.toml | 48 +- platforms/esp32c3-buddy/README.md | 53 +- platforms/melpomene/Cargo.toml | 2 + platforms/pomelo/Cargo.toml | 14 +- platforms/pomelo/src/main.rs | 4 +- rust-toolchain.toml | 9 +- shell.nix | 10 - source/abi/Cargo.toml | 2 + source/alloc/Cargo.toml | 2 + source/config/Cargo.toml | 2 + source/forth3/Cargo.toml | 2 + source/forth3/src/lib.rs | 6 +- source/kernel/Cargo.toml | 2 + source/kernel/src/services/emb_display.rs | 2 +- source/mstd/Cargo.toml | 2 + source/sermux-proto/Cargo.toml | 2 + source/spitebuf/Cargo.toml | 2 + source/trace-proto/Cargo.toml | 2 + tools/crowtty/Cargo.toml | 4 +- tools/crowtty/src/trace.rs | 14 +- tools/dumbloader/Cargo.toml | 2 + tools/f3repl/Cargo.toml | 2 + 36 files changed, 1153 insertions(+), 286 deletions(-) create mode 100644 .vscode/settings.json delete mode 100644 platforms/allwinner-d1/boards/.cargo/config.toml delete mode 100644 platforms/esp32c3-buddy/.cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml index aa8a8d5c..b96f4c50 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,3 +1,12 @@ +[alias] +crowtty = "run --bin crowtty --release --" +melpomene = "run --bin melpomene --release --" +melpo = "melpomene" +forth3 = "run --bin f3repl --release --" + [build] # Currently needed for `tokio-console` support. -rustflags = ["--cfg", "tokio_unstable"] \ No newline at end of file +rustflags = ["--cfg", "tokio_unstable"] + +[target.riscv32imac-unknown-none-elf] +runner = "espflash flash --monitor" \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5e8bd155..663eb8ae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -136,14 +136,6 @@ jobs: run: rustup show - uses: actions/checkout@v2 - uses: olix0r/cargo-action-fmt@ee1ef42932e44794821dab57ef1bf7a73df8b21f + - uses: extractions/setup-just@v1 - name: run rustdoc - run: | - cargo doc \ - --message-format=json \ - --no-deps \ - --all-features \ - --workspace \ - --document-private-items | - cargo-action-fmt - env: - RUSTDOCFLAGS: "--cfg docsrs -Dwarnings" + run: just docs --message-format=json --document-private-items diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..720cbb24 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,20 @@ +{ + "rust-analyzer.check.invocationLocation": "workspace", + "rust-analyzer.cargo.buildScripts.invocationLocation": "workspace", + "rust-analyzer.cargo.buildScripts.overrideCommand": [ + "cargo", + "check", + "--quiet", + "--message-format=json", + "--all-targets" + ], + "rust-analyzer.check.overrideCommand": [ + "cargo", + "clippy", + "--quiet", + "--message-format=json", + "--all-targets" + ], + "rust-analyzer.workspace.symbol.search.scope": "workspace_and_dependencies", + "rust-analyzer.typing.continueCommentsOnNewline": false +} \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index c43df92d..58fd10bf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -123,6 +123,132 @@ version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" +[[package]] +name = "anymap2" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d301b3b94cb4b2f23d7917810addbbaff90738e0ca2be692bd027e70d7e0330c" + +[[package]] +name = "async-channel" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" +dependencies = [ + "concurrent-queue", + "event-listener", + "futures-core", +] + +[[package]] +name = "async-executor" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fa3dc5f2a8564f07759c008b9109dc0d39de92a88d5588b8a5036d286383afb" +dependencies = [ + "async-lock", + "async-task", + "concurrent-queue", + "fastrand", + "futures-lite", + "slab", +] + +[[package]] +name = "async-global-executor" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1b6f5d7df27bd294849f8eec66ecfc63d11814df7a4f5d74168a2394467b776" +dependencies = [ + "async-channel", + "async-executor", + "async-io", + "async-lock", + "blocking", + "futures-lite", + "once_cell", +] + +[[package]] +name = "async-io" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" +dependencies = [ + "async-lock", + "autocfg 1.1.0", + "cfg-if 1.0.0", + "concurrent-queue", + "futures-lite", + "log", + "parking", + "polling", + "rustix", + "slab", + "socket2", + "waker-fn", +] + +[[package]] +name = "async-lock" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa24f727524730b077666307f2734b4a1a1c57acb79193127dcc8914d5242dd7" +dependencies = [ + "event-listener", +] + +[[package]] +name = "async-process" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a9d28b1d97e08915212e2e45310d47854eafa69600756fc735fb788f75199c9" +dependencies = [ + "async-io", + "async-lock", + "autocfg 1.1.0", + "blocking", + "cfg-if 1.0.0", + "event-listener", + "futures-lite", + "rustix", + "signal-hook", + "windows-sys", +] + +[[package]] +name = "async-std" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" +dependencies = [ + "async-channel", + "async-global-executor", + "async-io", + "async-lock", + "async-process", + "crossbeam-utils", + "futures-channel", + "futures-core", + "futures-io", + "futures-lite", + "gloo-timers", + "kv-log-macro", + "log", + "memchr", + "once_cell", + "pin-project-lite", + "pin-utils", + "slab", + "wasm-bindgen-futures", +] + +[[package]] +name = "async-task" +version = "4.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc7ab41815b3c653ccd2978ec3255c81349336702dfdf62ee6f7069b12a3aae" + [[package]] name = "async-trait" version = "0.1.72" @@ -143,6 +269,12 @@ dependencies = [ "critical-section", ] +[[package]] +name = "atomic-waker" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1181e1e0d1fce796a03db1ae795d67167da795f9cf4a39c37589e85ef57f26d3" + [[package]] name = "atty" version = "0.2.14" @@ -177,7 +309,7 @@ checksum = "a6a1de45611fdb535bfde7b7de4fd54f4fd2b17b1737c0a59b69bf9b92074b8c" dependencies = [ "async-trait", "axum-core", - "bitflags", + "bitflags 1.3.2", "bytes", "futures-util", "http", @@ -262,6 +394,15 @@ version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" +[[package]] +name = "basic-toml" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7bfc506e7a2370ec239e1d072507b2a80c833083699d3c6fa176fbb4de8448c6" +dependencies = [ + "serde", +] + [[package]] name = "bbq10kbd" version = "0.1.0" @@ -271,6 +412,15 @@ dependencies = [ "embedded-hal-async", ] +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + [[package]] name = "bit-set" version = "0.5.3" @@ -298,6 +448,27 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" + +[[package]] +name = "blocking" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77231a1c8f801696fc0123ec6150ce92cffb8e164a02afb9c8ddee0e9b65ad65" +dependencies = [ + "async-channel", + "async-lock", + "async-task", + "atomic-waker", + "fastrand", + "futures-lite", + "log", +] + [[package]] name = "bumpalo" version = "3.13.0" @@ -362,7 +533,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" dependencies = [ "atty", - "bitflags", + "bitflags 1.3.2", "clap_derive 3.2.25", "clap_lex 0.2.4", "indexmap 1.9.3", @@ -391,7 +562,7 @@ checksum = "2e53afce1efce6ed1f633cf0e57612fe51db54a1ee4fd8f8503d078fe02d69ae" dependencies = [ "anstream", "anstyle", - "bitflags", + "bitflags 1.3.2", "clap_lex 0.5.0", "strsim", ] @@ -442,7 +613,7 @@ version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -463,6 +634,15 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +[[package]] +name = "concurrent-queue" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62ec6771ecfa0762d24683ee5a32ad78487a3d3afdc0fb8cae19d2c5deb50b7c" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "console-api" version = "0.5.0" @@ -631,6 +811,41 @@ dependencies = [ "vcell", ] +[[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", + "strsim", + "syn 2.0.27", +] + +[[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.27", +] + [[package]] name = "deflate" version = "0.8.6" @@ -647,7 +862,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8a2d011b2fee29fb7d659b83c43fce9a2cb4df453e16d441a51448e448f3f98" dependencies = [ - "bitflags", + "bitflags 1.3.2", "defmt-macros", ] @@ -707,6 +922,15 @@ version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +[[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-graphics" version = "0.7.1" @@ -794,6 +1018,110 @@ dependencies = [ "libc", ] +[[package]] +name = "esp-alloc" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83792eb7261a375bb838679fea2b45654b8f4a48da6bef10a96da5054aa81c7d" +dependencies = [ + "critical-section", + "linked_list_allocator", +] + +[[package]] +name = "esp-backtrace" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b151ef7db21143b1a3b7a378c16d97ae13d0a5e3cb9682ed1f11bba821cce42d" +dependencies = [ + "esp-println", +] + +[[package]] +name = "esp-hal-common" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05d4498ddbbbf9a21e64f9269d2b4dd4059c34863ff54c702fb99e435f967767" +dependencies = [ + "basic-toml", + "bitflags 2.3.3", + "cfg-if 1.0.0", + "critical-section", + "embedded-dma", + "embedded-hal 0.2.7", + "esp-hal-procmacros", + "esp-riscv-rt", + "esp32c3", + "fugit", + "log", + "nb 1.1.0", + "paste", + "riscv-atomic-emulation-trap", + "serde", + "strum", + "void", +] + +[[package]] +name = "esp-hal-procmacros" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "042d5a1ef0e01d6de045972779e4aced3a10e6170169a5cb2de7bef31802e28a" +dependencies = [ + "darling", + "proc-macro-crate", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.27", +] + +[[package]] +name = "esp-println" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af6a511d37dba5fb8f01bf5485bc619a1a1959e1aaf666a7597df8fe615a0816" +dependencies = [ + "critical-section", +] + +[[package]] +name = "esp-riscv-rt" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e523ed9a26c604d4469dff4777484b14f977e864ba041f634ade1d7f47ef4151" +dependencies = [ + "riscv", + "riscv-rt-macros", +] + +[[package]] +name = "esp32c3" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae547e9a4524b34c2b302fd71c304f8b221bcd4eed4ef17c8bf53408baacad5f" +dependencies = [ + "critical-section", + "vcell", +] + +[[package]] +name = "esp32c3-hal" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8efd438e920ef0b16be9a4792a430c3ddfa4e206011df4a6cb5f8e646b7f89d" +dependencies = [ + "cfg-if 1.0.0", + "embedded-hal 0.2.7", + "esp-hal-common", +] + +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + [[package]] name = "f3repl" version = "0.1.0" @@ -875,6 +1203,15 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" +[[package]] +name = "fugit" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17186ad64927d5ac8f02c1e77ccefa08ccd9eaa314d5a4772278aa204a22f7e7" +dependencies = [ + "gcd", +] + [[package]] name = "futures" version = "0.3.28" @@ -923,6 +1260,21 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +[[package]] +name = "futures-lite" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] + [[package]] name = "futures-macro" version = "0.3.28" @@ -947,62 +1299,237 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" [[package]] -name = "futures-util" -version = "0.3.28" +name = "futures-util" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "gcd" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" + +[[package]] +name = "generator" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3e123d9ae7c02966b4d892e550bdc32164f05853cd40ab570650ad600596a8a" +dependencies = [ + "cc", + "libc", + "log", + "rustversion", + "windows", +] + +[[package]] +name = "getrandom" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "gif" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3edd93c6756b4dfaf2709eafcc345ba2636565295c198a9cfbf75fa5e3e00b06" +dependencies = [ + "color_quant", + "weezl", +] + +[[package]] +name = "gimli" +version = "0.27.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" + +[[package]] +name = "gloo" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28999cda5ef6916ffd33fb4a7b87e1de633c47c0dc6d97905fee1cdaa142b94d" +dependencies = [ + "gloo-console", + "gloo-dialogs", + "gloo-events", + "gloo-file", + "gloo-history", + "gloo-net", + "gloo-render", + "gloo-storage", + "gloo-timers", + "gloo-utils", + "gloo-worker", +] + +[[package]] +name = "gloo-console" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82b7ce3c05debe147233596904981848862b068862e9ec3e34be446077190d3f" +dependencies = [ + "gloo-utils", + "js-sys", + "serde", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-dialogs" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67062364ac72d27f08445a46cab428188e2e224ec9e37efdba48ae8c289002e6" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-events" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68b107f8abed8105e4182de63845afcc7b69c098b7852a813ea7462a320992fc" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-file" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d5564e570a38b43d78bdc063374a0c3098c4f0d64005b12f9bbe87e869b6d7" +dependencies = [ + "futures-channel", + "gloo-events", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-history" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85725d90bf0ed47063b3930ef28e863658a7905989e9929a8708aab74a1d5e7f" +dependencies = [ + "gloo-events", + "gloo-utils", + "serde", + "serde-wasm-bindgen", + "serde_urlencoded", + "thiserror", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-net" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a66b4e3c7d9ed8d315fd6b97c8b1f74a7c6ecbbc2320e65ae7ed38b7068cc620" +dependencies = [ + "futures-channel", + "futures-core", + "futures-sink", + "gloo-utils", + "http", + "js-sys", + "pin-project", + "serde", + "serde_json", + "thiserror", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "gloo-render" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "2fd9306aef67cfd4449823aadcd14e3958e0800aa2183955a309112a84ec7764" dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", + "wasm-bindgen", + "web-sys", ] [[package]] -name = "generator" -version = "0.7.4" +name = "gloo-storage" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3e123d9ae7c02966b4d892e550bdc32164f05853cd40ab570650ad600596a8a" +checksum = "5d6ab60bf5dbfd6f0ed1f7843da31b41010515c745735c970e821945ca91e480" dependencies = [ - "cc", - "libc", - "log", - "rustversion", - "windows", + "gloo-utils", + "js-sys", + "serde", + "serde_json", + "thiserror", + "wasm-bindgen", + "web-sys", ] [[package]] -name = "getrandom" -version = "0.2.10" +name = "gloo-timers" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", ] [[package]] -name = "gif" -version = "0.11.4" +name = "gloo-utils" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3edd93c6756b4dfaf2709eafcc345ba2636565295c198a9cfbf75fa5e3e00b06" +checksum = "037fcb07216cb3a30f7292bd0176b050b7b9a052ba830ef7d5d65f6dc64ba58e" dependencies = [ - "color_quant", - "weezl", + "js-sys", + "serde", + "serde_json", + "wasm-bindgen", + "web-sys", ] [[package]] -name = "gimli" -version = "0.27.3" +name = "gloo-worker" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" +checksum = "13471584da78061a28306d1359dd0178d8d6fc1c7c80e5e35d27260346e0516a" +dependencies = [ + "anymap2", + "bincode", + "gloo-console", + "gloo-utils", + "js-sys", + "serde", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] [[package]] name = "h2" @@ -1207,6 +1734,12 @@ dependencies = [ "cc", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "0.4.0" @@ -1332,6 +1865,15 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "kv-log-macro" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" +dependencies = [ + "log", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -1404,9 +1946,12 @@ dependencies = [ [[package]] name = "log" -version = "0.4.19" +version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" +checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de" +dependencies = [ + "value-bag", +] [[package]] name = "loom" @@ -1719,6 +2264,21 @@ dependencies = [ "toml", ] +[[package]] +name = "mnemos-d1" +version = "0.1.0" +dependencies = [ + "d1-pac", + "embedded-hal 0.2.7", + "futures", + "mnemos", + "mnemos-beepy", + "mnemos-d1-core", + "riscv", + "riscv-rt", + "tracing 0.2.0", +] + [[package]] name = "mnemos-d1-core" version = "0.1.0" @@ -1732,6 +2292,22 @@ dependencies = [ "tracing 0.1.37", ] +[[package]] +name = "mnemos-esp32c3-buddy" +version = "0.1.0" +dependencies = [ + "critical-section", + "esp-alloc", + "esp-backtrace", + "esp-println", + "esp32c3-hal", + "futures", + "mnemos", + "portable-atomic", + "riscv", + "tracing 0.1.37", +] + [[package]] name = "mnemos-std" version = "0.1.0" @@ -1824,7 +2400,7 @@ version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f3790c00a0150112de0f4cd161e3d7fc4b2d8a5542ffc35f099a2562aecb35c" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cc", "cfg-if 1.0.0", "libc", @@ -1837,7 +2413,7 @@ version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if 1.0.0", "libc", "static_assertions", @@ -1947,7 +2523,7 @@ version = "0.10.55" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "345df152bc43501c5eb9e4654ff05f794effb78d4efe3d53abc158baddc0703d" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if 1.0.0", "foreign-types", "libc", @@ -2006,6 +2582,18 @@ dependencies = [ "supports-color 1.3.1", ] +[[package]] +name = "parking" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14f2252c834a40ed9bb5422029649578e63aa341ac401f74e719dd1afda8394e" + +[[package]] +name = "paste" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" + [[package]] name = "percent-encoding" version = "2.3.0" @@ -2056,17 +2644,62 @@ version = "0.16.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c3287920cb847dee3de33d301c463fba14dda99db24214ddf93f83d3021f4c6" dependencies = [ - "bitflags", + "bitflags 1.3.2", "crc32fast", "deflate", "miniz_oxide 0.3.7", ] +[[package]] +name = "polling" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" +dependencies = [ + "autocfg 1.1.0", + "bitflags 1.3.2", + "cfg-if 1.0.0", + "concurrent-queue", + "libc", + "log", + "pin-project-lite", + "windows-sys", +] + +[[package]] +name = "pomelo" +version = "0.1.0" +dependencies = [ + "async-std", + "chrono", + "forth3", + "futures", + "futures-util", + "gloo", + "gloo-utils", + "humantime", + "maitake", + "mnemos", + "mnemos-alloc", + "postcard 1.0.6", + "serde", + "sermux-proto", + "tracing 0.1.37", + "tracing-subscriber", + "tracing-wasm", + "uuid 1.3.4", + "wasm-bindgen", + "wasm-bindgen-futures", +] + [[package]] name = "portable-atomic" -version = "1.3.3" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "767eb9f07d4a5ebcb39bbf2d452058a93c011373abf6832e24194a1c3f004794" +checksum = "f32154ba0af3a075eefa1eda8bb414ee928f62303a54ea85b8d6638ff1a6ee9e" +dependencies = [ + "critical-section", +] [[package]] name = "postcard" @@ -2115,6 +2748,16 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit", +] + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -2164,7 +2807,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e35c06b98bf36aba164cc17cb25f7e232f5c4aeea73baa14b8a9f0d92dbfa65" dependencies = [ "bit-set", - "bitflags", + "bitflags 1.3.2", "byteorder", "lazy_static", "num-traits", @@ -2224,6 +2867,12 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "r0" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd7a31eed1591dcbc95d92ad7161908e72f4677f8fabf2a32ca49b4237cbf211" + [[package]] name = "rand" version = "0.6.5" @@ -2406,7 +3055,7 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -2415,7 +3064,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -2482,6 +3131,45 @@ dependencies = [ "embedded-hal 0.2.7", ] +[[package]] +name = "riscv-atomic-emulation-trap" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da39f4a5642a62e8e16bb438c37e6f90ea388ca0b7960fe875ea39887155d6ba" + +[[package]] +name = "riscv-rt" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "102c52c89defde24dedf9ac077cc69df77b85aa2400dd2d5aad6eea6a6a5c089" +dependencies = [ + "r0", + "riscv", + "riscv-rt-macros", + "riscv-target", +] + +[[package]] +name = "riscv-rt-macros" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38509d7b17c2f604ceab3e5ff8ac97bb8cd2f544688c512be75c715edaf4daf" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "riscv-target" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88aa938cda42a0cf62a20cfe8d139ff1af20c2e681212b5b34adb5a58333f222" +dependencies = [ + "lazy_static", + "regex", +] + [[package]] name = "rustc-demangle" version = "0.1.23" @@ -2503,7 +3191,7 @@ version = "0.37.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0" dependencies = [ - "bitflags", + "bitflags 1.3.2", "errno", "io-lifetimes", "libc", @@ -2568,7 +3256,7 @@ version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d051a07231e303f5f719da78cb6f7394f6d5b54f733aef5b0b447804a83edd7b" dependencies = [ - "bitflags", + "bitflags 1.3.2", "lazy_static", "libc", "num", @@ -2592,7 +3280,7 @@ version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "core-foundation-sys", "libc", @@ -2624,6 +3312,17 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-wasm-bindgen" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3b143e2833c57ab9ad3ea280d21fd34e285a42837aeb0ee301f4f41890fa00e" +dependencies = [ + "js-sys", + "serde", + "wasm-bindgen", +] + [[package]] name = "serde_derive" version = "1.0.178" @@ -2655,6 +3354,18 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + [[package]] name = "serialport" version = "4.0.1" @@ -2662,7 +3373,7 @@ source = "git+https://github.com/metta-systems/serialport-rs?rev=7fec572529ec35b dependencies = [ "CoreFoundation-sys", "IOKit-sys", - "bitflags", + "bitflags 1.3.2", "cfg-if 1.0.0", "libudev 0.2.0", "mach 0.2.3", @@ -2679,7 +3390,7 @@ checksum = "353dc2cbfc67c9a14a89a1292a9d8e819bd51066b083e08c1974ba08e3f48c62" dependencies = [ "CoreFoundation-sys", "IOKit-sys", - "bitflags", + "bitflags 1.3.2", "cfg-if 1.0.0", "libudev 0.3.0", "mach2", @@ -2706,6 +3417,25 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "signal-hook" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801" +dependencies = [ + "libc", + "signal-hook-registry", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +dependencies = [ + "libc", +] + [[package]] name = "slab" version = "0.4.8" @@ -2771,6 +3501,28 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[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 = "supports-color" version = "1.3.1" @@ -3267,6 +4019,17 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "tracing-wasm" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4575c663a174420fa2d78f4108ff68f65bf2fbb7dd89f33749b6e826b3626e07" +dependencies = [ + "tracing 0.1.37", + "tracing-subscriber", + "wasm-bindgen", +] + [[package]] name = "try-lock" version = "0.2.4" @@ -3360,6 +4123,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +[[package]] +name = "value-bag" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d92ccd67fb88503048c01b59152a04effd0782d035a83a6d256ce6085f08f4a3" + [[package]] name = "vcell" version = "0.1.3" @@ -3405,6 +4174,12 @@ dependencies = [ "libc", ] +[[package]] +name = "waker-fn" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" + [[package]] name = "want" version = "0.3.1" @@ -3451,6 +4226,18 @@ dependencies = [ "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +dependencies = [ + "cfg-if 1.0.0", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wasm-bindgen-macro" version = "0.2.87" @@ -3480,6 +4267,16 @@ version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +[[package]] +name = "web-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "weezl" version = "0.1.7" diff --git a/Cargo.toml b/Cargo.toml index bfbb5ff7..eba7c93f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,21 +1,50 @@ +cargo-features = [ + # Allows setting a different target triple on a per-crate level. This is + # required to include platform crates (which require specific target + # triples) in the main workspace. + # + # See: https://doc.rust-lang.org/cargo/reference/unstable.html#per-package-target + "per-package-target", + # Some platform implementations require specific RUSTFLAGS environment + # variables to configure the compiler's behavior, such as setting linker + # arguments. This unstable feature allows us to configure these RUSTFLAGS in + # the Cargo.toml on a per-crate basis, rather than requiring a separate + # `.cargo/config.toml` in each platform crate (and necessitating `cd`ing + # into those crates' directories in order to build the crate). + # + # See: https://doc.rust-lang.org/cargo/reference/unstable.html#profile-rustflags-option + "profile-rustflags", +] + [workspace] resolver = "2" members = [ # mnemOS source - "source/kernel", - "source/abi", - "source/mstd", - "source/spitebuf", - "source/alloc", - "source/forth3", - "source/sermux-proto", - "source/trace-proto", - "source/config", + "source/*", + + # tools + "tools/*", + + # platforms + "platforms/allwinner-d1/*", + "platforms/beepy", + "platforms/esp32c3-buddy", + "platforms/melpomene", + "platforms/melpomene/melpo-config", + "platforms/pomelo", +] +# By default, run cargo commands without a specific package against everything +# that can build cross-platform. This avoids incompatible feature unification +# while running `cargo check`/`cargo fmt`/etc for most workspace crates. +# +# Incompatible crates are checked/built/formatted/documented individually by the +# `just check`, `just clippy`, `just docs`, and `just fmt` Just recipes. +default-members = [ + # mnemOS source + "source/*", # tools - "tools/crowtty", - "tools/dumbloader", - "tools/f3repl", + "tools/*", # platforms "platforms/allwinner-d1/core", @@ -23,8 +52,43 @@ members = [ "platforms/melpomene", "platforms/melpomene/melpo-config", ] +# this isn't actually a crate +exclude = ["source/notes"] + +[workspace.package] +edition = "2021" +repository = "https://github.com/tosc-rs/mnemos" +homepage = "https://mnemos.dev" +license = "MIT OR Apache-2.0" + +[profile.release] +codegen-units = 1 # better optimizations +debug = 2 # symbols are nice and they don't increase the size on Flash +lto = true # better optimizations + +[profile.release.package.mnemos-esp32c3-buddy] +# opt-level='z' is broken on esp32c3. +# +# See: https://github.com/esp-rs/esp-hal/pull/198 +opt-level = "s" +rustflags = [ + "-C", "link-arg=-Tlinkall.x", + # Required to obtain backtraces (e.g. when using the "esp-backtrace" crate.) + # NOTE: May negatively impact performance of produced code + "-C", "force-frame-pointers", +] -exclude = ["platforms/pomelo", "platforms/esp32c3-buddy"] +[profile.dev.package.mnemos-esp32c3-buddy] +# opt-level='z' is broken on esp32c3. +# +# See: https://github.com/esp-rs/esp-hal/pull/198 +opt-level = "s" +rustflags = [ + "-C", "link-arg=-Tlinkall.x", + # Required to obtain backtraces (e.g. when using the "esp-backtrace" crate.) + # NOTE: May negatively impact performance of produced code + "-C", "force-frame-pointers", +] [patch.crates-io.maitake] git = "https://github.com/hawkw/mycelium.git" diff --git a/default.nix b/default.nix index aefe3b2a..9c3fe8bd 100644 --- a/default.nix +++ b/default.nix @@ -30,6 +30,7 @@ buildEnv { SDL2.dev # other stuff bash + zlib ]; passthru = with pkgs; { SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt"; diff --git a/justfile b/justfile index a5861292..708c282e 100644 --- a/justfile +++ b/justfile @@ -25,13 +25,9 @@ _fmt := if env_var_or_default("GITHUB_ACTIONS", "") != "true" { "" } else { _d1_start_addr := "0x40000000" _d1_bin_path := "target/riscv64imac-unknown-none-elf" -_d1_dir := "platforms/allwinner-d1/boards" +_d1_pkg := "mnemos-d1" -_pomelo_dir := "platforms/pomelo" - -_melpo_dir := "platforms/melpomene" - -_espbuddy_dir := "platforms/esp32c3-buddy" +_espbuddy_pkg := "mnemos-esp32c3-buddy" # arguments to pass to all RustDoc invocations _rustdoc := _cargo + " doc --no-deps --all-features" @@ -45,61 +41,74 @@ default: @echo "" @just --list -# check all packages, across workspaces -check: && (_check-dir _pomelo_dir ) (_check-dir _melpo_dir) (_check-dir _espbuddy_dir) +# check all crates, across workspaces +check: && (check-crate _d1_pkg) (check-crate _espbuddy_pkg) + {{ _cargo }} check \ + --lib --bins --examples --tests --benches \ + {{ _fmt }} + +# check a crate. +check-crate crate: {{ _cargo }} check \ - --workspace \ --lib --bins --examples --tests --benches --all-features \ + --package {{ crate }} \ {{ _fmt }} -# run Clippy checks for all packages, across workspaces. -clippy: && (_clippy-dir _pomelo_dir ) (_clippy-dir _melpo_dir) (_clippy-dir _espbuddy_dir) - {{ _cargo }} clippy --workspace \ +# run Clippy checks for all crates, across workspaces. +clippy: && (clippy-crate _d1_pkg) (clippy-crate _espbuddy_pkg) + {{ _cargo }} clippy \ --lib --bins --examples --tests --benches --all-features \ {{ _fmt }} +# run clippy checks for a crate. +clippy-crate crate: + {{ _cargo }} clippy \ + --lib --bins --examples --tests --benches \ + --package {{ crate }} \ + {{ _fmt }} + # test all packages, across workspaces test: (_get-cargo-command "nextest" "cargo-nextest" no-nextest) - {{ _cargo }} nextest run --workspace --all-features - # uncomment this if we actually add tests to the D1 platform - # (cd {{ _d1_dir }}; {{ _cargo }} nextest run --workspace) + {{ _cargo }} nextest run --all-features -# run rustfmt for all packages, across workspaces +# run rustfmt for all crates, across workspaces fmt: - {{ _cargo }} fmt --all - (cd {{ _d1_dir }}; {{ _cargo }} fmt --all) + {{ _cargo }} fmt + {{ _cargo }} fmt --package {{ _d1_pkg }} + {{ _cargo }} fmt --package {{ _espbuddy_pkg }} # build a Mnemos binary for the Allwinner D1 build-d1 board='mq-pro': (_get-cargo-command "objcopy" "cargo-binutils") - cd {{ _d1_dir}} && {{ _cargo }} build --bin {{ board }} --release - cd {{ _d1_dir}} && \ - {{ _cargo }} objcopy \ + {{ _cargo }} build \ + --package {{ _d1_pkg }} \ + --bin {{ board }} \ + --release + {{ _cargo }} objcopy \ + --package {{ _d1_pkg }} \ --bin {{ board }} \ --release \ -- \ - -O binary \ - ./{{ _d1_bin_path }}/mnemos-{{ board }}.bin + -O binary {{ _d1_bin_path }}/mnemos-{{ board }}.bin # flash an Allwinner D1 using xfel flash-d1 board='mq-pro': (build-d1 board) xfel ddr d1 - xfel write {{ _d1_start_addr }} {{ _d1_dir}}/{{ _d1_bin_path }}/mnemos-{{ board }}.bin + xfel write {{ _d1_start_addr }} {{ _d1_bin_path }}/mnemos-{{ board }}.bin xfel exec {{ _d1_start_addr }} # build a MnemOS binary for the ESP32-C3 build-c3 board: - cd {{ _espbuddy_dir }} && \ - {{ _cargo }} build \ - --release \ + {{ _cargo }} build --release \ + --package {{ _espbuddy_pkg }} \ --bin {{ board }} # flash an ESP32-C3 with the MnemOS WiFi Buddy firmware flash-c3 board *espflash-args: (_get-cargo-command "espflash" "cargo-espflash") (build-c3 board) - cd {{ _espbuddy_dir }} && \ - {{ _cargo }} espflash flash \ - --release \ - --bin {{ board }} \ - {{ espflash-args }} + {{ _cargo }} espflash flash \ + --release \ + --package {{ _espbuddy_pkg }} \ + --bin {{ board }} \ + {{ espflash-args }} # run crowtty (a host serial multiplexer, log viewer, and pseudo-keyboard) crowtty *FLAGS: @@ -107,8 +116,18 @@ crowtty *FLAGS: # run the Melpomene simulator melpomene *FLAGS: - @cd {{ _melpo_dir }}; \ - cargo run --release --bin melpomene -- {{ FLAGS }} + @{{ _cargo }} run --release --bin melpomene -- {{ FLAGS }} + +# build all RustDoc documentation +all-docs *FLAGS: (docs FLAGS) (docs "-p " + _d1_pkg + FLAGS) (docs "-p " + _d1_pkg + FLAGS) + +# run RustDoc +docs *FLAGS: + env RUSTDOCFLAGS="--cfg docsrs -Dwarnings" \ + {{ _cargo }} doc \ + --all-features \ + {{ FLAGS }} \ + {{ _fmt }} _get-cargo-command name pkg skip='': #!/usr/bin/env bash @@ -128,12 +147,4 @@ _get-cargo-command name pkg skip='': err "missing cargo-{{ name }} executable" if confirm " install it?"; then cargo install {{ pkg }} - fi - -# run clippy for a subdirectory -_clippy-dir dir: - cd {{ dir }}; {{ _cargo }} clippy --lib --bins {{ _fmt }} - -# run cargo check for a subdirectory -_check-dir dir: - cd {{ dir }}; {{ _cargo }} check --lib --bins {{ _fmt }} \ No newline at end of file + fi \ No newline at end of file diff --git a/platforms/allwinner-d1/README.md b/platforms/allwinner-d1/README.md index b64afc64..c2ecf17b 100644 --- a/platforms/allwinner-d1/README.md +++ b/platforms/allwinner-d1/README.md @@ -16,16 +16,6 @@ This directory contains MnemOS platform support for the Allwinner D1 RISC-V SoC. ### Building -> **Note** -> -> The `boards/` directory is its own Cargo workspace. This is in order to avoid -> blowing away artifacts for host tools cached in the main workspace when -> building the MnemOS binary for a target. - -To build for the Allwinner D1 platform, either build from within the -`allwinner-d1/boards/` directory, or use the [`just build-d1` Just -recipe][just]. - This crate contains a separate Cargo bin target for each supported D1 board. These bin targets depend on the [`mnemos-d1-core` crate] for the majority of the platform implementation, and configure the D1's I/O pins based on how those pins @@ -35,6 +25,14 @@ provided: * `mq-pro`: MnemOS for the [MangoPi MQ Pro] * `lichee-rv`: MnemOS for the [Sipeed Lichee RV] +The simplest way to build a MnemOS image for an Allwinner D1 board is to use the +[`just build-d1` Just recipe][just]. + +> [!IMPORTANT] +> +> Running Just recipes requires Just to be installed. See +> [https://just.systems](https://just.systems) for details on using Just. + The `just build-d1` recipe takes an optional argument to select which bin target is built; by default, the `mq-pro` bin target is selected. For example: @@ -44,6 +42,25 @@ $ just build-d1 mq-pro # also builds MnemOS for the MQ Pro $ just build-d1 lichee-rv # builds MnemOS for the Lichee RV ``` +Alternatively, Allwinner D1 images can be built manually using Cargo. To build +using Cargo, run the following commands: + +```console +# set which board binary to build +$ export BOARD="mq-pro" # or "lichee-rv" + +# build the MnemOS binary for that board +$ cargo build -p mnemos-d1 --board $BOARD --release + +# produce a binary that can be flashed to the board +$ cargo objcopy -p mnemos-d1 --bin $BOARD -- release \ + -O binary target/riscv64imac-unknown-none-elf/mnemos-$BOARD.bin +``` + +> [!IMPORTANT] +> +> Note that `cargo-binutils` must be installed in order to use `cargo objcopy`. +> The `just build-d1` recipe will prompt to install it automatically. ### Running The quickest way to get MnemOS running on a D1 SBC is using [`xfel`]. @@ -69,7 +86,7 @@ xfel write 0x40000000 platforms/allwinner-d1/boards/target/riscv64imac-unknown-n xfel exec 0x40000000 ``` -> **Note** +> [!NOTE] > > When flashing the MangoPi MQ Pro using `just flash-d1`, ensure that the USB > cable is plugged in to the USB-C port on the board labeled as "OTG" on the @@ -95,7 +112,7 @@ building `xfel` from source for Linux, MacOS, and Windows can be found [here][xfel-build]. Pre-built `xfel` binaries for Windows are available [here][xfel-win]. -> **Note** +> [!NOTE] > > In addition to the official distribution channels, I (Eliza) have written [a > Nix derivation for `xfel`][xfel-nix]. Eventually, I'd like to upstream this to diff --git a/platforms/allwinner-d1/boards/.cargo/config.toml b/platforms/allwinner-d1/boards/.cargo/config.toml deleted file mode 100644 index 86e09f16..00000000 --- a/platforms/allwinner-d1/boards/.cargo/config.toml +++ /dev/null @@ -1,2 +0,0 @@ -[build] -target = "riscv64imac-unknown-none-elf" diff --git a/platforms/allwinner-d1/boards/Cargo.lock b/platforms/allwinner-d1/boards/Cargo.lock index c4804484..33b8fbd0 100644 --- a/platforms/allwinner-d1/boards/Cargo.lock +++ b/platforms/allwinner-d1/boards/Cargo.lock @@ -478,7 +478,6 @@ dependencies = [ name = "mnemos-abi" version = "0.1.0" dependencies = [ - "defmt", "postcard", "serde", ] diff --git a/platforms/allwinner-d1/boards/Cargo.toml b/platforms/allwinner-d1/boards/Cargo.toml index 879d562c..164f0bfc 100644 --- a/platforms/allwinner-d1/boards/Cargo.toml +++ b/platforms/allwinner-d1/boards/Cargo.toml @@ -1,8 +1,4 @@ -[workspace] -resolver = "2" -members = [ - "." -] +cargo-features = ["per-package-target"] [package] name = "mnemos-d1" @@ -12,6 +8,7 @@ repository = "https://github.com/tosc-rs/mnemos" homepage = "https://mnemos.dev" readme = "./README.md" license = "MIT OR Apache-2.0" +forced-target = "riscv64imac-unknown-none-elf" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -60,37 +57,4 @@ features = ["attributes"] default-features = false [dependencies.mnemos-beepy] -path = "../../beepy" - -### patches ### - -[patch.crates-io.maitake] -git = "https://github.com/hawkw/mycelium.git" -rev = "101a4abaa19afdd131b334a16d92c9fb4909c064" - -[patch.crates-io.mycelium-util] -git = "https://github.com/hawkw/mycelium.git" -rev = "101a4abaa19afdd131b334a16d92c9fb4909c064" - -# Use the `mycelium-bitfield` crate from the Mycelium monorepo rather than -# crates.io. -# NOTE: this patch, unlike the patches for `maitake` and `mycelium-util`, (which -# are unpublished), is not *strictly* necessary, as `mycelium-bitfield` *is* -# published to crates.io. However, we may as well depend on the git version, -# since it's already in our dependency tree as a transitive dep of `maitake` --- -# having both a Git dep and a crates.io dep seems unfortunate. -[patch.crates-io.mycelium-bitfield] -git = "https://github.com/hawkw/mycelium.git" -rev = "101a4abaa19afdd131b334a16d92c9fb4909c064" - -[patch.crates-io.cordyceps] -git = "https://github.com/hawkw/mycelium.git" -rev = "101a4abaa19afdd131b334a16d92c9fb4909c064" - -[patch.crates-io.mnemos-alloc] -path = "../../../source/alloc" - -# NOTE: keep this patch in sync with the one in the main kernel workspace! -[patch.crates-io.bbq10kbd] -git = "https://github.com/hawkw/bbq10kbd" -branch = "eliza/async" +path = "../../beepy" \ No newline at end of file diff --git a/platforms/allwinner-d1/core/Cargo.toml b/platforms/allwinner-d1/core/Cargo.toml index 37b0c313..5800709b 100644 --- a/platforms/allwinner-d1/core/Cargo.toml +++ b/platforms/allwinner-d1/core/Cargo.toml @@ -1,3 +1,5 @@ +cargo-features = ["per-package-target", "profile-rustflags"] + [package] name = "mnemos-d1-core" version = "0.1.0" diff --git a/platforms/beepy/Cargo.toml b/platforms/beepy/Cargo.toml index a694ccfd..4d93cfab 100644 --- a/platforms/beepy/Cargo.toml +++ b/platforms/beepy/Cargo.toml @@ -1,3 +1,5 @@ +cargo-features = ["per-package-target", "profile-rustflags"] + [package] name = "mnemos-beepy" version = "0.1.0" diff --git a/platforms/esp32c3-buddy/.cargo/config.toml b/platforms/esp32c3-buddy/.cargo/config.toml deleted file mode 100644 index 9842a7dc..00000000 --- a/platforms/esp32c3-buddy/.cargo/config.toml +++ /dev/null @@ -1,21 +0,0 @@ -[target.riscv32imac-unknown-none-elf] -runner = "espflash flash --monitor" - -[build] -rustflags = [ - "-C", "link-arg=-Tlinkall.x", - # Required to obtain backtraces (e.g. when using the "esp-backtrace" crate.) - # NOTE: May negatively impact performance of produced code - "-C", "force-frame-pointers", -] - -# this isn't technically the correct target --- it *should* be -# `riscv32-imc-unknown-none-elf`. but, because we're using the -# `riscv-atomic-emulation-trap` crate, we want to emit these instructions, and -# just setting `target_has_atomic` in `rustflags` makes `portable-atomic` not -# compile, since it does feature detection based on both `cfg_target_has_atomic` -# *and* the target triple. oh well. -target = "riscv32imac-unknown-none-elf" - -[unstable] -build-std = ["core", "alloc"] \ No newline at end of file diff --git a/platforms/esp32c3-buddy/Cargo.toml b/platforms/esp32c3-buddy/Cargo.toml index 986d62fb..53046569 100644 --- a/platforms/esp32c3-buddy/Cargo.toml +++ b/platforms/esp32c3-buddy/Cargo.toml @@ -1,8 +1,4 @@ -[workspace] -resolver = "2" -members = [ - "." -] +cargo-features = ["per-package-target", "profile-rustflags"] [package] name = "mnemos-esp32c3-buddy" @@ -17,11 +13,13 @@ homepage = "https://mnemos.dev" readme = "./README.md" license = "MIT OR Apache-2.0" -[profile.release] -# it turns out that we basically just "can't" build in debug mode (or our code -# will fault), so just build in release mode all the time but keep debug -# symbols. -debug = true +# this isn't technically the correct target --- it *should* be +# `riscv32-imc-unknown-none-elf`. but, because we're using the +# `riscv-atomic-emulation-trap` crate, we want to emit these instructions, and +# just setting `target_has_atomic` in `rustflags` makes `portable-atomic` not +# compile, since it does feature detection based on both `cfg_target_has_atomic` +# *and* the target triple. oh well. +forced-target = "riscv32imac-unknown-none-elf" [lib] test = false @@ -70,32 +68,4 @@ default-features = false [dependencies.futures] version = "0.3.21" default-features = false -features = ["async-await"] - -### patches ### - -[patch.crates-io.maitake] -git = "https://github.com/hawkw/mycelium.git" -rev = "101a4abaa19afdd131b334a16d92c9fb4909c064" - -[patch.crates-io.mycelium-util] -git = "https://github.com/hawkw/mycelium.git" -rev = "101a4abaa19afdd131b334a16d92c9fb4909c064" - -# Use the `mycelium-bitfield` crate from the Mycelium monorepo rather than -# crates.io. -# NOTE: this patch, unlike the patches for `maitake` and `mycelium-util`, (which -# are unpublished), is not *strictly* necessary, as `mycelium-bitfield` *is* -# published to crates.io. However, we may as well depend on the git version, -# since it's already in our dependency tree as a transitive dep of `maitake` --- -# having both a Git dep and a crates.io dep seems unfortunate. -[patch.crates-io.mycelium-bitfield] -git = "https://github.com/hawkw/mycelium.git" -rev = "101a4abaa19afdd131b334a16d92c9fb4909c064" - -[patch.crates-io.cordyceps] -git = "https://github.com/hawkw/mycelium.git" -rev = "101a4abaa19afdd131b334a16d92c9fb4909c064" - -[patch.crates-io.mnemos-alloc] -path = "../../source/alloc" \ No newline at end of file +features = ["async-await"] \ No newline at end of file diff --git a/platforms/esp32c3-buddy/README.md b/platforms/esp32c3-buddy/README.md index 7d190b08..7e475981 100644 --- a/platforms/esp32c3-buddy/README.md +++ b/platforms/esp32c3-buddy/README.md @@ -18,15 +18,13 @@ either board can be used interchangeably. ### Building -> **Note** -> -> This crate is its own Cargo workspace. This is in order to avoid -> blowing away artifacts for host tools cached in the main workspace when -> building the MnemOS binary for a target. +The simplest way to build a MnemOS image for the [ESP32-C3] platform to use the +[`just build-c3` Just recipe][just]. -To build for the [ESP32-C3] platform, either build from within the -`platforms/esp32c3-buddy` directory, or use the [`just build-c3` Just -recipe][just]. +> [!IMPORTANT] +> +> Running Just recipes requires Just to be installed. See +> [https://just.systems](https://just.systems) for details on using Just. The two supported ESP32-C3 dev boards are pinout-compatible, but route different pins on the ESP32 to the pins on the dev board. Therefore, this crate contains @@ -44,6 +42,16 @@ $ just build-c3 qtpy # builds MnemOS for the Adafruit QT Py ESP32-C3 $ just build-c3 xiao # builds MnemOS for the Seeedstudio XIAO ESP32-C3 ``` +Alternatively, Allwinner D1 images can be built manually using Cargo. To build +using Cargo, run: + +```console +# builds MnemOS for the Adafruit QT Py ESP32-C3 +$ cargo build -p mnemos-esp32c3-buddy --bin qtpy --release +# builds MnemOS for the Seeedstudio XIAO ESP32-C3 +$ cargo build -p mnemos-esp32c3-buddy --bin xiao --release +``` + ### Flashing & Running ESP32-C3 dev boards can be flashed over USB using [`cargo-espflash`]. To flash @@ -58,7 +66,7 @@ $ just flash-c3 qtpy # build and flash the Adafruit QT Py ESP32-C3 $ just flash-c3 xiao # build and flash the Seeedstudio XIAO ESP32-C3 ``` -> **Note** +> [!IMPORTANT] > > In order to flash an ESP32-C3 board, the [`cargo-espflash`] executable > must be installed. The `just flash-c3` Just recipe will check if @@ -69,9 +77,32 @@ If everything worked successfully, you should see output similar to this: ```console $ just flash-c3 qtpy Found cargo-espflash -cd platforms/esp32c3-buddy && cargo build --release +cargo build --package mnemos-esp32c3-buddy --bin qtpy --release Finished release [optimized] target(s) in 0.04s -cd platforms/esp32c3-buddy && cargo espflash flash --monitor +cargo espflash --package mnemos-esp32c3-buddy --bin qtpy flash --monitor +[2023-07-28T16:40:37Z INFO ] Serial port: '/dev/ttyACM0' +[2023-07-28T16:40:37Z INFO ] Connecting... +[2023-07-28T16:40:38Z INFO ] Using flash stub + Finished dev [unoptimized + debuginfo] target(s) in 0.04s +Chip type: esp32c3 (revision v0.3) +Crystal frequency: 40MHz +Flash size: 4MB +Features: WiFi, BLE +MAC address: 34:b4:72:ea:44:18 +App/part. size: 209,760/4,128,768 bytes, 5.08% +[00:00:00] [========================================] 13/13 0x0 +[00:00:00] [========================================] 1/1 0x8000 +[00:00:01] [========================================] 67/67 0x10000 +[2023-07-28T16:40:41Z INFO ] Flashing has completed! +``` + +Alternatively, the board can be flashed manually using [`cargo-espflash`]. For +example: +```console +$ cargo espflash flash \ + --package mnemos-esp32c3-buddy \ + --bin qtpy \ # or 'xiao' + --monitor [2023-07-28T16:40:37Z INFO ] Serial port: '/dev/ttyACM0' [2023-07-28T16:40:37Z INFO ] Connecting... [2023-07-28T16:40:38Z INFO ] Using flash stub diff --git a/platforms/melpomene/Cargo.toml b/platforms/melpomene/Cargo.toml index 29d1197f..d8edffb2 100644 --- a/platforms/melpomene/Cargo.toml +++ b/platforms/melpomene/Cargo.toml @@ -1,3 +1,5 @@ +cargo-features = ["per-package-target", "profile-rustflags"] + [package] name = "melpomene" version = "0.1.0" diff --git a/platforms/pomelo/Cargo.toml b/platforms/pomelo/Cargo.toml index fbfe5b3d..f5d47529 100644 --- a/platforms/pomelo/Cargo.toml +++ b/platforms/pomelo/Cargo.toml @@ -76,16 +76,4 @@ version = "0.4.37" [dependencies.async-std] version = "1.12.0" -features = ["unstable"] - -[patch.crates-io.maitake] -git = "https://github.com/hawkw/mycelium.git" -rev = "101a4abaa19afdd131b334a16d92c9fb4909c064" - -[patch.crates-io.mycelium-util] -git = "https://github.com/hawkw/mycelium.git" -rev = "101a4abaa19afdd131b334a16d92c9fb4909c064" - -[patch.crates-io.cordyceps] -git = "https://github.com/hawkw/mycelium.git" -rev = "101a4abaa19afdd131b334a16d92c9fb4909c064" +features = ["unstable"] \ No newline at end of file diff --git a/platforms/pomelo/src/main.rs b/platforms/pomelo/src/main.rs index 21c1d906..c72065f9 100644 --- a/platforms/pomelo/src/main.rs +++ b/platforms/pomelo/src/main.rs @@ -11,9 +11,7 @@ use gloo_utils::format::JsValueSerdeExt; use mnemos_alloc::heap::MnemosAlloc; use mnemos_kernel::{ forth::{self, Forth}, - services::{ - serial_mux::{PortHandle,WellKnown}, - }, + services::serial_mux::{PortHandle, WellKnown}, Kernel, KernelSettings, }; use pomelo::{ diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 08ea03e9..b69c3ca8 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,7 +1,12 @@ [toolchain] -channel = "nightly-2023-05-29" +channel = "nightly-2023-08-08" profile = "minimal" -components = ["rustfmt", "llvm-tools-preview", "rust-src"] +components = [ + "clippy", + "rustfmt", + "rust-src", + "llvm-tools-preview", +] targets = [ # Allwinner D1 "riscv64imac-unknown-none-elf", diff --git a/shell.nix b/shell.nix index 9b243261..1b4c2c21 100644 --- a/shell.nix +++ b/shell.nix @@ -9,16 +9,6 @@ let ++ mnemos.nativeBuildInputs; }; in mkShell { - nativeBuildInputs = [ pkg-config ]; - buildInputs = [ - clang - libclang - systemd - udev - # for melpomene - SDL2 - SDL2.dev - ]; packages = [ # devtools just diff --git a/source/abi/Cargo.toml b/source/abi/Cargo.toml index 17f62708..506342ab 100644 --- a/source/abi/Cargo.toml +++ b/source/abi/Cargo.toml @@ -1,3 +1,5 @@ +cargo-features = ["per-package-target", "profile-rustflags"] + [package] name = "mnemos-abi" version = "0.1.0" diff --git a/source/alloc/Cargo.toml b/source/alloc/Cargo.toml index e4db8409..f5b5e7a1 100644 --- a/source/alloc/Cargo.toml +++ b/source/alloc/Cargo.toml @@ -1,3 +1,5 @@ +cargo-features = ["per-package-target", "profile-rustflags"] + [package] name = "mnemos-alloc" description = """ diff --git a/source/config/Cargo.toml b/source/config/Cargo.toml index 44f16657..0d4ac900 100644 --- a/source/config/Cargo.toml +++ b/source/config/Cargo.toml @@ -1,3 +1,5 @@ +cargo-features = ["per-package-target", "profile-rustflags"] + [package] name = "mnemos-config" version = "0.1.0" diff --git a/source/forth3/Cargo.toml b/source/forth3/Cargo.toml index c150f537..296b0dbf 100644 --- a/source/forth3/Cargo.toml +++ b/source/forth3/Cargo.toml @@ -1,3 +1,5 @@ +cargo-features = ["per-package-target", "profile-rustflags"] + [package] name = "forth3" version = "0.1.0" diff --git a/source/forth3/src/lib.rs b/source/forth3/src/lib.rs index 15439920..ab86000d 100644 --- a/source/forth3/src/lib.rs +++ b/source/forth3/src/lib.rs @@ -118,11 +118,7 @@ pub struct CallContext { impl Clone for CallContext { fn clone(&self) -> Self { - Self { - eh: self.eh, - idx: self.idx, - len: self.len, - } + *self } } diff --git a/source/kernel/Cargo.toml b/source/kernel/Cargo.toml index ee30f519..8536b323 100644 --- a/source/kernel/Cargo.toml +++ b/source/kernel/Cargo.toml @@ -1,3 +1,5 @@ +cargo-features = ["per-package-target", "profile-rustflags"] + [package] name = "mnemos" version = "0.1.0" diff --git a/source/kernel/src/services/emb_display.rs b/source/kernel/src/services/emb_display.rs index 66503b59..d3a73280 100644 --- a/source/kernel/src/services/emb_display.rs +++ b/source/kernel/src/services/emb_display.rs @@ -354,7 +354,7 @@ impl DrawTarget for MonoChunk { I: IntoIterator>, { for Pixel(coord, color) in pixels.into_iter() { - let Ok((x, y)): Result<(u32, u32) , _> = coord.try_into() else { + let Ok((x, y)): Result<(u32, u32), _> = coord.try_into() else { continue; }; self.draw_pixel(x, y, color.is_on()); diff --git a/source/mstd/Cargo.toml b/source/mstd/Cargo.toml index fe5fb23f..2151a709 100644 --- a/source/mstd/Cargo.toml +++ b/source/mstd/Cargo.toml @@ -1,3 +1,5 @@ +cargo-features = ["per-package-target", "profile-rustflags"] + [package] name = "mnemos-std" version = "0.1.0" diff --git a/source/sermux-proto/Cargo.toml b/source/sermux-proto/Cargo.toml index 7e93dfbf..f41f6a40 100644 --- a/source/sermux-proto/Cargo.toml +++ b/source/sermux-proto/Cargo.toml @@ -1,3 +1,5 @@ +cargo-features = ["per-package-target", "profile-rustflags"] + [package] name = "sermux-proto" version = "0.1.0" diff --git a/source/spitebuf/Cargo.toml b/source/spitebuf/Cargo.toml index bc93958c..b748c6ca 100644 --- a/source/spitebuf/Cargo.toml +++ b/source/spitebuf/Cargo.toml @@ -1,3 +1,5 @@ +cargo-features = ["per-package-target", "profile-rustflags"] + [package] name = "spitebuf" version = "0.1.0" diff --git a/source/trace-proto/Cargo.toml b/source/trace-proto/Cargo.toml index 50657927..2efe3899 100644 --- a/source/trace-proto/Cargo.toml +++ b/source/trace-proto/Cargo.toml @@ -1,3 +1,5 @@ +cargo-features = ["per-package-target", "profile-rustflags"] + [package] name = "mnemos-trace-proto" version = "0.1.0" diff --git a/tools/crowtty/Cargo.toml b/tools/crowtty/Cargo.toml index 778a7d17..993c3cb8 100644 --- a/tools/crowtty/Cargo.toml +++ b/tools/crowtty/Cargo.toml @@ -1,7 +1,8 @@ +cargo-features = ["per-package-target", "profile-rustflags"] + [package] name = "crowtty" version = "0.1.0" -edition = "2021" description = """ crowtty is a host tool, aimed at speaking the sermux protocol with a simulator or physical target. It allows for receiving tracing messages, @@ -11,6 +12,7 @@ repository = "https://github.com/tosc-rs/mnemos" homepage = "https://mnemos.dev" readme = "./README.md" license = "MIT OR Apache-2.0" +edition = "2021" ### See `main.rs::serial` comments for why these duplicate dependencies exit diff --git a/tools/crowtty/src/trace.rs b/tools/crowtty/src/trace.rs index 58013a1a..20cd1f71 100644 --- a/tools/crowtty/src/trace.rs +++ b/tools/crowtty/src/trace.rs @@ -177,8 +177,12 @@ impl TraceWorker { parent: _, fields, } => { - let Some(meta) = self.metas.get(&meta) else { - println!("{} {} UNKNOWN: {meta:?}", self.tag, "META".if_supports_color(Stream::Stdout, |x| x.bright_blue())); + let Some(meta) = self.metas.get(&meta) else { + println!( + "{} {} UNKNOWN: {meta:?}", + self.tag, + "META".if_supports_color(Stream::Stdout, |x| x.bright_blue()) + ); return; }; let target = meta.target.as_str(); @@ -215,7 +219,11 @@ impl TraceWorker { let start = Instant::now(); let mut repr = String::new(); let Some(meta) = self.metas.get(&meta) else { - println!("{} {} UNKNOWN: {meta:?}", self.tag, "META".if_supports_color(Stream::Stdout, |x| x.bright_blue())); + println!( + "{} {} UNKNOWN: {meta:?}", + self.tag, + "META".if_supports_color(Stream::Stdout, |x| x.bright_blue()) + ); return; }; diff --git a/tools/dumbloader/Cargo.toml b/tools/dumbloader/Cargo.toml index 488c7463..213e266a 100644 --- a/tools/dumbloader/Cargo.toml +++ b/tools/dumbloader/Cargo.toml @@ -1,3 +1,5 @@ +cargo-features = ["per-package-target", "profile-rustflags"] + [package] name = "dumbloader" version = "0.1.0" diff --git a/tools/f3repl/Cargo.toml b/tools/f3repl/Cargo.toml index 3ffab841..736dcb3c 100644 --- a/tools/f3repl/Cargo.toml +++ b/tools/f3repl/Cargo.toml @@ -1,3 +1,5 @@ +cargo-features = ["per-package-target", "profile-rustflags"] + [package] name = "f3repl" version = "0.1.0"