diff --git a/.github/workflows/build-ferrocene.yml b/.github/workflows/build-ferrocene.yml index 91e898f..b4335b5 100644 --- a/.github/workflows/build-ferrocene.yml +++ b/.github/workflows/build-ferrocene.yml @@ -83,18 +83,4 @@ jobs: with: name: qemu-cortex-r5-app path: qemu-cortex-r5-app/target/armv7r-none-eabihf/release/qemu-cortex-r5-app - job-build-threadx-sys: - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@v4 - with: - submodules: 'true' - - name: Check threadx-sys - run: | - cd threadx-sys - cargo check - - name: Build threadx-sys - run: | - cd threadx-sys - cargo build + diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 768b397..0862bf7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -71,18 +71,4 @@ jobs: with: name: qemu-cortex-r5-app path: qemu-cortex-r5-app/target/armv7r-none-eabihf/release/qemu-cortex-r5-app - job-build-threadx-sys: - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@v4 - with: - submodules: 'true' - - name: Check threadx-sys - run: | - cd threadx-sys - cargo check - - name: Build threadx-sys - run: | - cd threadx-sys - cargo build + diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index b085053..549fb51 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -43,16 +43,3 @@ jobs: run: | cd qemu-cortex-r5-app cargo clippy --all-features - job-clippy-threadx-sys: - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@v4 - with: - submodules: 'true' - - name: Check Clippy on threadx-sys - env: - RUSTFLAGS: "-Dwarnings" - run: | - cd threadx-sys - cargo clippy --all-features diff --git a/README.md b/README.md index 73311b5..2a44823 100644 --- a/README.md +++ b/README.md @@ -24,5 +24,5 @@ Thus repository contains: ## Licence -* Copyright (c) 2025 Ferrous Systems +* Copyright (c) 2026 Ferrous Systems * SPDX-License-Identifier: MIT OR Apache-2.0 diff --git a/criticalup.toml b/criticalup.toml index 2281379..71b9fd4 100644 --- a/criticalup.toml +++ b/criticalup.toml @@ -4,7 +4,7 @@ manifest-version = 1 [products.ferrocene] -release = "stable-25.05.0" +release = "stable-26.02.0" packages = [ "rustc-${rustc-host}", "rust-std-${rustc-host}", diff --git a/nrf52-app/Cargo.lock b/nrf52-app/Cargo.lock index e51ae98..859b136 100644 --- a/nrf52-app/Cargo.lock +++ b/nrf52-app/Cargo.lock @@ -4,33 +4,18 @@ version = 4 [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" dependencies = [ "memchr", ] -[[package]] -name = "atomic-polyfill" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3ff7eb3f316534d83a8a2c3d1674ace8a5a71198eba31e2e2b597833f699b28" -dependencies = [ - "critical-section", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - [[package]] name = "az" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973" +checksum = "be5eb007b7cacc6c660343e96f650fedf4b5a77512399eb952ca6642cf8d13f7" [[package]] name = "bare-metal" @@ -38,30 +23,27 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3" dependencies = [ - "rustc_version 0.2.3", + "rustc_version", ] [[package]] name = "bindgen" -version = "0.69.1" +version = "0.72.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ffcebc3849946a7170a05992aac39da343a90676ab392c51a4280981d6379c2" +checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.11.0", "cexpr", "clang-sys", - "lazy_static", - "lazycell", + "itertools", "log", - "peeking_take_while", "prettyplease", "proc-macro2", "quote", "regex", "rustc-hash", "shlex", - "syn 2.0.37", - "which", + "syn", ] [[package]] @@ -78,9 +60,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" [[package]] name = "byte-strings" @@ -99,20 +81,20 @@ checksum = "62f7e0e71f98d6c71bfe42b0a7a47d0f870ad808401fad2d44fa156ed5b0ae03" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn", ] [[package]] name = "bytemuck" -version = "1.14.0" +version = "1.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" +checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "cast" @@ -122,11 +104,12 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.0.83" +version = "1.2.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +checksum = "e1e928d4b69e3077709075a938a05ffbedfa53a84c8f766efbf8220bb1ff60e1" dependencies = [ - "libc", + "find-msvc-tools", + "shlex", ] [[package]] @@ -140,15 +123,15 @@ dependencies = [ [[package]] name = "cfg-if" -version = "1.0.0" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "clang-sys" -version = "1.6.1" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" dependencies = [ "glob", "libc", @@ -164,28 +147,28 @@ dependencies = [ "bare-metal", "bitfield", "critical-section", - "embedded-hal", + "embedded-hal 0.2.7", "volatile-register", ] [[package]] name = "cortex-m-rt" -version = "0.7.3" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee84e813d593101b1723e13ec38b6ab6abbdbaaa4546553f5395ed274079ddb1" +checksum = "801d4dec46b34c299ccf6b036717ae0fce602faa4f4fe816d9013b9a7c9f5ba6" dependencies = [ "cortex-m-rt-macros", ] [[package]] name = "cortex-m-rt-macros" -version = "0.7.0" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f6f3e36f203cfedbc78b357fb28730aa2c6dc1ab060ee5c2405e843988d3c7" +checksum = "e37549a379a9e0e6e576fd208ee60394ccb8be963889eebba3ffe0980364f472" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn", ] [[package]] @@ -196,15 +179,15 @@ checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" [[package]] name = "crunchy" -version = "0.2.2" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" [[package]] name = "defmt" -version = "0.3.5" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8a2d011b2fee29fb7d659b83c43fce9a2cb4df453e16d441a51448e448f3f98" +checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" dependencies = [ "bitflags 1.3.2", "defmt-macros", @@ -212,31 +195,31 @@ dependencies = [ [[package]] name = "defmt-macros" -version = "0.3.6" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54f0216f6c5acb5ae1a47050a6645024e6edafc2ee32d421955eccfef12ef92e" +checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" dependencies = [ "defmt-parser", - "proc-macro-error", + "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.37", + "syn", ] [[package]] name = "defmt-parser" -version = "0.3.3" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "269924c02afd7f94bc4cecbfa5c379f6ffcf9766b3408fe63d22c728654eccd0" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" dependencies = [ "thiserror", ] [[package]] name = "defmt-rtt" -version = "0.4.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "609923761264dd99ed9c7d209718cda4631c5fe84668e0f0960124cbb844c49f" +checksum = "93d5a25c99d89c40f5676bec8cefe0614f17f0f40e916f98e345dae941807f9e" dependencies = [ "critical-section", "defmt", @@ -244,9 +227,9 @@ dependencies = [ [[package]] name = "either" -version = "1.9.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" [[package]] name = "embedded-dma" @@ -267,27 +250,35 @@ dependencies = [ "void", ] +[[package]] +name = "embedded-hal" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" + +[[package]] +name = "embedded-io" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9eb1aa714776b75c7e67e1da744b81a129b3ff919c8712b5e1b32252c1f07cc7" + [[package]] name = "embedded-storage" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "156d7a2fdd98ebbf9ae579cbceca3058cff946e13f8e17b90e3511db0508c723" +checksum = "a21dea9854beb860f3062d10228ce9b976da520a73474aed3171ec276bc0c032" [[package]] -name = "errno" -version = "0.3.8" +name = "find-msvc-tools" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" [[package]] name = "fixed" -version = "1.24.0" +version = "1.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02c69ce7e7c0f17aa18fdd9d0de39727adb9c6281f2ad12f57cbe54ae6e76e7d" +checksum = "c566da967934c6c7ee0458a9773de9b2a685bd2ce26a3b28ddfc740e640182f5" dependencies = [ "az", "bytemuck", @@ -297,106 +288,86 @@ dependencies = [ [[package]] name = "glob" -version = "0.3.1" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" [[package]] name = "half" -version = "2.3.1" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc52e53916c08643f1b56ec082790d1e86a32e58dc5268f897f313fbae7b4872" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" dependencies = [ "cfg-if", "crunchy", + "zerocopy", ] [[package]] name = "hash32" -version = "0.2.1" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" +checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" dependencies = [ "byteorder", ] [[package]] name = "heapless" -version = "0.7.16" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db04bc24a18b9ea980628ecf00e6c0264f3c1426dac36c00cb49b6fbad8b0743" +checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" dependencies = [ - "atomic-polyfill", "hash32", - "rustc_version 0.4.0", - "spin", "stable_deref_trait", ] [[package]] -name = "home" -version = "0.5.5" +name = "heapless" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +checksum = "2af2455f757db2b292a9b1768c4b70186d443bcb3b316252d6b540aec1cd89ed" dependencies = [ - "windows-sys 0.48.0", + "hash32", + "stable_deref_trait", ] [[package]] -name = "lazy_static" -version = "1.4.0" +name = "itertools" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] [[package]] name = "libc" -version = "0.2.150" +version = "0.2.184" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" +checksum = "48f5d2a454e16a5ea0f4ced81bd44e4cfc7bd3a507b61887c99fd3538b28e4af" [[package]] name = "libloading" -version = "0.7.4" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" dependencies = [ "cfg-if", - "winapi", -] - -[[package]] -name = "linux-raw-sys" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" - -[[package]] -name = "lock_api" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" -dependencies = [ - "autocfg", - "scopeguard", + "windows-link", ] [[package]] name = "log" -version = "0.4.20" +version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" [[package]] name = "memchr" -version = "2.6.4" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" [[package]] name = "minimal-lexical" @@ -431,15 +402,17 @@ dependencies = [ [[package]] name = "nrf-hal-common" -version = "0.16.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd244c63d588066d75cffdcae8a03299fd5fb272e36bdde4a9f922f3e4bc6e4b" +checksum = "9d8100d0bf6d732ea9b0a294fa2d2dad9cba4fbc5bb655d0afaa984d03d528fe" dependencies = [ "cast", "cfg-if", "cortex-m", "embedded-dma", - "embedded-hal", + "embedded-hal 0.2.7", + "embedded-hal 1.0.0", + "embedded-io", "embedded-storage", "fixed", "nb 1.1.0", @@ -451,9 +424,9 @@ dependencies = [ [[package]] name = "nrf-usbd" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66b2907c0b3ec4d264981c1fc5a2321d51c463d5a63d386e573f00e84d5495e6" +checksum = "aedf862f941154442271ae9914777bd1c93f6d2e0dc9db4cafa160e55ffb9085" dependencies = [ "cortex-m", "critical-section", @@ -472,8 +445,9 @@ dependencies = [ "critical-section", "defmt", "defmt-rtt", - "embedded-hal", - "heapless", + "embedded-hal 0.2.7", + "fixed", + "heapless 0.9.2", "nrf52840-hal", "panic-probe", "static_cell", @@ -482,11 +456,10 @@ dependencies = [ [[package]] name = "nrf52840-hal" -version = "0.16.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b54757ec98f38331889d1d6c535edb5dd543c762751abfe507f2d644b30f6d4f" +checksum = "2297dc31df743012c721033a962ae21813611ee6b8062577b36031baa641d331" dependencies = [ - "embedded-hal", "nrf-hal-common", "nrf52840-pac", ] @@ -502,97 +475,83 @@ dependencies = [ "vcell", ] -[[package]] -name = "once_cell" -version = "1.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" - [[package]] name = "panic-probe" -version = "0.3.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa6fa5645ef5a760cd340eaa92af9c1ce131c8c09e7f8926d8a24b59d26652b9" +checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" dependencies = [ "cortex-m", "defmt", ] -[[package]] -name = "peeking_take_while" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" - [[package]] name = "portable-atomic" -version = "1.6.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" +checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" [[package]] name = "prettyplease" -version = "0.2.15" +version = "0.2.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn 2.0.37", + "syn", ] [[package]] -name = "proc-macro-error" -version = "1.0.4" +name = "proc-macro-error-attr2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" dependencies = [ - "proc-macro-error-attr", "proc-macro2", "quote", - "syn 1.0.109", - "version_check", ] [[package]] -name = "proc-macro-error-attr" -version = "1.0.4" +name = "proc-macro-error2" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" dependencies = [ + "proc-macro-error-attr2", "proc-macro2", "quote", - "version_check", + "syn", ] [[package]] name = "proc-macro2" -version = "1.0.67" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.33" +version = "1.0.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" dependencies = [ "proc-macro2", ] [[package]] name = "rand_core" -version = "0.6.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" [[package]] name = "regex" -version = "1.10.2" +version = "1.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" dependencies = [ "aho-corasick", "memchr", @@ -602,9 +561,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" dependencies = [ "aho-corasick", "memchr", @@ -613,15 +572,15 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" [[package]] name = "rustc-hash" -version = "1.1.0" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe" [[package]] name = "rustc_version" @@ -629,37 +588,9 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" dependencies = [ - "semver 0.9.0", -] - -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver 1.0.19", + "semver", ] -[[package]] -name = "rustix" -version = "0.38.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e" -dependencies = [ - "bitflags 2.4.1", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.48.0", -] - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - [[package]] name = "semver" version = "0.9.0" @@ -669,12 +600,6 @@ dependencies = [ "semver-parser", ] -[[package]] -name = "semver" -version = "1.0.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad977052201c6de01a8ef2aa3378c4bd23217a056337d1d6da40468d267a4fb0" - [[package]] name = "semver-parser" version = "0.7.0" @@ -687,46 +612,26 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" -[[package]] -name = "spin" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" -dependencies = [ - "lock_api", -] - [[package]] name = "stable_deref_trait" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "static_cell" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa6ba4cf83bf80d3eb25f098ea5e790a0a1fcb5e357442259b231e412c2d3ca0" +checksum = "0530892bb4fa575ee0da4b86f86c667132a94b74bb72160f58ee5a4afec74c23" dependencies = [ "portable-atomic", ] [[package]] name = "syn" -version = "1.0.109" +version = "2.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" dependencies = [ "proc-macro2", "quote", @@ -735,22 +640,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.49" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.49" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn", ] [[package]] @@ -762,21 +667,25 @@ dependencies = [ [[package]] name = "typenum" -version = "1.17.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" [[package]] name = "usb-device" -version = "0.2.9" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f6cc3adc849b5292b4075fc0d5fdcf2f24866e88e336dd27a8943090a520508" +checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" +dependencies = [ + "heapless 0.8.0", + "portable-atomic", +] [[package]] name = "vcell" @@ -784,12 +693,6 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - [[package]] name = "void" version = "1.0.2" @@ -798,175 +701,35 @@ checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "volatile-register" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ee8f19f9d74293faf70901bc20ad067dc1ad390d2cbf1e3f75f721ffee908b6" +checksum = "de437e2a6208b014ab52972a27e59b33fa2920d3e00fe05026167a1c509d19cc" dependencies = [ "vcell", ] [[package]] -name = "which" -version = "4.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" -dependencies = [ - "either", - "home", - "once_cell", - "rustix", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-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.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" +name = "windows-link" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.0", -] +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" [[package]] -name = "windows-targets" -version = "0.48.5" +name = "zerocopy" +version = "0.8.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9" dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", + "zerocopy-derive", ] [[package]] -name = "windows-targets" -version = "0.52.0" +name = "zerocopy-derive" +version = "0.8.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "proc-macro2", + "quote", + "syn", ] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" diff --git a/nrf52-app/Cargo.toml b/nrf52-app/Cargo.toml index be9a1aa..d079dd3 100644 --- a/nrf52-app/Cargo.toml +++ b/nrf52-app/Cargo.toml @@ -3,7 +3,7 @@ [package] authors = ["Jonathan Pallant "] -edition = "2021" +edition = "2024" license = "MIT OR Apache-2.0" name = "nrf52-app" version = "0.0.0" @@ -12,16 +12,17 @@ description = "Rust ThreadX demo on nRF52840" [dependencies] cortex-m = {version = "0.7", features = ["critical-section-single-core"]} cortex-m-rt = "0.7" -nrf52840-hal = "0.16" -heapless = "0.7" -panic-probe = { version = "0.3", features = ["print-defmt"] } -defmt = "0.3.5" -defmt-rtt = "0.4" +nrf52840-hal = "0.19" +heapless = "0.9" +panic-probe = { version = "1.0", features = ["print-defmt"] } +defmt = "1.0" +defmt-rtt = "1.0" threadx-sys = { path = "../threadx-sys" } byte-strings = "0.3.1" static_cell = "2.0.0" critical-section = "1.2.0" embedded-hal = "0.2" +fixed = "=1.30" # optimize code in both profiles [profile.dev] diff --git a/nrf52-app/README.md b/nrf52-app/README.md index 8f14112..12c4d9a 100644 --- a/nrf52-app/README.md +++ b/nrf52-app/README.md @@ -7,6 +7,24 @@ This application is for the [nRF52840-DK], which includes an Arm Cortex-M4 processor. This board was chosen because it is used in Ferrous System's Rust Trainings, is inexpensive, and includes a SEGGER J-Link on-board. +## Pre-requisites + +To build this demo you must: + +1. Run `git submodule update --init` to check-out the ThreadX source code +2. Install `probe-rs` (see ) +3. Install `arm-none-eabi-gcc` - such as from the [Arm GNU Toolchain](https://developer.arm.com/Tools%20and%20Software/GNU%20Toolchain) or via `winget install gcc-arm-embedded` +4. Install `libclang`, as specified in [the `bindgen` documentation](https://rust-lang.github.io/rust-bindgen/requirements.html) or via `winget install LLVM.LLVM` +5. Add the `thumb7em-none-eabihf` target with `rustup`: + + ```bash + rustup target add thumb7em-none-eabihf --toolchain=stable + ``` + +This demo was tested on Ferrocene 26.02 and Rust 1.94. It may work with earlier versions. + +## Building + To build and run this project, simply run: ```bash @@ -24,37 +42,20 @@ You will see something like: $ cargo run --release Compiling nrf52-app v0.0.0 (/Users/jonathan/Documents/ferrous-systems/threadx-experiments/nrf52-app) Finished `dev` profile [optimized + debuginfo] target(s) in 4.81s - Running `probe-rs run --chip nRF52840_xxAA target/thumbv7em-none-eabihf/debug/nrf52-app` - Erasing ✔ [00:00:00] [####################################] 12.00 KiB/12.00 KiB @ 33.03 KiB/s (eta 0s ) - Programming ✔ [00:00:00] [####################################] 12.00 KiB/12.00 KiB @ 42.84 KiB/s (eta 0s ) Finished in 0.661s -Hello, this is version unknown! -└─ nrf52_app::__cortex_m_rt_main @ src/main.rs:151 -Entering ThreadX kernel... -└─ nrf52_app::__cortex_m_rt_main @ src/main.rs:186 + Running `probe-rs run --chip nRF52840_xxAA --allow-erase-all --log-format=oneline target/thumbv7em-none-eabihf/debug/nrf52-app` + Erasing ✔ 100% [####################] 12.00 KiB @ 21.46 KiB/s (took 1s) + Programming ✔ 100% [####################] 12.00 KiB @ 15.23 KiB/s (took 1s) + Finished in 1.46s +[WARN ] Hello, this is version unknown! (nrf52_app nrf52-app/src/main.rs:170) +[INFO ] Entering ThreadX kernel... (nrf52_app nrf52-app/src/main.rs:209) In tx_application_define()... -└─ nrf52_app::tx_application_define @ src/main.rs:26 -Stack allocated @ 0x20037444 -└─ nrf52_app::tx_application_define @ src/main.rs:59 -Thread spawned (entry=12345678) @ 0x2003f440 -└─ nrf52_app::tx_application_define @ src/main.rs:85 -Stack allocated @ 0x2003944c -└─ nrf52_app::tx_application_define @ src/main.rs:102 -Thread spawned (entry=aabbccdd) @ 0x2003f4f8 -└─ nrf52_app::tx_application_define @ src/main.rs:128 -I am my_thread(12345678) -└─ nrf52_app::my_thread @ src/main.rs:136 -I am my_thread(aabbccdd) -└─ nrf52_app::my_thread @ src/main.rs:136 -I am my_thread(12345678), count = 1 -└─ nrf52_app::my_thread @ src/main.rs:145 -I am my_thread(aabbccdd), count = 1 -└─ nrf52_app::my_thread @ src/main.rs:145 -I am my_thread(12345678), count = 2 -└─ nrf52_app::my_thread @ src/main.rs:145 -I am my_thread(aabbccdd), count = 2 -└─ nrf52_app::my_thread @ src/main.rs:145 -I am my_thread(12345678), count = 3 -└─ nrf52_app::my_thread @ src/main.rs:145 +[INFO ] Thread spawned (entry=12345678) @ 0x200373fc (nrf52_app nrf52-app/src/main.rs:88) +[INFO ] Thread spawned (entry=aabbccdd) @ 0x200374b4 (nrf52_app nrf52-app/src/main.rs:131) +[INFO ] I am my_thread(12345678) (nrf52_app nrf52-app/src/main.rs:139) +[INFO ] I am my_thread(aabbccdd) (nrf52_app nrf52-app/src/main.rs:139) +[INFO ] I am my_thread(12345678), count = 1 (nrf52_app nrf52-app/src/main.rs:164) +[INFO ] I am my_thread(aabbccdd), count = 1 (nrf52_app nrf52-app/src/main.rs:164) +[INFO ] I am my_thread(12345678), count = 2 (nrf52_app nrf52-app/src/main.rs:164) ... ``` @@ -69,5 +70,5 @@ if you wish to adjust which ThreadX components are compiled in. ## Licence -* Copyright (c) 2025 Ferrous Systems +* Copyright (c) 2026 Ferrous Systems * SPDX-License-Identifier: MIT OR Apache-2.0 diff --git a/nrf52-app/memory.x b/nrf52-app/memory.x index 8c6761b..e624586 100644 --- a/nrf52-app/memory.x +++ b/nrf52-app/memory.x @@ -9,5 +9,5 @@ MEMORY RAM : ORIGIN = 0x20000000, LENGTH = 256K } +/* Link to the raw assembly function, avoiding a Rust function prologue/epilogue */ PROVIDE(PendSV = __tx_PendSVHandler); -PROVIDE(SysTick = __tx_SysTickHandler); diff --git a/nrf52-app/src/main.rs b/nrf52-app/src/main.rs index cbf8bb1..f8c8c66 100644 --- a/nrf52-app/src/main.rs +++ b/nrf52-app/src/main.rs @@ -6,7 +6,7 @@ #![no_main] #![no_std] -use cortex_m_rt::entry; +use cortex_m_rt::{entry, exception}; use defmt_rtt as _; use embedded_hal::digital::v2::OutputPin; use nrf52840_hal::gpio::{Output, Pin, PushPull}; @@ -24,7 +24,7 @@ const SYSTICK_CYCLES: u32 = (SYSTEM_CLOCK / 100) - 1; static LED_PIN: critical_section::Mutex>>>> = critical_section::Mutex::new(core::cell::RefCell::new(None)); -#[no_mangle] +#[unsafe(no_mangle)] extern "C" fn tx_application_define(_first_unused_memory: *mut core::ffi::c_void) { defmt::println!("In tx_application_define()..."); @@ -214,12 +214,15 @@ fn main() -> ! { panic!("Kernel exited"); } -#[no_mangle] -unsafe extern "C" fn __tx_SysTickHandler() { - extern "C" { +/// Systick exception handler +#[exception] +fn SysTick() { + unsafe extern "C" { fn _tx_timer_interrupt(); } // Call into OS function (not in public API) - _tx_timer_interrupt(); + unsafe { + _tx_timer_interrupt(); + } // Can do any extra work here } diff --git a/qemu-cortex-r5-app/.cargo/config.toml b/qemu-cortex-r5-app/.cargo/config.toml index b6a4006..336f649 100644 --- a/qemu-cortex-r5-app/.cargo/config.toml +++ b/qemu-cortex-r5-app/.cargo/config.toml @@ -7,7 +7,12 @@ rustflags = [ "-Clink-arg=-Tdefmt.x", "-Ctarget-cpu=cortex-r5", ] -runner = "./qemu_run.cmd" +runner = [ + "qemu-run", + "--machine=versatileab", + "--cpu=cortex-r5f", + "--log-format={[{L}]%bold} {s} {({c:bold} {fff}:{l:1})%dimmed}" +] [build] target = ["armv7r-none-eabihf"] diff --git a/qemu-cortex-r5-app/Cargo.lock b/qemu-cortex-r5-app/Cargo.lock index aa10af0..d9f4747 100644 --- a/qemu-cortex-r5-app/Cargo.lock +++ b/qemu-cortex-r5-app/Cargo.lock @@ -2,11 +2,26 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "aarch32-cpu" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1417bbf608824a44cb2fa2ad74b5ec28c0ae4c83df62a4bd2b532bf04c241ade" +dependencies = [ + "arbitrary-int 2.1.1", + "arm-targets", + "bitbybit", + "critical-section", + "defmt", + "num_enum", + "thiserror", +] + [[package]] name = "aho-corasick" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" dependencies = [ "memchr", ] @@ -17,11 +32,20 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "825297538d77367557b912770ca3083f778a196054b3ee63b22673c4a3cae0a5" +[[package]] +name = "arbitrary-int" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "993a810118f8f37e9c4411c86f1c4c940a09a7ab34b7bf2d88d06f50c553fab7" +dependencies = [ + "defmt", +] + [[package]] name = "arm-targets" -version = "0.2.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49743b294a925497a72abb5d7f3b0c9a1b390a65a92d72e38e915df767438664" +checksum = "639ca04328cd85faa54abaa192026d86fe49e278717820c2e92baa232ea7b0ec" [[package]] name = "bare-metal" @@ -34,16 +58,14 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.69.5" +version = "0.72.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" +checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895" dependencies = [ - "bitflags 2.9.3", + "bitflags 2.11.0", "cexpr", "clang-sys", "itertools", - "lazy_static", - "lazycell", "log", "prettyplease", "proc-macro2", @@ -52,16 +74,15 @@ dependencies = [ "rustc-hash", "shlex", "syn", - "which", ] [[package]] name = "bitbybit" -version = "1.3.3" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d317eeca82e7d88d606419a430590d83552bdceb899cb29904f63d694344b7fc" +checksum = "ec187a89ab07e209270175faf9e07ceb2755d984954e58a2296e325ddece2762" dependencies = [ - "arbitrary-int", + "arbitrary-int 1.3.0", "proc-macro2", "quote", "syn", @@ -81,16 +102,17 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.9.3" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34efbcccd345379ca2868b2b2c9d3782e9cc58ba87bc7d79d5b53d9c9ae6f25d" +checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" [[package]] name = "cc" -version = "1.2.34" +version = "1.2.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42bc4aea80032b7bf409b0bc7ccad88853858911b7713a8062fdc0623867bedc" +checksum = "e1e928d4b69e3077709075a938a05ffbedfa53a84c8f766efbf8220bb1ff60e1" dependencies = [ + "find-msvc-tools", "shlex", ] @@ -105,9 +127,9 @@ dependencies = [ [[package]] name = "cfg-if" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "clang-sys" @@ -120,20 +142,6 @@ dependencies = [ "libloading", ] -[[package]] -name = "cortex-ar" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13f5d76ad942231363ff04266e7ce867db0450f520f30579fe3007b639902367" -dependencies = [ - "arbitrary-int", - "arm-targets", - "bitbybit", - "critical-section", - "defmt 0.3.100", - "num_enum", -] - [[package]] name = "cortex-m" version = "0.7.7" @@ -152,15 +160,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" -[[package]] -name = "defmt" -version = "0.3.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" -dependencies = [ - "defmt 1.0.1", -] - [[package]] name = "defmt" version = "1.0.1" @@ -201,7 +200,7 @@ checksum = "63b0302c696f9080df24a40eed6d34e34de9a610723b8176df52272798971250" dependencies = [ "cortex-m", "critical-section", - "defmt 1.0.1", + "defmt", "semihosting", ] @@ -232,14 +231,10 @@ dependencies = [ ] [[package]] -name = "errno" -version = "0.3.13" +name = "find-msvc-tools" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad" -dependencies = [ - "libc", - "windows-sys 0.60.2", -] +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" [[package]] name = "glob" @@ -247,50 +242,29 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" -[[package]] -name = "home" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" -dependencies = [ - "windows-sys 0.59.0", -] - [[package]] name = "itertools" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" dependencies = [ "either", ] -[[package]] -name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" - -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - [[package]] name = "libc" -version = "0.2.175" +version = "0.2.184" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" +checksum = "48f5d2a454e16a5ea0f4ced81bd44e4cfc7bd3a507b61887c99fd3538b28e4af" [[package]] name = "libloading" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" dependencies = [ "cfg-if", - "windows-targets 0.53.3", + "windows-link", ] [[package]] @@ -299,23 +273,17 @@ version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9afa463f5405ee81cdb9cc2baf37e08ec7e4c8209442b5d72c04cfb2cd6e6286" -[[package]] -name = "linux-raw-sys" -version = "0.4.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" - [[package]] name = "log" -version = "0.4.27" +version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" [[package]] name = "memchr" -version = "2.7.5" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" [[package]] name = "minimal-lexical" @@ -350,9 +318,9 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a973b4e44ce6cad84ce69d797acf9a044532e4184c4f267913d1b546a0727b7a" +checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" dependencies = [ "num_enum_derive", "rustversion", @@ -360,26 +328,20 @@ dependencies = [ [[package]] name = "num_enum_derive" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77e878c846a8abae00dd069496dbe8751b16ac1c3d6bd2a7283a938e8228f90d" +checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" dependencies = [ "proc-macro2", "quote", "syn", ] -[[package]] -name = "once_cell" -version = "1.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" - [[package]] name = "portable-atomic" -version = "1.11.1" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" +checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" [[package]] name = "prettyplease" @@ -415,9 +377,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.101" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" dependencies = [ "unicode-ident", ] @@ -426,9 +388,9 @@ dependencies = [ name = "qemu-cortex-r5-app" version = "0.1.0" dependencies = [ + "aarch32-cpu", "cc", - "cortex-ar", - "defmt 1.0.1", + "defmt", "defmt-semihosting", "embedded-alloc", "semihosting", @@ -438,18 +400,18 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.40" +version = "1.0.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" dependencies = [ "proc-macro2", ] [[package]] name = "regex" -version = "1.11.1" +version = "1.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" dependencies = [ "aho-corasick", "memchr", @@ -459,9 +421,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.9" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" dependencies = [ "aho-corasick", "memchr", @@ -470,15 +432,15 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.5" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" [[package]] name = "rustc-hash" -version = "1.1.0" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe" [[package]] name = "rustc_version" @@ -489,19 +451,6 @@ dependencies = [ "semver", ] -[[package]] -name = "rustix" -version = "0.38.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" -dependencies = [ - "bitflags 2.9.3", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.59.0", -] - [[package]] name = "rustversion" version = "1.0.22" @@ -510,9 +459,9 @@ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] name = "semihosting" -version = "0.1.20" +version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3e1c7d2b77d80283c750a39c52f1ab4d17234e8f30bca43550f5b2375f41d5f" +checksum = "f8e4abf97879f4e80db69a9fba7bd64998e9bdad25f58ef045a778e191172fd4" [[package]] name = "semver" @@ -546,9 +495,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.106" +version = "2.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" dependencies = [ "proc-macro2", "quote", @@ -557,18 +506,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.16" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3467d614147380f2e4e374161426ff399c91084acd2363eaf549172b3d5e60c0" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "2.0.16" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c5e1be1c48b9172ee610da68fd9cd2770e7a4056cb3fc98710ee6906f0c7960" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ "proc-macro2", "quote", @@ -584,9 +533,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.18" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" [[package]] name = "vcell" @@ -609,167 +558,8 @@ dependencies = [ "vcell", ] -[[package]] -name = "which" -version = "4.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" -dependencies = [ - "either", - "home", - "once_cell", - "rustix", -] - [[package]] name = "windows-link" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" - -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.60.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" -dependencies = [ - "windows-targets 0.53.3", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm 0.52.6", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", -] - -[[package]] -name = "windows-targets" -version = "0.53.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" -dependencies = [ - "windows-link", - "windows_aarch64_gnullvm 0.53.0", - "windows_aarch64_msvc 0.53.0", - "windows_i686_gnu 0.53.0", - "windows_i686_gnullvm 0.53.0", - "windows_i686_msvc 0.53.0", - "windows_x86_64_gnu 0.53.0", - "windows_x86_64_gnullvm 0.53.0", - "windows_x86_64_msvc 0.53.0", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnu" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_i686_msvc" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.53.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" diff --git a/qemu-cortex-r5-app/Cargo.toml b/qemu-cortex-r5-app/Cargo.toml index 7a5d5f8..93e7c11 100644 --- a/qemu-cortex-r5-app/Cargo.toml +++ b/qemu-cortex-r5-app/Cargo.toml @@ -4,13 +4,13 @@ [package] name = "qemu-cortex-r5-app" version = "0.1.0" -edition = "2021" +edition = "2024" authors = ["Ferrous Systems"] license = "MIT OR Apache-2.0" description = "A simple ARMv7-R demo application that runs ThreadX in QEMU and compiles with Ferrocene" [dependencies] -cortex-ar = { version = "0.2.0", features = ["critical-section-single-core", "defmt"] } +aarch32-cpu = { version = "0.2.0", features = ["critical-section-single-core", "defmt"] } defmt = "1.0.1" defmt-semihosting = "0.3.0" embedded-alloc = "0.5.1" diff --git a/qemu-cortex-r5-app/README.md b/qemu-cortex-r5-app/README.md index 158f84e..9b037a1 100644 --- a/qemu-cortex-r5-app/README.md +++ b/qemu-cortex-r5-app/README.md @@ -12,17 +12,17 @@ QEMU. To build this demo you must: 1. Run `git submodule update --init` to check-out the ThreadX source code -2. Install `defmt-print` with `cargo install defmt-print` +2. Install `qemu-run` with `cargo install qemu-run` 3. Install `qemu-system-arm` - see [the QEMU website](https://www.qemu.org/download/) or via `winget install --id=SoftwareFreedomConservancy.QEMU` 4. Install `arm-none-eabi-gcc` - such as from the [Arm GNU Toolchain](https://developer.arm.com/Tools%20and%20Software/GNU%20Toolchain) or via `winget install gcc-arm-embedded` 5. Install `libclang`, as specified in [the `bindgen` documentation](https://rust-lang.github.io/rust-bindgen/requirements.html) or via `winget install LLVM.LLVM` -6. Add the `armv7r-none-eabihf` target with `rustup target add armv7r-none-eabih`: +6. Add the `armv7r-none-eabihf` target with `rustup`: ```bash rustup target add armv7r-none-eabihf --toolchain=stable ``` -This demo was tested on Ferrocene 25.05 and Rust 1.89. It may work with earlier versions. +This demo was tested on Ferrocene 26.02 and Rust 1.94. It may work with earlier versions. ## Building @@ -48,41 +48,27 @@ You will see something like: ```console $ cargo run --release Finished `release` profile [optimized + debuginfo] target(s) in 0.3s - Running `threadx-experiments/qemu-cortex-r5-app/./qemu_run.cmd target/armv7r-none-eabihf/release/qemu-cortex-r5-app` -ELF_BINARY=target/armv7r-none-eabihf/release/qemu-cortex-r5-app -Running on '-cpu cortex-r5f -machine versatileab'... ------------------------------------------------------------------------- -[INFO ] Hello, this is version unknown! (src/main.rs:156) -[INFO ] In tx_application_define()... (src/main.rs:27) -[DEBUG] Stack allocated @ 0x000074f8 (src/main.rs:60) -[DEBUG] Thread spawned (entry=12345678) @ 0x000134f4 (src/main.rs:86) -[DEBUG] Stack allocated @ 0x0000b500 (src/main.rs:103) -[DEBUG] Thread spawned (entry=aabbccdd) @ 0x000135ac (src/main.rs:129) -[INFO ] I am my_thread(12345678) (src/main.rs:138) -[INFO ] I am my_thread(aabbccdd) (src/main.rs:138) -[INFO ] I am my_thread(12345678), count = 1 (src/main.rs:147) -[INFO ] I am my_thread(aabbccdd), count = 1 (src/main.rs:147) -[INFO ] I am my_thread(12345678), count = 2 (src/main.rs:147) -[INFO ] I am my_thread(aabbccdd), count = 2 (src/main.rs:147) + Running `qemu-run --machine=versatileab --cpu=cortex-r5f '--log-format={[{L}]%bold} {s} {({c:bold} {fff}:{l:1})%dimmed}' target/armv7r-none-eabihf/debug/qemu-cortex-r5-app` +[INFO ] Hello, this is version unknown! (qemu_cortex_r5_app src/main.rs:160) +[INFO ] In tx_application_define()... (qemu_cortex_r5_app src/main.rs:27) +[DEBUG] Stack allocated @ 0x0000cd0c (qemu_cortex_r5_app src/main.rs:60) +[DEBUG] Thread spawned (entry=12345678) @ 0x0000cb94 (qemu_cortex_r5_app src/main.rs:86) +[DEBUG] Stack allocated @ 0x00010d14 (qemu_cortex_r5_app src/main.rs:103) +[DEBUG] Thread spawned entry=aabbccdd @ 0x0000cc4c (qemu_cortex_r5_app src/main.rs:129) +[INFO ] I am my_thread(12345678) (qemu_cortex_r5_app src/main.rs:138) +[INFO ] I am my_thread(aabbccdd) (qemu_cortex_r5_app src/main.rs:138) +[INFO ] I am my_thread(12345678), count = 1 (qemu_cortex_r5_app src/main.rs:147) +[INFO ] I am my_thread(aabbccdd), count = 1 (qemu_cortex_r5_app src/main.rs:147) +[INFO ] I am my_thread(12345678), count = 2 (qemu_cortex_r5_app src/main.rs:147) +[INFO ] I am my_thread(aabbccdd), count = 2 (qemu_cortex_r5_app src/main.rs:147) ^Cqemu-system-arm: terminating on signal 2 from pid 56574 () ------------------------------------------------------------------------ ``` -Press `Ctrl-C` to quit QEMU, or if that doesn't work, try `Ctrl+A, X`. +Press `Ctrl-C` to quit `qemu-run`. Console output appears through `defmt` which is transported over QEMU's -semihosting interface into `defmt-print` on the host. - -## Debugging - -If you wish to debug the program, add `-- -s -S` to the `cargo run` command, like: - -```bash -cargo run -- -s -S -``` - -The `-s -S` arguments are passed to `qemu-system-arm` and will cause it to -start a GDB server on `localhost:1234` and wait for GDB to connect. +semihosting interface into `qemu-run`, which decodes it and prints it out. ThreadX is automatically compiled from source thanks to the [`build.rs`](./build.rs) script that this package includes. Refer to that file @@ -90,5 +76,5 @@ if you wish to adjust which ThreadX components are compiled in. ## Licence -* Copyright (c) 2025 Ferrous Systems +* Copyright (c) 2026 Ferrous Systems * SPDX-License-Identifier: MIT OR Apache-2.0 diff --git a/qemu-cortex-r5-app/qemu_run.bat b/qemu-cortex-r5-app/qemu_run.bat deleted file mode 100644 index 6c90555..0000000 --- a/qemu-cortex-r5-app/qemu_run.bat +++ /dev/null @@ -1,15 +0,0 @@ -@echo off - -rem SPDX-FileCopyrightText: Copyright (c) 2025 Ferrous Systems -rem SPDX-License-Identifier: CC0-1.0 - -rem This requires you to previously run `cargo install defmt-print` - -set ELF_BINARY=%1 -set MACHINE=-cpu cortex-r5f -machine versatileab -set QEMU_PATH=%ProgramFiles%\qemu -echo ELF_BINARY=%ELF_BINARY% -echo Running on '%MACHINE%'... -echo ------------------------------------------------------------------------ -"%QEMU_PATH%\qemu-system-arm" %MACHINE% -semihosting-config enable=on -nographic -kernel %* | defmt-print -e %ELF_BINARY% --log-format="{[{L}]%%bold} {s} {({ff}:{l:1})%%dimmed}" -echo ------------------------------------------------------------------------ diff --git a/qemu-cortex-r5-app/qemu_run.cmd b/qemu-cortex-r5-app/qemu_run.cmd deleted file mode 100755 index 9725fc4..0000000 --- a/qemu-cortex-r5-app/qemu_run.cmd +++ /dev/null @@ -1,11 +0,0 @@ -: # This is a special script which intermixes both sh -: # and cmd code. It is written this way because it is -: # set as the cargo runner and needs to work on Windows -: # and POSIX platforms. See https://stackoverflow.com/questions/17510688 -: # for details. -: # -: # SPDX-FileCopyrightText: Copyright (c) 2025 Ferrous Systems -: # SPDX-License-Identifier: CC0-1.0 -:; ./qemu_run.sh $* ; exit -@ECHO OFF -call qemu_run.bat %* diff --git a/qemu-cortex-r5-app/qemu_run.sh b/qemu-cortex-r5-app/qemu_run.sh deleted file mode 100755 index c778c17..0000000 --- a/qemu-cortex-r5-app/qemu_run.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -# SPDX-FileCopyrightText: Copyright (c) 2025 Ferrous Systems -# SPDX-License-Identifier: CC0-1.0 - -# This requires you to previously run `cargo install defmt-print` - -ELF_BINARY=$1 -shift -MACHINE="-cpu cortex-r5f -machine versatileab" -LOG_FORMAT='{[{L}]%bold} {s} {({ff}:{l:1})%dimmed}' -echo "ELF_BINARY=$ELF_BINARY" -echo "Running on '$MACHINE'..." -echo "------------------------------------------------------------------------" -qemu-system-arm $MACHINE -semihosting-config enable=on,target=native -nographic -kernel $ELF_BINARY $* | defmt-print -e $ELF_BINARY --log-format="$LOG_FORMAT" -echo "------------------------------------------------------------------------" diff --git a/qemu-cortex-r5-app/src/lib.rs b/qemu-cortex-r5-app/src/lib.rs index d2c6104..ce31c80 100644 --- a/qemu-cortex-r5-app/src/lib.rs +++ b/qemu-cortex-r5-app/src/lib.rs @@ -13,7 +13,7 @@ pub mod sp804_timer; use defmt_semihosting as _; // Ensure we pick up the critical-section impl -use cortex_ar as _; +use aarch32_cpu as _; core::arch::global_asm!( r#" diff --git a/qemu-cortex-r5-app/src/main.rs b/qemu-cortex-r5-app/src/main.rs index 48839f9..b8fe7e2 100644 --- a/qemu-cortex-r5-app/src/main.rs +++ b/qemu-cortex-r5-app/src/main.rs @@ -1,6 +1,6 @@ //! Rust Demo for a QEMU Cortex-R machine, running ThreadX -// SPDX-FileCopyrightText: Copyright (c) 2025 Ferrous Systems +// SPDX-FileCopyrightText: Copyright (c) 2026 Ferrous Systems // SPDX-License-Identifier: MIT OR Apache-2.0 #![no_std] @@ -22,7 +22,7 @@ const DEMO_POOL_SIZE: usize = (DEMO_STACK_SIZE * 2) + 16384; /// /// ThreadX calls this function during scheduler start-up. We use it to create /// some threads. -#[no_mangle] +#[unsafe(no_mangle)] extern "C" fn tx_application_define(_first_unused_memory: *mut core::ffi::c_void) { defmt::info!("In tx_application_define()..."); @@ -155,7 +155,7 @@ extern "C" fn my_thread(value: u32) { /// The entry-point to the Rust application. /// /// It is called by the start-up code in `lib.rs`. -#[no_mangle] +#[unsafe(no_mangle)] pub extern "C" fn kmain() { defmt::info!( "Hello, this is version {}!", @@ -189,9 +189,9 @@ pub extern "C" fn kmain() { } /// Called from the main interrupt handler -#[no_mangle] +#[unsafe(no_mangle)] unsafe extern "C" fn handle_interrupt() { - extern "C" { + unsafe extern "C" { fn _tx_timer_interrupt(); } diff --git a/threadx-sys/Cargo.toml b/threadx-sys/Cargo.toml index fbc705e..92d5b0d 100644 --- a/threadx-sys/Cargo.toml +++ b/threadx-sys/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "threadx-sys" version = "0.1.0" -edition = "2021" +edition = "2024" authors = ["Jonathan Pallant "] license-file = "../LICENCES/MIT.txt" @@ -13,4 +13,4 @@ license-file = "../LICENCES/MIT.txt" [dependencies] [build-dependencies] -bindgen = "0.69.1" +bindgen = "0.72"