From ded9049ee4a5358a8e2aa943475e97e417f56f4f Mon Sep 17 00:00:00 2001 From: Vihaan Jim Date: Tue, 1 Aug 2023 22:16:40 -0400 Subject: [PATCH] Turn app-loader into an app instead of a service When the user selects App Loader from the app menu, a new menu shows up that displays the currently loaded apps (in the future this will contain options to add/remove apps as well). This is a much more sane approach than whatever I was doing before because it requires minimal changes to the rest of the source tree (I had to change xtask so that it would replace -'s with _'s in constant names so that I could name my app app-loader). --- Cargo.lock | 255 ++++++++---------- Cargo.toml | 13 +- {services => apps}/app-loader/Cargo.toml | 13 +- .../app-loader/spawn/Cargo.toml | 0 {services => apps}/app-loader/spawn/README.md | 0 {services => apps}/app-loader/spawn/build.rs | 0 {services => apps}/app-loader/spawn/link.x | 0 .../app-loader/spawn/src/debug.rs | 0 .../app-loader/spawn/src/main.rs | 0 .../src/lib.rs => apps/app-loader/src/_lib.rs | 0 {services => apps}/app-loader/src/api.rs | 0 {services => apps}/app-loader/src/hello | Bin apps/app-loader/src/main.rs | 116 ++++++++ {services => apps}/app-loader/src/spawn-stub | Bin apps/manifest.json | 10 + services/app-loader/src/main.rs | 80 ------ services/status/Cargo.toml | 2 - services/status/src/main.rs | 27 +- xtask/src/app_manifest.rs | 12 +- 19 files changed, 266 insertions(+), 262 deletions(-) rename {services => apps}/app-loader/Cargo.toml (66%) rename {services => apps}/app-loader/spawn/Cargo.toml (100%) rename {services => apps}/app-loader/spawn/README.md (100%) rename {services => apps}/app-loader/spawn/build.rs (100%) rename {services => apps}/app-loader/spawn/link.x (100%) rename {services => apps}/app-loader/spawn/src/debug.rs (100%) rename {services => apps}/app-loader/spawn/src/main.rs (100%) rename services/app-loader/src/lib.rs => apps/app-loader/src/_lib.rs (100%) rename {services => apps}/app-loader/src/api.rs (100%) rename {services => apps}/app-loader/src/hello (100%) create mode 100644 apps/app-loader/src/main.rs rename {services => apps}/app-loader/src/spawn-stub (100%) delete mode 100644 services/app-loader/src/main.rs diff --git a/Cargo.lock b/Cargo.lock index 8e5c6e5f8..d1b164caf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -74,7 +74,7 @@ dependencies = [ "aes 0.8.1", "hex-literal", "log", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", ] @@ -113,10 +113,11 @@ dependencies = [ "num-derive", "num-traits", "rkyv", - "xous 0.9.45 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", - "xous-ipc 0.9.45 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-api-ticktimer", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -281,11 +282,11 @@ dependencies = [ "num-derive", "num-traits", "trng", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-ticktimer", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -693,12 +694,12 @@ dependencies = [ "rkyv", "trng", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-susres", "xous-api-ticktimer", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -724,12 +725,12 @@ dependencies = [ "trng", "typenum", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-susres", "xous-api-ticktimer", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", "xous-semver", ] @@ -781,7 +782,7 @@ dependencies = [ "graphics-server", "log", "rkyv", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-names", ] @@ -822,7 +823,7 @@ version = "0.1.0" dependencies = [ "log", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-ticktimer", @@ -1365,12 +1366,12 @@ dependencies = [ "trng", "userprefs", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-susres", "xous-api-ticktimer", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1390,12 +1391,12 @@ dependencies = [ "rkyv", "spinor", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-susres", "xous-api-ticktimer", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1545,12 +1546,12 @@ dependencies = [ "num-traits", "rkyv", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-susres", "xous-api-ticktimer", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1683,7 +1684,7 @@ dependencies = [ "num-derive", "num-traits", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-susres", @@ -1907,12 +1908,12 @@ dependencies = [ "trng", "tts-frontend", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-susres", "xous-api-ticktimer", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1973,9 +1974,9 @@ dependencies = [ "wasi 0.11.0+wasi-snapshot-preview1", "wasm-bindgen", "wasm-bindgen-test", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-names", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2008,12 +2009,12 @@ dependencies = [ "num-traits", "rkyv", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-susres", "xous-api-ticktimer", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2098,10 +2099,10 @@ dependencies = [ "num-derive", "num-traits", "tts-frontend", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2241,11 +2242,11 @@ dependencies = [ "rkyv", "tts-frontend", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-ticktimer", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2257,9 +2258,9 @@ dependencies = [ "num-derive", "num-traits", "rkyv", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-names", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2272,11 +2273,11 @@ dependencies = [ "num-traits", "rkyv", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-ticktimer", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2291,11 +2292,11 @@ dependencies = [ "rkyv", "tts-frontend", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-ticktimer", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2401,12 +2402,12 @@ dependencies = [ "num-traits", "rkyv", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-susres", "xous-api-ticktimer", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2421,7 +2422,7 @@ version = "0.1.0" dependencies = [ "log", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-ticktimer", ] @@ -2438,12 +2439,12 @@ dependencies = [ "rkyv", "spinor", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-susres", "xous-api-ticktimer", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2519,7 +2520,7 @@ dependencies = [ "num-derive", "num-traits", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-ticktimer", @@ -2543,12 +2544,12 @@ dependencies = [ "num-traits", "rkyv", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-susres", "xous-api-ticktimer", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", "xous-semver", ] @@ -2706,11 +2707,11 @@ dependencies = [ "trng", "tts-frontend", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-ticktimer", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2737,11 +2738,11 @@ dependencies = [ "status", "trng", "ureq", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-ticktimer", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2777,12 +2778,12 @@ dependencies = [ "smoltcp", "trng", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-susres", "xous-api-ticktimer", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", "xous-semver", ] @@ -3168,12 +3169,12 @@ dependencies = [ "trng", "tts-frontend", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-susres", "xous-api-ticktimer", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", "zeroize", "zeroize_derive", ] @@ -3201,7 +3202,7 @@ version = "0.1.0" dependencies = [ "log", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", ] [[package]] @@ -3754,11 +3755,11 @@ dependencies = [ "num-derive", "num-traits", "trng", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-ticktimer", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3796,9 +3797,9 @@ dependencies = [ "spin 0.5.2", "untrusted", "winapi", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-names", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3880,12 +3881,12 @@ dependencies = [ "tts-frontend", "usb-device-xous", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-susres", "xous-api-ticktimer", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", "xous-semver", "zeroize", ] @@ -4216,12 +4217,12 @@ dependencies = [ "rkyv", "trng", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-susres", "xous-api-ticktimer", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4310,12 +4311,12 @@ dependencies = [ "usb-device-xous", "utralib", "x25519-dalek", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-susres", "xous-api-ticktimer", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4373,7 +4374,7 @@ name = "spawn" version = "0.1.0" dependencies = [ "log", - "xous 0.9.45 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", ] @@ -4406,12 +4407,12 @@ dependencies = [ "rkyv", "trng", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-susres", "xous-api-ticktimer", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4468,12 +4469,12 @@ dependencies = [ "usb-device-xous", "userprefs", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-susres", "xous-api-ticktimer", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", "xous-semver", ] @@ -4518,7 +4519,7 @@ dependencies = [ [[package]] name = "svd2utra" -version = "0.1.18" +version = "0.1.19" dependencies = [ "quick-xml", ] @@ -4597,13 +4598,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "test-spawn" -version = "0.1.0" -dependencies = [ - "xous 0.9.45 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "textwrap" version = "0.11.0" @@ -4662,7 +4656,7 @@ name = "ticktimer-test-client" version = "0.1.0" dependencies = [ "log", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", ] @@ -4756,11 +4750,11 @@ dependencies = [ "sha2 0.9.8", "webpki-roots 0.23.1", "x509-parser", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-ticktimer", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4873,10 +4867,10 @@ dependencies = [ "num-derive", "num-traits", "usb-device-xous", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4891,12 +4885,12 @@ dependencies = [ "rand_core 0.5.1", "rkyv", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-susres", "xous-api-ticktimer", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4909,11 +4903,11 @@ dependencies = [ "num-traits", "rkyv", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-ticktimer", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", "xous-tts-backend", ] @@ -5075,12 +5069,12 @@ dependencies = [ "usbd_scsi 0.1.1", "utralib", "vcell", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-susres", "xous-api-ticktimer", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", "xous-semver", ] @@ -5100,7 +5094,7 @@ dependencies = [ "usbd-human-interface-device 0.1.1", "utralib", "vcell", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-susres", @@ -5163,7 +5157,7 @@ dependencies = [ "typenum", "usb-device", "usbd_mass_storage 0.1.0", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-ticktimer", ] @@ -5237,7 +5231,7 @@ dependencies = [ "usb-device", "usbd_bulk_only_transport 0.1.0", "usbd_mass_storage 0.1.0", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-ticktimer", ] @@ -5260,7 +5254,7 @@ checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" [[package]] name = "utralib" -version = "0.1.20" +version = "0.1.21" dependencies = [ "svd2utra", ] @@ -5317,12 +5311,12 @@ dependencies = [ "usbd-human-interface-device 0.2.1", "userprefs", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-susres", "xous-api-ticktimer", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -5865,103 +5859,92 @@ checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3" [[package]] name = "xous" -version = "0.9.47" +version = "0.9.48" dependencies = [ "compiler_builtins", "lazy_static", "rustc-std-workspace-core", ] -[[package]] -name = "xous" -version = "0.9.47" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "988ffa0937a8552d05bb8601359b71b600c4e5abf714293f0387f3c942dcd3d3" -dependencies = [ - "lazy_static", -] - [[package]] name = "xous-api-log" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ea53718689b6c58db3708e422b4d201daf3b64eb658fc5c436ec8663fcf4ab7" +version = "0.1.44" dependencies = [ "log", "num-derive", "num-traits", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "xous-api-names" -version = "0.9.45" +version = "0.9.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a922d07ed4dabdbeba270646ee12654f366e3ddb40b0e94769f79511a2df689" +checksum = "bf13daca16910140fe4067135dfb56ca406e6f8951f93b1f087281a21fc055b6" dependencies = [ "log", "num-derive", "num-traits", "rkyv", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "xous-api-susres" -version = "0.9.43" +version = "0.9.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61570718107e51e0db9970756f62087e976ab7f60bcda780a46ffdbfd1077990" +checksum = "52df51cae6c59c7e0161a58e1ffec165bfc687bf37f962b499e5a3722d81905b" dependencies = [ "log", "num-derive", "num-traits", "rkyv", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "xous-api-ticktimer" -version = "0.9.43" +version = "0.9.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0146b0d582a1cd0ce77ce1e0d3c025ebdda6e22b554e96445d88cfb390c68d40" +checksum = "6c148e3dfac60d86d1d1553eb4c170ead1f7131181bc331fb18493782cfaa678" dependencies = [ "log", "num-derive", "num-traits", "rkyv", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-susres", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", "xous-semver", ] [[package]] name = "xous-ipc" -version = "0.9.47" +version = "0.9.48" dependencies = [ "bitflags 1.3.2", "rkyv", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", ] [[package]] name = "xous-ipc" -version = "0.9.47" +version = "0.9.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd9a02a79263e784da2488ee93573ba656ce71e72f1c3601de6df796675c65f" +checksum = "9bc1dd2cd7306d496d9606796905d472ca51f7889423363c96c2296506963234" dependencies = [ "bitflags 1.3.2", "rkyv", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", ] [[package]] @@ -5981,7 +5964,7 @@ dependencies = [ "rand_chacha 0.3.1", "stats_alloc", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-riscv", ] @@ -5995,9 +5978,9 @@ dependencies = [ "num-traits", "rkyv", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -6009,10 +5992,10 @@ dependencies = [ "num-traits", "rkyv", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -6024,7 +6007,7 @@ dependencies = [ "pio", "pio-proc", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", ] [[package]] @@ -6034,7 +6017,7 @@ dependencies = [ "bitfield", "log", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", ] [[package]] @@ -6062,11 +6045,11 @@ dependencies = [ "num-traits", "rkyv", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-susres", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -6079,12 +6062,12 @@ dependencies = [ "num-traits", "rkyv", "utralib", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-log", "xous-api-names", "xous-api-susres", "xous-api-ticktimer", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", "xous-semver", ] @@ -6098,9 +6081,9 @@ dependencies = [ "num-derive", "num-traits", "rkyv", - "xous 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous", "xous-api-names", - "xous-ipc 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", + "xous-ipc 0.9.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 505fe1419..8a47ef404 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -72,6 +72,8 @@ members = [ "services/dns", "services/modals", "services/early_settings", + "apps/app-loader", + "apps/app-loader/spawn", "apps/ball", "apps/hello", "apps/mtxcli", @@ -82,7 +84,6 @@ members = [ "services/libstd-test", "services/ffi-test", "services/tts", - "services/app-loader/spawn", "services/cram-console", #"services/test-spawn", #"services/test-spawn/spawn", @@ -92,7 +93,6 @@ members = [ "kernel", "loader", "libs/userprefs", - "services/app-loader", "libs/tls", "libs/xous-pio", "libs/xous-pl230", @@ -116,6 +116,11 @@ exclude = [ "libs/mass-storage/packing", ] +[profile.dev] +opt-level = 1 +lto = "fat" +overflow-checks = false + [profile.release] codegen-units = 1 # 1 better optimizations debug = false @@ -175,8 +180,8 @@ rev="4296c2e7904898766cf7d8d589759a129794783b" # use the commitref because we're path = "./utralib" [patch.crates-io.svd2utra] path = "./svd2utra" -# [patch.crates-io.xous] -# path = "./xous-rs" +[patch.crates-io.xous] +path = "./xous-rs" # [patch.crates-io.xous-ipc] # path = "./xous-ipc" # [patch.crates-io.xous-api-names] diff --git a/services/app-loader/Cargo.toml b/apps/app-loader/Cargo.toml similarity index 66% rename from services/app-loader/Cargo.toml rename to apps/app-loader/Cargo.toml index 470a3dde2..51f9f3093 100644 --- a/services/app-loader/Cargo.toml +++ b/apps/app-loader/Cargo.toml @@ -11,16 +11,13 @@ xous = "0.9.40" xous-ipc = "0.9.40" log-server = { package = "xous-api-log", version = "0.1.35" } log = "0.4.14" -xous-names = {package = "xous-api-names", version = "0.9.37"} -gam = {path = "../gam"} -graphics-server = {path = "../../services/graphics-server" } -locales = {path = "../../locales"} +xous-names = { package = "xous-api-names", version = "0.9.37" } +gam = { path = "../../services/gam" } +graphics-server = { path = "../../services/graphics-server" } +ticktimer-server = { package = "xous-api-ticktimer", version = "0.9.44" } +locales = { path = "../../locales" } num-derive = {version = "0.3.3", default-features = false} num-traits = {version = "0.2.14", default-features = false} rkyv = {version = "0.4.3", features = ["const_generics"], default-features = false} - -[features] -default = ["app_loader"] -app_loader = [] \ No newline at end of file diff --git a/services/app-loader/spawn/Cargo.toml b/apps/app-loader/spawn/Cargo.toml similarity index 100% rename from services/app-loader/spawn/Cargo.toml rename to apps/app-loader/spawn/Cargo.toml diff --git a/services/app-loader/spawn/README.md b/apps/app-loader/spawn/README.md similarity index 100% rename from services/app-loader/spawn/README.md rename to apps/app-loader/spawn/README.md diff --git a/services/app-loader/spawn/build.rs b/apps/app-loader/spawn/build.rs similarity index 100% rename from services/app-loader/spawn/build.rs rename to apps/app-loader/spawn/build.rs diff --git a/services/app-loader/spawn/link.x b/apps/app-loader/spawn/link.x similarity index 100% rename from services/app-loader/spawn/link.x rename to apps/app-loader/spawn/link.x diff --git a/services/app-loader/spawn/src/debug.rs b/apps/app-loader/spawn/src/debug.rs similarity index 100% rename from services/app-loader/spawn/src/debug.rs rename to apps/app-loader/spawn/src/debug.rs diff --git a/services/app-loader/spawn/src/main.rs b/apps/app-loader/spawn/src/main.rs similarity index 100% rename from services/app-loader/spawn/src/main.rs rename to apps/app-loader/spawn/src/main.rs diff --git a/services/app-loader/src/lib.rs b/apps/app-loader/src/_lib.rs similarity index 100% rename from services/app-loader/src/lib.rs rename to apps/app-loader/src/_lib.rs diff --git a/services/app-loader/src/api.rs b/apps/app-loader/src/api.rs similarity index 100% rename from services/app-loader/src/api.rs rename to apps/app-loader/src/api.rs diff --git a/services/app-loader/src/hello b/apps/app-loader/src/hello similarity index 100% rename from services/app-loader/src/hello rename to apps/app-loader/src/hello diff --git a/apps/app-loader/src/main.rs b/apps/app-loader/src/main.rs new file mode 100644 index 000000000..8f7f33f4b --- /dev/null +++ b/apps/app-loader/src/main.rs @@ -0,0 +1,116 @@ +use gam::{Gam, MenuItem, UxRegistration, menu_matic, APP_NAME_APP_LOADER, APP_MENU_0_APP_LOADER}; +use xous_ipc::Buffer; +use num_traits::{ToPrimitive, FromPrimitive}; + +const SERVER_NAME_APP_LOADER: &str = "_App Loader_"; + +#[derive(Debug, num_derive::FromPrimitive, num_derive::ToPrimitive)] +enum Opcode { + /// to load an app into ram + LoadApp, + + /// dispatch the app + DispatchApp, + + /// Redraw the UI + Redraw +} + +#[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)] +struct LoadAppRequest { + pub name: xous_ipc::String<64> +} + +fn main() -> ! { + log_server::init_wait().unwrap(); + log::set_max_level(log::LevelFilter::Info); + log::info!("my PID is {}", xous::process::id()); + + let xns = xous_names::XousNames::new().unwrap(); + let sid = xns.register_name(SERVER_NAME_APP_LOADER, None).expect("Couldn't create server"); + let self_conn = xns.request_connection_blocking(SERVER_NAME_APP_LOADER).expect("Couldn't connect to server"); + + // the ticktimer + let ticktimer = ticktimer_server::Ticktimer::new().expect("Couldn't connect to Ticktimer"); + + let gam = Gam::new(&xns).expect("can't connect to GAM"); + let auth = gam.register_ux(UxRegistration { + app_name: xous_ipc::String::from_str(APP_NAME_APP_LOADER), + ux_type: gam::UxType::Modal, + predictor: None, + listener: sid.to_array(), + redraw_id: Opcode::Redraw.to_u32().unwrap(), + gotinput_id: None, + audioframe_id: None, + focuschange_id: None, + rawkeys_id: None + }).expect("Couldn't register").expect("Didn't get an auth token"); + + let menu = menu_matic(Vec::new(), APP_MENU_0_APP_LOADER, Some(xous::create_server().unwrap())).expect("Couldn't create menu"); + + let mut apps = Vec::new(); + + // start off by adding hello world + let buf = Buffer::into_buf(LoadAppRequest { name: xous_ipc::String::from_str("hello") }).expect("Couldn't create buffer"); + buf.send(self_conn, + Opcode::LoadApp.to_u32().unwrap()).expect("Couldn't send message"); + + loop { + let msg = xous::receive_message(sid).unwrap(); + match FromPrimitive::from_usize(msg.body.id()).expect("Couldn't load message") { + Opcode::LoadApp => { + let buffer = unsafe { Buffer::from_memory_message(msg.body.memory_message().unwrap()) }; + let load_app_req = buffer.to_original::().unwrap(); + + // create the spawn process + let stub = include_bytes!("../../../target/riscv32imac-unknown-xous-elf/debug/spawn.bin"); + let args = xous::ProcessArgs::new(stub, xous::MemoryAddress::new(0x2050_1000).unwrap(), xous::MemoryAddress::new(0x2050_1000).unwrap()); + let spawn = xous::create_process(args).expect("Couldn't create spawn process"); + log::info!("Spawn PID: {}, Spawn CID: {}", spawn.pid, spawn.cid); + + // perform a ping to make sure that spawn is running + let result = xous::send_message( + spawn.cid, + xous::Message::new_blocking_scalar(2, 1, 2, 3, 4), + ) + .unwrap(); + log::info!("Result of ping: {:?}", result); + + // load the app from the binary file + let bin = include_bytes!("hello"); + let bin_len = bin.len(); + let bin_loc = bin.as_ptr() as usize; + let buf = unsafe { xous::MemoryRange::new(bin_loc & !0xFFF, bin_len + if bin_len & 0xFFF == 0 { 0 } else {0x1000 - (bin_len & 0xFFF)}).expect("Couldn't create a buffer from the segment") }; + xous::send_message(spawn.cid, xous::Message::new_lend(1, buf, None, None)).expect("Couldn't send a message to spawn"); + + menu.add_item(MenuItem { name: load_app_req.name, + action_conn: Some(self_conn), + action_opcode: Opcode::DispatchApp.to_u32().unwrap(), + action_payload: gam::MenuPayload::Scalar([apps.len().try_into().unwrap(), 0, 0, 0]), + close_on_select: true }); + apps.push(load_app_req.name); + log::info!("Added app `{}'!", load_app_req.name); + }, + Opcode::DispatchApp => { + let index = msg.body.scalar_message().expect("Not a scalar").arg1; + if index < apps.len() { + let name: xous_ipc::String<64> = apps[index]; + gam.switch_to_app(name.as_ref(), auth).expect(&format!("Could not dispatch app `{}'", name)); + } else { + panic!("Unrecognized app index"); + } + }, + Opcode::Redraw => { + // Properly close the app menu + // for anyone who needs this I found this in Menu::key_event + gam.relinquish_focus().unwrap(); + xous::yield_slice(); + + ticktimer.sleep_ms(100).ok(); // yield for a moment to allow the previous menu to close + + // open the submenu + gam.raise_menu(APP_MENU_0_APP_LOADER).expect("Couldn't raise menu"); + }, + } + } +} diff --git a/services/app-loader/src/spawn-stub b/apps/app-loader/src/spawn-stub similarity index 100% rename from services/app-loader/src/spawn-stub rename to apps/app-loader/src/spawn-stub diff --git a/apps/manifest.json b/apps/manifest.json index fe58e2d00..054d826e9 100644 --- a/apps/manifest.json +++ b/apps/manifest.json @@ -1,4 +1,14 @@ { + "app-loader": { + "context_name": "App Loader", + "menu_name": { + "appmenu.app-loader": { + "en": "App Loader", + "en-tts": "App Loader" + } + }, + "submenu": 1 + }, "ball": { "context_name": "ball demo app", "menu_name": { diff --git a/services/app-loader/src/main.rs b/services/app-loader/src/main.rs deleted file mode 100644 index ddb785afb..000000000 --- a/services/app-loader/src/main.rs +++ /dev/null @@ -1,80 +0,0 @@ -#![cfg_attr(target_os = "none", no_std)] -#![cfg_attr(target_os = "none", no_main)] - -use gam::Gam; -mod api; -use api::{Opcode, Return, LoadAppRequest, App, AppRequest}; -use xous_ipc::Buffer; -use num_traits::FromPrimitive; - -fn main() -> ! { - log_server::init_wait().unwrap(); - log::set_max_level(log::LevelFilter::Info); - log::info!("my PID is {}", xous::process::id()); - - let xns = xous_names::XousNames::new().unwrap(); - let sid = xns.register_name(api::SERVER_NAME_APP_LOADER, None).expect("Couldn't create server"); - - let gam = Gam::new(&xns).expect("can't connect to GAM"); - - // the loaded apps - let mut apps = vec![]; - - loop { - let mut msg = xous::receive_message(sid).unwrap(); - match FromPrimitive::from_usize(msg.body.id()).expect("Couldn't load message") { - Opcode::LoadApp => { - let buffer = unsafe { Buffer::from_memory_message(msg.body.memory_message().unwrap()) }; - let load_app_req = buffer.to_original::().unwrap(); - // a dummy server for testing purposes - let name = "_Hello World_"; // note: this MUST match up with the gam name - - // create the spawn process - let stub = include_bytes!("../../../target/riscv32imac-unknown-xous-elf/debug/spawn.bin"); - let args = xous::ProcessArgs::new(stub, xous::MemoryAddress::new(0x2050_1000).unwrap(), xous::MemoryAddress::new(0x2050_1000).unwrap()); - let spawn = xous::create_process(args).expect("Couldn't create spawn process"); - log::info!("Spawn PID: {}, Spawn CID: {}", spawn.pid, spawn.cid); - - // perform a ping to make sure that spawn is running - let result = xous::send_message( - 6, - xous::Message::new_blocking_scalar(2, 1, 2, 3, 4), - ) - .unwrap(); - log::info!("Result of ping: {:?}", result); - - // load the app from the binary file - let bin = include_bytes!("hello"); - let bin_len = bin.len(); - let bin_loc = bin.as_ptr() as usize; - let buf = unsafe { xous::MemoryRange::new(bin_loc & !0xFFF, bin_len + if bin_len & 0xFFF == 0 { 0 } else {0x1000 - (bin_len & 0xFFF)}).expect("Couldn't create a buffer from the segment") }; - xous::send_message(6, xous::Message::new_lend(1, buf, None, None)).expect("Couldn't send a message to spawn"); - - apps.push(xous_ipc::String::from_str(name)); - log::info!("Added app `{}'!", load_app_req.name); - }, - Opcode::FetchAppData => { - log::info!("Data requested."); - let mut buffer = unsafe { Buffer::from_memory_message_mut(msg.body.memory_message_mut().unwrap()) }; - let req = buffer.to_original::().unwrap(); - let mut response = Return::Failure; - if req.index < apps.len() { - let name = apps[req.index]; - let retstruct = App { - name: xous_ipc::String::from_str(name) - }; - response = Return::Info(retstruct); - } - buffer.replace(response).unwrap(); - }, - Opcode::DispatchApp => { - let buffer = unsafe { Buffer::from_memory_message(msg.body.memory_message().unwrap()) }; - let req = buffer.to_original::().unwrap(); - if req.index < apps.len() { - let name: xous_ipc::String<64> = apps[req.index]; - gam.switch_to_app(name.as_ref(), req.auth.expect("No auth token given!")).expect(&format!("Could not dispatch app `{}'", name)); - } - }, - } - } -} diff --git a/services/status/Cargo.toml b/services/status/Cargo.toml index 1f14bcdfa..6eb286ec5 100644 --- a/services/status/Cargo.toml +++ b/services/status/Cargo.toml @@ -47,8 +47,6 @@ com_rs = { git = "https://github.com/betrusted-io/com_rs", rev = "891bdd3ca8e41f utralib = {version = "0.1.21", optional = true, default-features = false } -app-loader = {path = "../app-loader/", optional = true} - # short circuit the datetime call on hosted mode [target.'cfg(any(windows,unix))'.dependencies] chrono = "0.4.19" diff --git a/services/status/src/main.rs b/services/status/src/main.rs index 150a8c091..b02236bd5 100644 --- a/services/status/src/main.rs +++ b/services/status/src/main.rs @@ -23,8 +23,6 @@ use locales::t; use gam::{GamObjectList, GamObjectType}; use chrono::prelude::*; use crossbeam::channel::{at, select, unbounded, Receiver, Sender}; -#[cfg(feature = "app-loader")] -use app_loader::AppLoader; use std::collections::HashMap; use std::sync::{Arc, Mutex}; @@ -65,9 +63,6 @@ pub(crate) enum StatusOpcode { SwitchToShellchat, /// Switch to an app SwitchToApp, - /// Switch to an app loaded by apploader - #[cfg(feature="app-loader")] - SwitchToLoadedApp, /// Prepare for a backup PrepareBackup, @@ -397,7 +392,7 @@ fn wrapped_main() -> ! { let main_menu_sid = xous::create_server().unwrap(); let status_cid = xous::connect(status_sid).unwrap(); let menu_manager = create_main_menu(keys.clone(), main_menu_sid, status_cid, &com); - let app_menu_manager = create_app_menu(xous::connect(status_sid).unwrap()); + create_app_menu(xous::connect(status_sid).unwrap()); let kbd = Arc::new(Mutex::new(keyboard::Keyboard::new(&xns).unwrap())); // ---------------------------- Background processes that claim contexts @@ -896,12 +891,6 @@ fn wrapped_main() -> ! { // storage for wifi bars let mut wifi_bars: [PixelColor; 5] = [PixelColor::Light, PixelColor::Light, PixelColor::Light, PixelColor::Light, PixelColor::Light]; - // the app loader - #[cfg(feature = "app-loader")] - let mut app_loader = AppLoader::new(&xns, status_cid, StatusOpcode::SwitchToLoadedApp.to_u32().unwrap(), app_menu_manager.unwrap()).expect("Couldn't load app loader"); - #[cfg(feature = "app-loader")] - app_loader.load_app(xous_ipc::String::from_str("hello")).expect("Couldn't load hello"); - pump_run.store(true, Ordering::Relaxed); // start status thread updating loop { let msg = xous::receive_message(status_sid).unwrap(); @@ -1252,20 +1241,6 @@ fn wrapped_main() -> ! { Message::new_scalar(StatusOpcode::Pump.to_usize().unwrap(), 0, 0, 0, 0), ).expect("couldn't trigger status update"); }), - #[cfg(feature = "app-loader")] - Some(StatusOpcode::SwitchToLoadedApp) => msg_scalar_unpack!(msg, index, _, _, _, { - ticktimer.sleep_ms(100).ok(); - let app_name = app_loader.app_index_to_name(index).expect("app index not found"); - log::info!("Loading app `{}' (index {})", app_name, index); - app_loader.app_dispatch(security_tv.token.unwrap(), index).expect("cannot switch to app"); - sec_notes.lock().unwrap().remove(&"current_app".to_string()); - sec_notes.lock().unwrap().insert("current_app".to_string(), format!("Running: {}", app_name).to_string()); - secnotes_force_redraw = true; - send_message( - cb_cid, - Message::new_scalar(StatusOpcode::Pump.to_usize().unwrap(), 0, 0, 0, 0), - ).expect("couldn't trigger status update"); - }), Some(StatusOpcode::TrySuspend) => { if llio.is_plugged_in() { modals.show_notification(t!("mainmenu.cant_sleep", locales::LANG), None).expect("couldn't notify that power is plugged in"); diff --git a/xtask/src/app_manifest.rs b/xtask/src/app_manifest.rs index 076f47df7..77a768cf4 100644 --- a/xtask/src/app_manifest.rs +++ b/xtask/src/app_manifest.rs @@ -67,7 +67,7 @@ pub(crate) fn generate_app_menus(apps: &Vec) { writeln!( gam_tokens, "pub const APP_NAME_{}: &'static str = \"{}\";", - app_name.to_uppercase(), + app_name.to_uppercase().replace("-", "_"), manifest.context_name, ) .unwrap(); @@ -77,7 +77,7 @@ pub(crate) fn generate_app_menus(apps: &Vec) { gam_tokens, "pub const APP_MENU_{}_{}: &'static str = \"{} Submenu {}\";", i, - app_name.to_uppercase(), + app_name.to_uppercase().replace("-", "_"), manifest.context_name, i, ) @@ -89,16 +89,16 @@ pub(crate) fn generate_app_menus(apps: &Vec) { gam_tokens, "\npub const EXPECTED_APP_CONTEXTS: &[&'static str] = &[" ) - .unwrap(); + .unwrap(); for (app_name, manifest) in working_set.iter() { - writeln!(gam_tokens, " APP_NAME_{},", app_name.to_uppercase(),).unwrap(); + writeln!(gam_tokens, " APP_NAME_{},", app_name.to_uppercase().replace("-", "_"),).unwrap(); if let Some(menu_count) = manifest.submenu { for i in 0..menu_count { writeln!( gam_tokens, " APP_MENU_{}_{},", i, - app_name.to_uppercase(), + app_name.to_uppercase().replace("-", "_"), ) .unwrap(); } @@ -151,7 +151,7 @@ pub(crate) fn app_dispatch(gam: &gam::Gam, token: [u32; 4], index: usize) -> Res Ok(()) }},", index, - app_name.to_uppercase() + app_name.to_uppercase().replace("-", "_") ) .unwrap(); }