diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index c90c87b..0000000 --- a/Cargo.lock +++ /dev/null @@ -1,650 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "atxtiny-hal" -version = "0.1.0" -dependencies = [ - "avr-device", - "cfg-if 1.0.0", - "embedded-hal 1.0.0", - "embedded-hal-bus", - "embedded-io", - "enumset", - "fugit", - "fugit-timer", - "nb 0.1.3", - "panic-halt", - "paste", - "ufmt", - "void", -] - -[[package]] -name = "avr-device" -version = "0.5.3" -dependencies = [ - "avr-device-macros", - "bare-metal", - "cfg-if 1.0.0", - "critical-section", - "vcell", -] - -[[package]] -name = "avr-device-macros" -version = "0.5.3" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "avr-hal-generic" -version = "0.1.0" -source = "git+https://github.com/rahix/avr-hal.git?rev=4dbd683dc335f9ad40d66c974d9baac1bc143a34#4dbd683dc335f9ad40d66c974d9baac1bc143a34" -dependencies = [ - "avr-device", - "cfg-if 0.1.10", - "embedded-hal 0.2.7", - "embedded-hal 1.0.0", - "embedded-storage", - "nb 1.1.0", - "paste", - "rustversion", - "ufmt", - "unwrap-infallible", -] - -[[package]] -name = "avr-progmem" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e93a9dd7da8f4eb57c912367e337687e06a8db6452d8c89eeb9eff1e0d2ba2d" -dependencies = [ - "cfg-if 1.0.0", - "derivative", - "ufmt", -] - -[[package]] -name = "az" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973" - -[[package]] -name = "bare-metal" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8fe8f5a8a398345e52358e18ff07cc17a568fbca5c6f73873d3a62056309603" - -[[package]] -name = "bitfield-struct" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26b8cea8bb6a81b75a84603b9e096f05fa86db057904ef29be1deee900532bd" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.53", -] - -[[package]] -name = "bytemuck" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6d68c57235a3a081186990eca2867354726650f42f7516ca50c28d6281fd15" - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "cichlid" -version = "0.2.1" -source = "git+https://github.com/simmsb/cichlid#f2b80b8c43ca0ced3a328438c95e3fe25af62719" - -[[package]] -name = "critical-section" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "darling" -version = "0.20.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.20.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn 2.0.53", -] - -[[package]] -name = "darling_macro" -version = "0.20.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" -dependencies = [ - "darling_core", - "quote", - "syn 2.0.53", -] - -[[package]] -name = "derivative" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "derive-syn-parse" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e79116f119dd1dba1abf1f3405f03b9b0e79a27a3883864bfebded8a3dc768cd" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "document-features" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef5282ad69563b5fc40319526ba27e0e7363d552a896f0297d54f767717f9b95" -dependencies = [ - "litrs", -] - -[[package]] -name = "embassy-executor" -version = "0.6.0" -dependencies = [ - "avr-device", - "critical-section", - "document-features", - "embassy-executor-macros", - "portable-atomic", -] - -[[package]] -name = "embassy-executor-macros" -version = "0.5.0" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.53", -] - -[[package]] -name = "embassy-futures" -version = "0.1.1" - -[[package]] -name = "embassy-sync" -version = "0.6.0" -dependencies = [ - "cfg-if 1.0.0", - "critical-section", - "embedded-io-async", - "futures-util", - "heapless", - "portable-atomic", -] - -[[package]] -name = "embassy-time" -version = "0.3.2" -dependencies = [ - "cfg-if 1.0.0", - "critical-section", - "document-features", - "embassy-time-driver", - "embassy-time-queue-driver", - "embedded-hal 0.2.7", - "embedded-hal 1.0.0", - "embedded-hal-async", - "futures-util", - "heapless", -] - -[[package]] -name = "embassy-time-driver" -version = "0.1.0" -dependencies = [ - "document-features", -] - -[[package]] -name = "embassy-time-queue-driver" -version = "0.1.0" - -[[package]] -name = "embedded-hal" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff" -dependencies = [ - "nb 0.1.3", - "void", -] - -[[package]] -name = "embedded-hal" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" - -[[package]] -name = "embedded-hal-async" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" -dependencies = [ - "embedded-hal 1.0.0", -] - -[[package]] -name = "embedded-hal-bus" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57b4e6ede84339ebdb418cd986e6320a34b017cdf99b5cc3efceec6450b06886" -dependencies = [ - "critical-section", - "embedded-hal 1.0.0", -] - -[[package]] -name = "embedded-io" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" - -[[package]] -name = "embedded-io-async" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" -dependencies = [ - "embedded-io", -] - -[[package]] -name = "embedded-storage" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "723dce4e9f25b6e6c5f35628e144794e5b459216ed7da97b7c4b66cdb3fa82ca" - -[[package]] -name = "enumset" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "226c0da7462c13fb57e5cc9e0dc8f0635e7d27f276a3a7fd30054647f669007d" -dependencies = [ - "enumset_derive", -] - -[[package]] -name = "enumset_derive" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08b6c6ab82d70f08844964ba10c7babb716de2ecaeab9be5717918a5177d3af" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.53", -] - -[[package]] -name = "env_int" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56770c6e9d29045810de45b3de328902245dd4834f35283b587a63951ab5e975" -dependencies = [ - "derive-syn-parse", - "proc-macro2", - "quote", - "syn 2.0.53", -] - -[[package]] -name = "fixed" -version = "1.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4810bcba5534219e7c160473f3a59167e2c98bd7516bc0eec5185848bcd38963" -dependencies = [ - "az", - "bytemuck", - "half", - "typenum", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "fugit" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17186ad64927d5ac8f02c1e77ccefa08ccd9eaa314d5a4772278aa204a22f7e7" -dependencies = [ - "gcd", -] - -[[package]] -name = "fugit-timer" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9607bfc4c388f9d629704f56ede4a007546cad417b3bcd6fc7c87dc7edce04a" -dependencies = [ - "fugit", - "nb 1.1.0", -] - -[[package]] -name = "futures-core" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" -dependencies = [ - "portable-atomic", -] - -[[package]] -name = "futures-task" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" - -[[package]] -name = "futures-util" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" -dependencies = [ - "futures-core", - "futures-task", - "pin-project-lite", - "pin-utils", -] - -[[package]] -name = "gcd" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" - -[[package]] -name = "half" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5eceaaeec696539ddaf7b333340f1af35a5aa87ae3e4f3ead0532f72affab2e" -dependencies = [ - "cfg-if 1.0.0", - "crunchy", -] - -[[package]] -name = "hash32" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" -dependencies = [ - "byteorder", -] - -[[package]] -name = "heapless" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" -dependencies = [ - "hash32", - "stable_deref_trait", -] - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "litrs" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5" - -[[package]] -name = "nb" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" -dependencies = [ - "nb 1.1.0", -] - -[[package]] -name = "nb" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" - -[[package]] -name = "panic-halt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de96540e0ebde571dc55c73d60ef407c653844e6f9a1e2fdbd40c07b9252d812" - -[[package]] -name = "paste" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" - -[[package]] -name = "pin-project-lite" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "portable-atomic" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" - -[[package]] -name = "proc-macro2" -version = "1.0.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rustversion" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" - -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.53" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7383cd0e49fff4b6b90ca5670bfd3e9d6a733b3f90c686605aa7eec8c4996032" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "typenum" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" - -[[package]] -name = "tyrfing" -version = "0.1.0" -dependencies = [ - "atxtiny-hal", - "avr-device", - "avr-hal-generic", - "avr-progmem", - "bitfield-struct", - "cichlid", - "embassy-executor", - "embassy-futures", - "embassy-sync", - "embassy-time", - "embassy-time-driver", - "embassy-time-queue-driver", - "embedded-io", - "env_int", - "fixed", - "fugit", - "futures-util", - "paste", - "portable-atomic", - "ufmt", -] - -[[package]] -name = "ufmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a64846ec02b57e9108d6469d98d1648782ad6bb150a95a9baac26900bbeab9d" -dependencies = [ - "ufmt-macros", - "ufmt-write", -] - -[[package]] -name = "ufmt-macros" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d337d3be617449165cb4633c8dece429afd83f84051024079f97ad32a9663716" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ufmt-write" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e87a2ed6b42ec5e28cc3b94c09982969e9227600b2e3dcbc1db927a84c06bd69" - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unwrap-infallible" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" - -[[package]] -name = "vcell" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" - -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" diff --git a/Cargo.toml b/Cargo.toml index 388937e..ebb1436 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,17 +20,19 @@ mode_fade = [] [dependencies] avr-device = { version = "0.5.3", features = ["rt", "attiny1616", "critical-section-impl"] } -# embassy-executor = { git = "https://github.com/embassy-rs/embassy", features = ["nightly", "arch-avr", "executor-thread" ] } -# embassy-time = { git = "https://github.com/embassy-rs/embassy", version = "0.3.0" } -# embassy-time-driver = { git = "https://github.com/embassy-rs/embassy", version = "0.1.0", features = ["tick-hz-250"] } -# embassy-time-queue-driver = { version = "0.1.0", git = "https://github.com/embassy-rs/embassy" } +embassy-executor = { features = ["nightly", "arch-avr", "executor-thread", "turbowakers" ], git = "https://github.com/simmsb/embassy", branch = "32bit" } +embassy-time = { git = "https://github.com/simmsb/embassy", branch = "32bit" } +embassy-time-driver = { features = ["tick-hz-1_024"], git = "https://github.com/simmsb/embassy", branch = "32bit" } +embassy-time-queue-driver = { git = "https://github.com/simmsb/embassy", branch = "32bit" } +embassy-sync = { git = "https://github.com/simmsb/embassy", branch = "32bit", features = ["turbowakers"] } +embassy-futures = { git = "https://github.com/simmsb/embassy", branch = "32bit" } -embassy-executor = { features = ["nightly", "arch-avr", "executor-thread", "turbowakers" ], path = "vendor/embassy/embassy-executor" } -embassy-time = { version = "0.3.0", path = "vendor/embassy/embassy-time" } -embassy-time-driver = { version = "0.1.0", features = ["tick-hz-1_024"], path = "vendor/embassy/embassy-time-driver" } -embassy-time-queue-driver = { version = "0.1.0", path = "vendor/embassy/embassy-time-queue-driver" } -embassy-sync = { path = "vendor/embassy/embassy-sync", features = ["turbowakers"] } -embassy-futures = { path = "vendor/embassy/embassy-futures" } +# embassy-executor = { features = ["nightly", "arch-avr", "executor-thread", "turbowakers" ], path = "vendor/embassy/embassy-executor" } +# embassy-time = { version = "0.3.0", path = "vendor/embassy/embassy-time" } +# embassy-time-driver = { version = "0.1.0", features = ["tick-hz-1_024"], path = "vendor/embassy/embassy-time-driver" } +# embassy-time-queue-driver = { version = "0.1.0", path = "vendor/embassy/embassy-time-queue-driver" } +# embassy-sync = { path = "vendor/embassy/embassy-sync", features = ["turbowakers"] } +# embassy-futures = { path = "vendor/embassy/embassy-futures" } env_int = "0.1.0" futures-util = { version = "0.3.30", default-features = false, features = ["portable-atomic"] } diff --git a/flake.lock b/flake.lock index 1374408..1149968 100644 --- a/flake.lock +++ b/flake.lock @@ -2,9 +2,7 @@ "nodes": { "crane": { "inputs": { - "nixpkgs": [ - "nixpkgs" - ] + "nixpkgs": "nixpkgs" }, "locked": { "lastModified": 1711681752, @@ -42,6 +40,22 @@ } }, "nixpkgs": { + "locked": { + "lastModified": 1730831018, + "narHash": "sha256-2S0HwIFRxYp+afuoFORcZA9TjryAf512GmE0MTfEOPU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "8c4dc69b9732f6bbe826b5fbb32184987520ff26", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1711655175, "narHash": "sha256-1xiaYhC3ul4y+i3eicYxeERk8ZkrNjLkrFSb/UW36Zw=", @@ -81,7 +95,7 @@ "inputs": { "crane": "crane", "fenix": "fenix", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "parts": "parts" } }, diff --git a/flake.nix b/flake.nix index e6422ab..5190062 100644 --- a/flake.nix +++ b/flake.nix @@ -5,7 +5,6 @@ crane = { url = "github:ipetkov/crane"; - inputs.nixpkgs.follows = "nixpkgs"; }; fenix = { @@ -31,31 +30,78 @@ ]; perSystem = { config, pkgs, system, lib, ... }: let - # avr-toolchain = fenix.packages.${system}.fromToolchainFile { - # file = ./rust-toolchain.toml; - # sha256 = ""; - # }; - # native-toolchain = fenix.packages.${system}.complete.withComponents [ - # "cargo" - # "clippy" - # "rust-src" - # "rustc" - # "rustfmt" - # ]; - # toolchain = fenix.packages.${system}.combine [ avr-toolchain native-toolchain ]; - # craneLib = (crane.mkLib pkgs).overrideToolchain toolchain; - # package = { target ? avr-toolchain.target, args ? "", profile ? "release" }: craneLib.buildPackage { - # cargoExtraArgs = "--target ${target} ${args}"; - # CARGO_PROFILE = profile; - # src = craneLib.cleanCargoSource (craneLib.path ./.); - # doCheck = false; - # buildInputs = [ - # # Add additional build inputs here - # ] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [ - # # Additional darwin specific inputs can be set here - # pkgs.libiconv - # ]; - # }; + + avr-toolchain-plain = fenix.packages.${system}.fromToolchainFile { + file = ./rust-toolchain.toml; + sha256 = "sha256-RsORFQhrtQVybYaWATQWNpUld1l0NxcUds2jd/YWPlA="; + }; + native-toolchain = (fenix.packages.${system}.complete.withComponents [ + "cargo" + "clippy" + # "rust-src" + # "rustc" + # "rustfmt" + ]); + avr-toolchain = pkgs.runCommand "turbowaker-rust" { } '' + echo "test $out ${avr-toolchain-plain}" + cp -RL ${avr-toolchain-plain} $out + chmod -R +rwx $out + + echo "doing patch" + + patch $out/lib/rustlib/src/rust/library/core/Cargo.toml ${./turbowaker/Cargo.toml.patch} + patch $out/lib/rustlib/src/rust/library/core/src/task/wake.rs ${./turbowaker/wake.rs.patch} + ''; + + + toolchain = fenix.packages.${system}.combine [ avr-toolchain native-toolchain ]; + craneLib = (crane.mkLib pkgs).overrideToolchain toolchain; + + src = craneLib.cleanCargoSource ./.; + + package = { target ? "thumbv7em-none-eabihf", args ? "", profile ? "release", defmt ? "off" }: craneLib.buildPackage { + inherit src; + + cargoVendorDir = craneLib.vendorMultipleCargoDeps { + inherit (craneLib.findCargoFiles src) cargoConfigs; + cargoLockList = [ + ./Cargo.lock + + # Unfortunately this approach requires IFD (import-from-derivation) + # otherwise Nix will refuse to read the Cargo.lock from our toolchain + # (unless we build with `--impure`). + # + # Another way around this is to manually copy the rustlib `Cargo.lock` + # to the repo and import it with `./path/to/rustlib/Cargo.lock` which + # will avoid IFD entirely but will require manually keeping the file + # up to date! + "${toolchain}/lib/rustlib/src/rust/library/Cargo.lock" + ]; + }; + + cargoExtraArgs = "-Z build-std=core,panic_abort,alloc -Z build-std-features=optimize_for_size,panic_immediate_abort,core/turbowakers --target ${target} ${args}"; + CARGO_PROFILE = profile; + DEFMT_LOG = defmt; + pname = "rusty-glove"; + version = "0.1.0"; + + strictDeps = true; + doCheck = false; + buildInputs = [ + # Add additional build inputs here + ] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [ + # Additional darwin specific inputs can be set here + pkgs.libiconv + ]; + }; + elf = pkg: name: binname: pkgs.runCommandLocal "mkelf" { } '' + mkdir -p $out + cp ${pkg}/bin/${name} $out/${binname}.elf + ''; + binary = pkg: name: pkgs.runCommandLocal "mkbinary" { buildInputs = [ pkgs.llvm ]; } '' + mkdir -p $out + llvm-objcopy -O binary ${pkg}/bin/${name} $out/${name}.bin + ''; avrlibc = pkgs.pkgsCross.avr.libcCross; dfp = pkgs.fetchzip { url = "http://packs.download.atmel.com/Atmel.ATtiny_DFP.2.0.368.atpack"; @@ -90,8 +136,8 @@ in # rec { - devShells.default = pkgs.mkShell { - nativeBuildInputs = with pkgs; [ + devShells.default = craneLib.devShell { + packages = with pkgs; [ pkgsCross.avr.libcCross pkgsCross.avr.buildPackages.binutils #pkgsCross.avr.buildPackages.gcc-unwrapped @@ -108,6 +154,10 @@ ATTINY_DFP = dfp; }; + # packages.bin = package { + # args = ""; + # }; + # devShells.default = pkgs.pkgsCross.avr.mkShell { # # # inputsFrom = [ (package { profile = "dev"; }) ]; diff --git a/rust-toolchain.toml b/rust-toolchain.toml index d2bfd14..b98c90e 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,7 +1,7 @@ # Before upgrading check that everything is available on all tier1 targets here: # https://rust-lang.github.io/rustup-components-history [toolchain] -channel = "nightly-2024-09-06" +channel = "nightly-2024-11-04" components = [ "rust-src", "llvm-tools", "rust-analyzer" ] profile = "minimal" target = "avr-specs/avr-attiny1616.json" diff --git a/turbowaker/Cargo.toml.patch b/turbowaker/Cargo.toml.patch new file mode 100644 index 0000000..8f14d2c --- /dev/null +++ b/turbowaker/Cargo.toml.patch @@ -0,0 +1,10 @@ +*** Cargo.toml.turbo-bak 2023-03-07 00:26:08.627557642 +0100 +--- Cargo.toml 2023-03-07 00:26:54.764578210 +0100 +@@ -36,6 +36,7 @@ optimize_for_size = [] + # Make `RefCell` store additional debugging information, which is printed out when + # a borrow error occurs + debug_refcell = [] ++turbowakers = [] + + [lints.rust.unexpected_cfgs] + level = "warn" diff --git a/turbowaker/wake.rs.patch b/turbowaker/wake.rs.patch new file mode 100644 index 0000000..a308daf --- /dev/null +++ b/turbowaker/wake.rs.patch @@ -0,0 +1,145 @@ +diff --git a/wake.rs.turbo-bak b/wake.rs +index 8fc942d..92fcfce 100644 +--- a/wake.rs.turbo-bak ++++ b/wake.rs +@@ -368,6 +368,9 @@ impl<'a> ContextBuilder<'a> { + #[cfg_attr(not(doc), repr(transparent))] // work around https://github.com/rust-lang/rust/issues/66401 + #[stable(feature = "futures_api", since = "1.36.0")] + pub struct Waker { ++ #[cfg(feature = "turbowakers")] ++ ptr: crate::ptr::NonNull<()>, ++ #[cfg(not(feature = "turbowakers"))] + waker: RawWaker, + } + +@@ -378,6 +381,9 @@ unsafe impl Send for Waker {} + #[stable(feature = "futures_api", since = "1.36.0")] + unsafe impl Sync for Waker {} + ++#[cfg(not(feature = "turbowakers"))] ++mod waker { ++use super::*; + impl Waker { + /// Wake up the task associated with this `Waker`. + /// +@@ -545,6 +551,120 @@ impl fmt::Debug for Waker { + } + } + ++} ++ ++ ++#[cfg(feature = "turbowakers")] ++mod waker { ++ use crate::ptr::NonNull; ++ ++ use super::*; ++ extern "Rust" { ++ fn _turbo_wake(ptr: NonNull<()>); ++ } ++ ++ impl Waker { ++ /// Wake up the task associated with this `Waker`. ++ /// ++ /// As long as the executor keeps running and the task is not finished, it is ++ /// guaranteed that each invocation of [`wake()`](Self::wake) (or ++ /// [`wake_by_ref()`](Self::wake_by_ref)) will be followed by at least one ++ /// [`poll()`] of the task to which this `Waker` belongs. This makes ++ /// it possible to temporarily yield to other tasks while running potentially ++ /// unbounded processing loops. ++ /// ++ /// Note that the above implies that multiple wake-ups may be coalesced into a ++ /// single [`poll()`] invocation by the runtime. ++ /// ++ /// Also note that yielding to competing tasks is not guaranteed: it is the ++ /// executor’s choice which task to run and the executor may choose to run the ++ /// current task again. ++ /// ++ /// [`poll()`]: crate::future::Future::poll ++ #[inline] ++ #[stable(feature = "futures_api", since = "1.36.0")] ++ pub fn wake(self) { ++ unsafe { _turbo_wake(self.ptr) } ++ } ++ ++ /// Wake up the task associated with this `Waker` without consuming the `Waker`. ++ /// ++ /// This is similar to [`wake()`](Self::wake), but may be slightly less efficient in ++ /// the case where an owned `Waker` is available. This method should be preferred to ++ /// calling `waker.clone().wake()`. ++ #[inline] ++ #[stable(feature = "futures_api", since = "1.36.0")] ++ pub fn wake_by_ref(&self) { ++ unsafe { _turbo_wake(self.ptr) } ++ } ++ ++ /// Returns `true` if this `Waker` and another `Waker` would awake the same task. ++ /// ++ /// This function works on a best-effort basis, and may return false even ++ /// when the `Waker`s would awaken the same task. However, if this function ++ /// returns `true`, it is guaranteed that the `Waker`s will awaken the same task. ++ /// ++ /// This function is primarily used for optimization purposes. ++ #[inline] ++ #[must_use] ++ #[stable(feature = "futures_api", since = "1.36.0")] ++ pub fn will_wake(&self, other: &Waker) -> bool { ++ self.ptr == other.ptr ++ } ++ ++ /// Creates a new `Waker` from [`RawWaker`]. ++ /// ++ /// The behavior of the returned `Waker` is undefined if the contract defined ++ /// in [`RawWaker`]'s and [`RawWakerVTable`]'s documentation is not upheld. ++ /// Therefore this method is unsafe. ++ #[inline] ++ #[must_use] ++ #[stable(feature = "futures_api", since = "1.36.0")] ++ #[rustc_const_stable(feature = "const_waker", since = "1.82.0")] ++ pub const unsafe fn from_raw(waker: RawWaker) -> Waker { ++ panic!("Waker::from_raw is unavailable due to enabling turbowakers."); ++ } ++ ++ /// Get a reference to the underlying [`RawWaker`]. ++ #[inline] ++ #[must_use] ++ #[unstable(feature = "waker_getters", issue = "87021")] ++ pub fn as_raw(&self) -> &RawWaker { ++ panic!("Waker::as_raw is unavailable due to enabling turbowakers."); ++ } ++ ++ #[inline] ++ #[must_use] ++ #[stable(feature = "futures_api", since = "1.36.0")] ++ #[rustc_const_stable(feature = "const_waker", since = "1.82.0")] ++ pub const unsafe fn from_turbo_ptr(ptr: NonNull<()>) -> Waker { ++ Self { ptr } ++ } ++ ++ #[inline] ++ #[must_use] ++ #[stable(feature = "futures_api", since = "1.36.0")] ++ pub fn as_turbo_ptr(&self) -> NonNull<()> { ++ self.ptr ++ } ++ } ++ ++ #[stable(feature = "futures_api", since = "1.36.0")] ++ impl Clone for Waker { ++ #[inline] ++ fn clone(&self) -> Self { ++ Self { ptr: self.ptr } ++ } ++ } ++ ++ #[stable(feature = "futures_api", since = "1.36.0")] ++ impl fmt::Debug for Waker { ++ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { ++ f.debug_struct("Waker").field("data", &self.ptr).finish() ++ } ++ } ++} ++ + /// A `LocalWaker` is analogous to a [`Waker`], but it does not implement [`Send`] or [`Sync`]. + /// + /// This handle encapsulates a [`RawWaker`] instance, which defines the