diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 9e12541..3c03a1f 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -89,7 +89,7 @@ USER ${USERNAME} RUN umask 0002 && \ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \ | sh -s -- -y --no-modify-path && \ - rustup update stable && \ + rustup install 1.85.0 && \ rustup component add rust-src llvm-tools-preview && \ cargo install cargo-binutils && \ rustup target add thumbv7em-none-eabihf thumbv7em-none-eabi @@ -98,6 +98,7 @@ RUN cargo install --locked kani-verifier && \ cargo kani setup RUN cargo install --locked cargo-tarpaulin RUN cargo install --locked cargo-watch +RUN cargo install --force cbindgen COPY --from=qemu-builder /usr/local/ /usr/local/ diff --git a/Cargo.lock b/Cargo.lock index 645535f..ab8ea36 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12,30 +12,54 @@ dependencies = [ ] [[package]] -name = "ansi_term" -version = "0.12.1" +name = "anstream" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" dependencies = [ - "winapi", + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", ] [[package]] -name = "atty" -version = "0.2.14" +name = "anstyle" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" + +[[package]] +name = "anstyle-parse" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" dependencies = [ - "hermit-abi", - "libc", - "winapi", + "utf8parse", ] [[package]] -name = "autocfg" -version = "1.4.0" +name = "anstyle-query" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" +dependencies = [ + "anstyle", + "once_cell", + "windows-sys", +] [[package]] name = "bindgen" @@ -43,7 +67,7 @@ version = "0.69.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" dependencies = [ - "bitflags 2.8.0", + "bitflags", "cexpr", "clang-sys", "itertools", @@ -56,7 +80,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.98", + "syn", "which", ] @@ -68,56 +92,25 @@ checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" [[package]] name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36" - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" [[package]] name = "cbindgen" -version = "0.18.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97449daf9b8c245bcad10bbc7c9f4a37c06172c18dd5f9fac340deefc309b957" +checksum = "eadd868a2ce9ca38de7eeafdcec9c7065ef89b42b32f0839278d55f35c54d1ff" dependencies = [ - "clap 2.34.0", - "heck 0.3.3", + "clap", + "heck", "indexmap", "log", "proc-macro2", "quote", "serde", "serde_json", - "syn 1.0.109", - "tempfile", - "toml", -] - -[[package]] -name = "cbindgen" -version = "0.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da6bc11b07529f16944307272d5bd9b22530bc7d05751717c9d416586cedab49" -dependencies = [ - "clap 3.2.25", - "heck 0.4.1", - "indexmap", - "log", - "proc-macro2", - "quote", - "serde", - "serde_json", - "syn 1.0.109", + "syn", "tempfile", "toml", ] @@ -150,42 +143,36 @@ dependencies = [ [[package]] name = "clap" -version = "2.34.0" +version = "4.5.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +checksum = "6088f3ae8c3608d19260cd7445411865a485688711b78b5be70d78cd96136f83" dependencies = [ - "ansi_term", - "atty", - "bitflags 1.3.2", - "strsim 0.8.0", - "textwrap 0.11.0", - "unicode-width", - "vec_map", + "clap_builder", ] [[package]] -name = "clap" -version = "3.2.25" +name = "clap_builder" +version = "4.5.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" +checksum = "22a7ef7f676155edfb82daa97f99441f3ebf4a58d5e32f295a56259f1b6facc8" dependencies = [ - "atty", - "bitflags 1.3.2", + "anstream", + "anstyle", "clap_lex", - "indexmap", - "strsim 0.10.0", - "termcolor", - "textwrap 0.16.1", + "strsim", ] [[package]] name = "clap_lex" -version = "0.2.4" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" -dependencies = [ - "os_str_bytes", -] +checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" + +[[package]] +name = "colorchoice" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "cortex-m" @@ -197,9 +184,15 @@ dependencies = [ [[package]] name = "either" -version = "1.13.0" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "equivalent" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "errno" @@ -250,24 +243,15 @@ checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" name = "hal" version = "0.1.0" dependencies = [ - "cbindgen 0.18.0", + "cbindgen", "cortex-m", ] [[package]] name = "hashbrown" -version = "0.12.3" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "heck" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" [[package]] name = "heck" @@ -275,15 +259,6 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - [[package]] name = "home" version = "0.5.11" @@ -295,14 +270,20 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.3" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" dependencies = [ - "autocfg", + "equivalent", "hashbrown", ] +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + [[package]] name = "itertools" version = "0.12.1" @@ -314,21 +295,21 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "kernel" version = "0.1.0" dependencies = [ "bindgen", - "cbindgen 0.26.0", + "cbindgen", "hal", "macros", "quote", "rand", - "syn 2.0.98", + "syn", "walkdir", ] @@ -346,9 +327,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.169" +version = "0.2.171" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" +checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" [[package]] name = "libloading" @@ -366,18 +347,24 @@ version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" +[[package]] +name = "linux-raw-sys" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db9c683daf087dc577b7506e9695b3d556a9f3849903fa28186283afd6809e9" + [[package]] name = "log" -version = "0.4.25" +version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" +checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e" [[package]] name = "macros" version = "0.1.0" dependencies = [ "quote", - "syn 2.0.98", + "syn", ] [[package]] @@ -404,49 +391,43 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e" - -[[package]] -name = "os_str_bytes" -version = "6.6.1" +version = "1.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" +checksum = "d75b0bedcc4fe52caa0e03d9f1151a323e4aa5e2d78ba3580400cd3c9e2bc4bc" [[package]] name = "ppv-lite86" -version = "0.2.20" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" dependencies = [ "zerocopy", ] [[package]] name = "prettyplease" -version = "0.2.29" +version = "0.2.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6924ced06e1f7dfe3fa48d57b9f74f55d8915f5036121bef647ef4b204895fac" +checksum = "5316f57387668042f561aae71480de936257848f9c43ce528e311d89a07cadeb" dependencies = [ "proc-macro2", - "syn 2.0.98", + "syn", ] [[package]] name = "proc-macro2" -version = "1.0.93" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" +checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.38" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] @@ -522,18 +503,31 @@ version = "0.38.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" dependencies = [ - "bitflags 2.8.0", + "bitflags", "errno", "libc", - "linux-raw-sys", + "linux-raw-sys 0.4.15", + "windows-sys", +] + +[[package]] +name = "rustix" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7178faa4b75a30e269c71e61c353ce2748cf3d76f0c44c393f4e60abf49b825" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys 0.9.2", "windows-sys", ] [[package]] name = "ryu" -version = "1.0.19" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea1a2d0a644769cc99faa24c3ad26b379b786fe7c36fd3c546254801650e6dd" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] name = "same-file" @@ -546,29 +540,29 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.217" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.217" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.98", + "syn", ] [[package]] name = "serde_json" -version = "1.0.138" +version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d434192e7da787e94a6ea7e9670b26a036d0ca41e0b7efb2676dd32bae872949" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" dependencies = [ "itoa", "memchr", @@ -577,39 +571,31 @@ dependencies = [ ] [[package]] -name = "shlex" -version = "1.3.0" +name = "serde_spanned" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +dependencies = [ + "serde", +] [[package]] -name = "strsim" -version = "0.8.0" +name = "shlex" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "1.0.109" +version = "2.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.98" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1" +checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" dependencies = [ "proc-macro2", "quote", @@ -618,74 +604,63 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.16.0" +version = "3.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38c246215d7d24f48ae091a2902398798e05d978b24315d6efbc00ede9a8bb91" +checksum = "2c317e0a526ee6120d8dabad239c8dadca62b24b6f168914bbbc8e2fb1f0e567" dependencies = [ "cfg-if", "fastrand", "getrandom 0.3.1", "once_cell", - "rustix", + "rustix 1.0.2", "windows-sys", ] [[package]] -name = "termcolor" -version = "1.4.1" +name = "toml" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148" dependencies = [ - "winapi-util", + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", ] [[package]] -name = "textwrap" -version = "0.11.0" +name = "toml_datetime" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" dependencies = [ - "unicode-width", + "serde", ] [[package]] -name = "textwrap" -version = "0.16.1" +name = "toml_edit" +version = "0.22.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" - -[[package]] -name = "toml" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" dependencies = [ + "indexmap", "serde", + "serde_spanned", + "toml_datetime", + "winnow", ] [[package]] name = "unicode-ident" -version = "1.0.16" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a210d160f08b701c8721ba1c726c11662f877ea6b7094007e1ca9a1041945034" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] -name = "unicode-segmentation" -version = "1.12.0" +name = "utf8parse" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" - -[[package]] -name = "unicode-width" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" - -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "walkdir" @@ -721,25 +696,9 @@ dependencies = [ "either", "home", "once_cell", - "rustix", + "rustix 0.38.44", ] -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - [[package]] name = "winapi-util" version = "0.1.9" @@ -749,12 +708,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - [[package]] name = "windows-sys" version = "0.59.0" @@ -828,32 +781,40 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "winnow" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e97b544156e9bebe1a0ffbc03484fc1ffe3100cbce3ffb17eac35f7cdd7ab36" +dependencies = [ + "memchr", +] + [[package]] name = "wit-bindgen-rt" version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c" dependencies = [ - "bitflags 2.8.0", + "bitflags", ] [[package]] name = "zerocopy" -version = "0.7.35" +version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +checksum = "fd97444d05a4328b90e75e503a34bad781f14e28a823ad3557f0750df1ebcbc6" dependencies = [ - "byteorder", "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.35" +version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +checksum = "6352c01d0edd5db859a63e2605f4ea3183ddbd15e2c4a9e7d32184df75e4f154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.98", + "syn", ] diff --git a/hal/stm32l4 b/hal/stm32l4 index 47c2610..8244a6a 160000 --- a/hal/stm32l4 +++ b/hal/stm32l4 @@ -1 +1 @@ -Subproject commit 47c261032ae2f565304659b8429125aaefa5846e +Subproject commit 8244a6a5ff9f14b8ee288d350467b151089a8bf4 diff --git a/kernel/Cargo.toml.in b/kernel/Cargo.toml.in index cc8636f..ce1e32d 100644 --- a/kernel/Cargo.toml.in +++ b/kernel/Cargo.toml.in @@ -1,7 +1,7 @@ [package] name = "kernel" version = "0.1.0" -edition = "2021" +edition = "2024" [lib] crate-type = ["staticlib"] @@ -11,11 +11,11 @@ hal = { path = "@HAL_DIR@", features = ["panic-semih", "panic-exit"] } macros = { path = "macros" } [build-dependencies] -cbindgen = "0.26.0" +cbindgen = "0.28.0" bindgen = "0.69.5" walkdir = "2.5.0" -syn = "2.0.90" -quote = "1.0.37" +syn = "2.0.100" +quote = "1.0.40" rand = "0.8.5" [profile.dev] diff --git a/kernel/build.rs b/kernel/build.rs index bd15cf2..a94836c 100644 --- a/kernel/build.rs +++ b/kernel/build.rs @@ -15,30 +15,6 @@ fn main() { println!("cargo:rerun-if-changed=src"); println!("cargo:rerun-if-changed=build.rs"); - let crate_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap(); - - let mut config: cbindgen::Config = Default::default(); - - config.no_includes = true; - config.includes = vec![ - "stdint.h".to_string(), - "stdbool.h".to_string(), - "stdarg.h".to_string(), - ]; - config.layout = LayoutConfig { - packed: Some("__attribute__((packed))".to_string()), - ..Default::default() - }; - - cbindgen::Builder::new() - .with_crate(crate_dir) - .with_config(config) - .with_language(cbindgen::Language::C) - .with_include_guard("KERNEL_H") - .generate() - .expect("Unable to generate bindings") - .write_to_file("include/kernel/lib.h"); - generate_syscall_map("src").expect("Failed to generate syscall map."); } diff --git a/kernel/include/kernel/lib.h b/kernel/include/kernel/lib.h index cbb9907..ba033e7 100644 --- a/kernel/include/kernel/lib.h +++ b/kernel/include/kernel/lib.h @@ -59,14 +59,4 @@ typedef struct BootInfo { */ void kernel_init(const struct BootInfo *boot_info); -void syscall_dummy(const void *svc_args); - -/** - * Syscall handler: reschedule. - * This syscall is used to request a reschedule. - * - * No arguments are passed to this syscall. - */ -void syscall_reschedule(const void *_svc_args); - -#endif /* KERNEL_H */ +#endif /* KERNEL_H */ diff --git a/kernel/macros/Cargo.toml b/kernel/macros/Cargo.toml index 3071198..0e39f17 100644 --- a/kernel/macros/Cargo.toml +++ b/kernel/macros/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" proc-macro = true [dependencies] -quote = "1.0.38" -syn = "2.0.94" +quote = "1.0.40" +syn = "2.0.100" diff --git a/kernel/src/lib.rs b/kernel/src/lib.rs index 4c04a92..b3887db 100644 --- a/kernel/src/lib.rs +++ b/kernel/src/lib.rs @@ -12,7 +12,7 @@ mod services; mod syscalls; mod uspace; -use core::ffi::{c_char, CStr}; +use core::ffi::{CStr, c_char}; /// The memory map entry type. /// @@ -46,9 +46,9 @@ pub struct BootInfo { /// The kernel initialization function. /// /// `boot_info` - The boot information. -#[no_mangle] +#[unsafe(no_mangle)] pub unsafe extern "C" fn kernel_init(boot_info: *const BootInfo) { - let boot_info = &*boot_info; + let boot_info = unsafe { &*boot_info }; let implementer = unsafe { CStr::from_ptr(boot_info.implementer) }; let variant = unsafe { CStr::from_ptr(boot_info.variant) }; diff --git a/kernel/src/mem.rs b/kernel/src/mem.rs index 37651a1..ef058fb 100644 --- a/kernel/src/mem.rs +++ b/kernel/src/mem.rs @@ -1,6 +1,6 @@ //! This module provides access to the global memory allocator. -use crate::{utils, BootInfo}; +use crate::{BootInfo, utils}; use alloc::Allocator; use core::ptr::NonNull; use hal::common::sync::SpinLocked; @@ -74,7 +74,7 @@ pub fn malloc(size: usize, align: usize) -> Option> { /// The caller must ensure that the pointer is from a previous call to `malloc` and that the size is still the same. pub unsafe fn free(ptr: NonNull, size: usize) { let mut allocator = GLOBAL_ALLOCATOR.lock(); - allocator.free(ptr, size); + unsafe { allocator.free(ptr, size) }; } /// Aligns a size to be a multiple of the u128 alignment. diff --git a/kernel/src/mem/alloc.rs b/kernel/src/mem/alloc.rs index 0a7d0b8..3dfcc5f 100644 --- a/kernel/src/mem/alloc.rs +++ b/kernel/src/mem/alloc.rs @@ -3,7 +3,7 @@ use core::{ops::Range, ptr::NonNull}; -use crate::{utils, BUG_ON}; +use crate::{BUG_ON, utils}; #[cfg(target_pointer_width = "64")] const MAX_ADDR: usize = 2_usize.pow(48); @@ -87,7 +87,7 @@ impl BestFitAllocator { }; // Write the header to the memory. - core::ptr::write(ptr as *mut BestFitMeta, meta); + unsafe { core::ptr::write(ptr as *mut BestFitMeta, meta) }; // Set the head to the new block. self.head = Some(unsafe { NonNull::new_unchecked(ptr as *mut u8) }); @@ -152,7 +152,7 @@ impl BestFitAllocator { (ptr.as_ptr() as usize) <= isize::MAX as usize - size_of::() - Self::align_up() ); - ptr.byte_add(size_of::() + Self::align_up()) + unsafe { ptr.byte_add(size_of::() + Self::align_up()) } } /// Calculates the control pointer from the user pointer. @@ -166,7 +166,7 @@ impl BestFitAllocator { /// The ptr must be a valid user pointer. Note: After the allocator which allocated the pointer is dropped, the user pointer is always considered invalid. unsafe fn control_ptr(ptr: NonNull) -> NonNull { debug_assert!((ptr.as_ptr() as usize) > size_of::() + Self::align_up()); - ptr.byte_sub(size_of::() + Self::align_up()) + unsafe { ptr.byte_sub(size_of::() + Self::align_up()) } } } @@ -286,8 +286,8 @@ impl Allocator for BestFitAllocator { /// `ptr` - The pointer to the block. /// `size` - The size of the block. (This is used to check if the size of the block is correct.) unsafe fn free(&mut self, ptr: NonNull, size: usize) { - let block = Self::control_ptr(ptr); - let meta = block.cast::().as_mut(); + let block = unsafe { Self::control_ptr(ptr) }; + let meta = unsafe { block.cast::().as_mut() }; // The next block of a free block is always the current head. We essentially insert the block at the beginning of the list. meta.next = self.head; diff --git a/kernel/src/mem/boxed.rs b/kernel/src/mem/boxed.rs index 629c637..75c3c7b 100644 --- a/kernel/src/mem/boxed.rs +++ b/kernel/src/mem/boxed.rs @@ -3,9 +3,9 @@ use super::{free, malloc}; use crate::utils::KernelError; use core::{ - mem::{forget, MaybeUninit}, + mem::{MaybeUninit, forget}, ops::{Deref, DerefMut, Index, IndexMut, Range, RangeFrom, RangeTo}, - ptr::{drop_in_place, slice_from_raw_parts_mut, write, NonNull}, + ptr::{NonNull, drop_in_place, slice_from_raw_parts_mut, write}, }; /// A heap-allocated memory block. diff --git a/kernel/src/mem/pool.rs b/kernel/src/mem/pool.rs index 05c9d15..5dd1998 100644 --- a/kernel/src/mem/pool.rs +++ b/kernel/src/mem/pool.rs @@ -72,7 +72,7 @@ impl SizedPool { write(ptr as *mut SizedPoolMeta, meta); } - self.head = Some(NonZeroUsize::new_unchecked(ptr)); + self.head = Some(unsafe { NonZeroUsize::new_unchecked(ptr) }); } /// Allocate a block from the pool. diff --git a/kernel/src/sched/scheduler.rs b/kernel/src/sched/scheduler.rs index cb02c3a..bb07063 100644 --- a/kernel/src/sched/scheduler.rs +++ b/kernel/src/sched/scheduler.rs @@ -180,7 +180,7 @@ impl Scheduler { /// cbindgen:ignore /// cbindgen:no-export -#[no_mangle] +#[unsafe(no_mangle)] pub extern "C" fn sched_enter(ctx: CtxPtr) -> CtxPtr { { let mut scheduler = SCHEDULER.lock(); @@ -195,7 +195,7 @@ pub extern "C" fn sched_enter(ctx: CtxPtr) -> CtxPtr { /// cbindgen:ignore /// cbindgen:no-export -#[no_mangle] +#[unsafe(no_mangle)] pub extern "C" fn systick() { let resched = { let mut scheduler = SCHEDULER.lock(); diff --git a/kernel/src/syscalls/dummy.rs b/kernel/src/syscalls/dummy.rs index 35fe803..2b33e50 100644 --- a/kernel/src/syscalls/dummy.rs +++ b/kernel/src/syscalls/dummy.rs @@ -2,7 +2,7 @@ use core::ffi::c_void; use macros::syscall_handler; -#[no_mangle] +#[unsafe(no_mangle)] #[syscall_handler(args = 1, num = 1)] extern "C" fn syscall_dummy(svc_args: *const c_void) { let num = unsafe { *(svc_args as *const i32) }; diff --git a/kernel/src/syscalls/tasks.rs b/kernel/src/syscalls/tasks.rs index cf27ecd..bc2df43 100644 --- a/kernel/src/syscalls/tasks.rs +++ b/kernel/src/syscalls/tasks.rs @@ -9,7 +9,7 @@ use macros::syscall_handler; /// This syscall is used to request a reschedule. /// /// No arguments are passed to this syscall. -#[no_mangle] +#[unsafe(no_mangle)] #[syscall_handler(args = 0, num = 1)] extern "C" fn syscall_reschedule(_svc_args: *const c_void) { let _ = hal::hprintln!("debug: reschedule requested."); diff --git a/kernel/src/uspace/util.rs b/kernel/src/uspace/util.rs index 75643b4..418f109 100644 --- a/kernel/src/uspace/util.rs +++ b/kernel/src/uspace/util.rs @@ -6,8 +6,8 @@ use crate::sched; #[macro_export] macro_rules! DECLARE_TASK { (mem_size: $mem_size:expr, stack_size: $stack_size:expr, name: $name:ident) => { - const TASK_ ## $name ## _MEM_SIZE: usize = $mem_size; - const TASK_ ## $name ## _STACK_SIZE: usize = $stack_size; + const TASK_ # # $name # # _MEM_SIZE: usize = $mem_size; + const TASK_ # # $name # # _STACK_SIZE: usize = $stack_size; }; }