From 316b2879fed40e5bed5e18fe8d50ffab174215be Mon Sep 17 00:00:00 2001 From: Alex Martens Date: Sun, 30 Jun 2024 15:54:35 -0700 Subject: [PATCH 01/11] CI: Add workflow_dispatch to all files This allows for manual triggering --- .github/workflows/ci.yml | 3 +-- .github/workflows/clippy.yml | 1 + .github/workflows/cron.yml | 1 + .github/workflows/rt-ci.yml | 1 + .github/workflows/rustfmt.yml | 1 + 5 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3d62c052..0733aebd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,7 @@ on: - "gh-readonly-queue/**" pull_request: merge_group: + workflow_dispatch: name: cortex-m CI @@ -30,5 +31,3 @@ jobs: toolchain: ${{ matrix.rust }} - name: Run tests run: cargo test --all --exclude cortex-m-rt --exclude testsuite --features cortex-m/critical-section-single-core - -# FIXME: test on macOS and Windows diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index 4b611bf0..759936e7 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -4,6 +4,7 @@ on: - "gh-readonly-queue/**" pull_request_target: merge_group: + workflow_dispatch: name: Clippy check jobs: diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml index a09e2a3d..e55eeee3 100644 --- a/.github/workflows/cron.yml +++ b/.github/workflows/cron.yml @@ -2,6 +2,7 @@ on: schedule: # Run every week at 8am UTC Saturday. - cron: '0 8 * * SAT' + workflow_dispatch: name: Cron CI diff --git a/.github/workflows/rt-ci.yml b/.github/workflows/rt-ci.yml index b9a69a41..af0870d5 100644 --- a/.github/workflows/rt-ci.yml +++ b/.github/workflows/rt-ci.yml @@ -4,6 +4,7 @@ on: - "gh-readonly-queue/**" pull_request: merge_group: + workflow_dispatch: name: cortex-m-rt CI diff --git a/.github/workflows/rustfmt.yml b/.github/workflows/rustfmt.yml index 3630a962..9de534ba 100644 --- a/.github/workflows/rustfmt.yml +++ b/.github/workflows/rustfmt.yml @@ -4,6 +4,7 @@ on: - "gh-readonly-queue/**" pull_request: merge_group: + workflow_dispatch: name: Code formatting check From 9429ed57ec0c7f6fae07e90281f6931b5be5e47c Mon Sep 17 00:00:00 2001 From: Alex Martens Date: Sun, 30 Jun 2024 15:57:46 -0700 Subject: [PATCH 02/11] CI: remove remaining actions-rs deps --- .github/workflows/clippy.yml | 10 +--------- .github/workflows/rustfmt.yml | 5 +---- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index 759936e7..fa2a961f 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -12,15 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - if: github.event_name == 'pull_request_target' - with: - ref: refs/pull/${{ github.event.number }}/head - - uses: actions/checkout@v4 - if: github.event_name != 'pull_request_target' - uses: dtolnay/rust-toolchain@stable with: components: clippy - - uses: actions-rs/clippy-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --all --features cortex-m/critical-section-single-core + - run: cargo clippy --all --features cortex-m/critical-section-single-core -- --deny warnings diff --git a/.github/workflows/rustfmt.yml b/.github/workflows/rustfmt.yml index 9de534ba..042f1fa5 100644 --- a/.github/workflows/rustfmt.yml +++ b/.github/workflows/rustfmt.yml @@ -17,7 +17,4 @@ jobs: - uses: dtolnay/rust-toolchain@stable with: components: rustfmt - - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check + - run: cargo fmt --all -- --check From 75bce274381014a8d02cc4b8463e2f61ba30325a Mon Sep 17 00:00:00 2001 From: Alex Martens Date: Sun, 30 Jun 2024 15:58:37 -0700 Subject: [PATCH 03/11] CI: update ubuntu-20.04 jobs to ubuntu-latest --- .github/workflows/cron.yml | 2 +- .github/workflows/rt-ci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml index e55eeee3..6ff44ba2 100644 --- a/.github/workflows/cron.yml +++ b/.github/workflows/cron.yml @@ -27,7 +27,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} rt-ci-linux: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest continue-on-error: ${{ matrix.experimental || false }} defaults: run: diff --git a/.github/workflows/rt-ci.yml b/.github/workflows/rt-ci.yml index af0870d5..e73dcd4c 100644 --- a/.github/workflows/rt-ci.yml +++ b/.github/workflows/rt-ci.yml @@ -10,7 +10,7 @@ name: cortex-m-rt CI jobs: rt-ci-linux: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest continue-on-error: ${{ matrix.experimental || false }} strategy: matrix: From 353bd8cd3bb02bf056ce479bacac731ea4d5dd2d Mon Sep 17 00:00:00 2001 From: Alex Martens Date: Sun, 30 Jun 2024 16:01:37 -0700 Subject: [PATCH 04/11] cortex-m-rt: delete duplicate CoC Also fix links to the CoC. --- cortex-m-rt/CODE_OF_CONDUCT.md | 37 ---------------------------------- cortex-m-rt/README.md | 2 +- cortex-m/README.md | 2 +- panic-itm/README.md | 2 +- 4 files changed, 3 insertions(+), 40 deletions(-) delete mode 100644 cortex-m-rt/CODE_OF_CONDUCT.md diff --git a/cortex-m-rt/CODE_OF_CONDUCT.md b/cortex-m-rt/CODE_OF_CONDUCT.md deleted file mode 100644 index 3ab76c63..00000000 --- a/cortex-m-rt/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,37 +0,0 @@ -# The Rust Code of Conduct - -## Conduct - -**Contact**: [Cortex-M team](https://github.com/rust-embedded/wg#the-cortex-m-team) - -* We are committed to providing a friendly, safe and welcoming environment for all, regardless of level of experience, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality, or other similar characteristic. -* On IRC, please avoid using overtly sexual nicknames or other nicknames that might detract from a friendly, safe and welcoming environment for all. -* Please be kind and courteous. There's no need to be mean or rude. -* Respect that people have differences of opinion and that every design or implementation choice carries a trade-off and numerous costs. There is seldom a right answer. -* Please keep unstructured critique to a minimum. If you have solid ideas you want to experiment with, make a fork and see how it works. -* We will exclude you from interaction if you insult, demean or harass anyone. That is not welcome behavior. We interpret the term "harassment" as including the definition in the [Citizen Code of Conduct](http://citizencodeofconduct.org/); if you have any lack of clarity about what might be included in that concept, please read their definition. In particular, we don't tolerate behavior that excludes people in socially marginalized groups. -* Private harassment is also unacceptable. No matter who you are, if you feel you have been or are being harassed or made uncomfortable by a community member, please contact one of the channel ops or any of the [Cortex-M team][team] immediately. Whether you're a regular contributor or a newcomer, we care about making this community a safe place for you and we've got your back. -* Likewise any spamming, trolling, flaming, baiting or other attention-stealing behavior is not welcome. - -## Moderation - -These are the policies for upholding our community's standards of conduct. - -1. Remarks that violate the Rust standards of conduct, including hateful, hurtful, oppressive, or exclusionary remarks, are not allowed. (Cursing is allowed, but never targeting another user, and never in a hateful manner.) -2. Remarks that moderators find inappropriate, whether listed in the code of conduct or not, are also not allowed. -3. Moderators will first respond to such remarks with a warning. -4. If the warning is unheeded, the user will be "kicked," i.e., kicked out of the communication channel to cool off. -5. If the user comes back and continues to make trouble, they will be banned, i.e., indefinitely excluded. -6. Moderators may choose at their discretion to un-ban the user if it was a first offense and they offer the offended party a genuine apology. -7. If a moderator bans someone and you think it was unjustified, please take it up with that moderator, or with a different moderator, **in private**. Complaints about bans in-channel are not allowed. -8. Moderators are held to a higher standard than other community members. If a moderator creates an inappropriate situation, they should expect less leeway than others. - -In the Rust community we strive to go the extra step to look out for each other. Don't just aim to be technically unimpeachable, try to be your best self. In particular, avoid flirting with offensive or sensitive issues, particularly if they're off-topic; this all too often leads to unnecessary fights, hurt feelings, and damaged trust; worse, it can drive people away from the community entirely. - -And if someone takes issue with something you said or did, resist the urge to be defensive. Just stop doing what it was they complained about and apologize. Even if you feel you were misinterpreted or unfairly accused, chances are good there was something you could've communicated better — remember that it's your responsibility to make your fellow Rustaceans comfortable. Everyone wants to get along and we are all here first and foremost because we want to talk about cool technology. You will find that people will be eager to assume good intent and forgive as long as you earn their trust. - -The enforcement policies listed above apply to all official embedded WG venues; including official IRC channels (#rust-embedded); GitHub repositories under rust-embedded; and all forums under rust-embedded.org (forum.rust-embedded.org). - -*Adapted from the [Node.js Policy on Trolling](http://blog.izs.me/post/30036893703/policy-on-trolling) as well as the [Contributor Covenant v1.3.0](https://www.contributor-covenant.org/version/1/3/0/).* - -[team]: https://github.com/rust-embedded/wg#the-cortex-m-team diff --git a/cortex-m-rt/README.md b/cortex-m-rt/README.md index f832da80..60f2686e 100644 --- a/cortex-m-rt/README.md +++ b/cortex-m-rt/README.md @@ -37,5 +37,5 @@ Contribution to this crate is organized under the terms of the [Rust Code of Conduct][CoC], the maintainer of this crate, the [Cortex-M team][team], promises to intervene to uphold that code of conduct. -[CoC]: CODE_OF_CONDUCT.md +[CoC]: ../CODE_OF_CONDUCT.md [team]: https://github.com/rust-embedded/wg#the-cortex-m-team diff --git a/cortex-m/README.md b/cortex-m/README.md index 4fe4c08f..aacc6ddc 100644 --- a/cortex-m/README.md +++ b/cortex-m/README.md @@ -35,5 +35,5 @@ Contribution to this crate is organized under the terms of the [Rust Code of Conduct][CoC], the maintainer of this crate, the [Cortex-M team][team], promises to intervene to uphold that code of conduct. -[CoC]: CODE_OF_CONDUCT.md +[CoC]: ../CODE_OF_CONDUCT.md [team]: https://github.com/rust-embedded/wg#the-cortex-m-team diff --git a/panic-itm/README.md b/panic-itm/README.md index 38a4d467..72c56976 100644 --- a/panic-itm/README.md +++ b/panic-itm/README.md @@ -33,5 +33,5 @@ Contribution to this crate is organized under the terms of the [Rust Code of Conduct][CoC], the maintainer of this crate, the [Cortex-M team][team], promises to intervene to uphold that code of conduct. -[CoC]: CODE_OF_CONDUCT.md +[CoC]: ../CODE_OF_CONDUCT.md [team]: https://github.com/rust-embedded/wg#the-cortex-m-team From 4d996ba5676b03f1b1665d27b88e8d54f5271761 Mon Sep 17 00:00:00 2001 From: Alex Martens Date: Sun, 30 Jun 2024 16:02:24 -0700 Subject: [PATCH 05/11] cortex-m-rt/compiletest_rs: 0.7 -> 0.11 --- cortex-m-rt/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cortex-m-rt/Cargo.toml b/cortex-m-rt/Cargo.toml index 984b6026..74dc2165 100644 --- a/cortex-m-rt/Cargo.toml +++ b/cortex-m-rt/Cargo.toml @@ -27,7 +27,7 @@ panic-halt = "0.2.0" cortex-m-semihosting = { path = "../cortex-m-semihosting" } [target.'cfg(not(target_os = "none"))'.dev-dependencies] -compiletest_rs = "0.7" +compiletest_rs = "0.11" [[example]] name = "device" From b7d56249837da519bb199011ced88acb938ef4e5 Mon Sep 17 00:00:00 2001 From: Alex Martens Date: Sun, 30 Jun 2024 16:03:56 -0700 Subject: [PATCH 06/11] cortex-m/bitfield: 0.13.2 -> 0.15.0 --- cortex-m/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cortex-m/Cargo.toml b/cortex-m/Cargo.toml index 11bb9f6c..d90dc376 100644 --- a/cortex-m/Cargo.toml +++ b/cortex-m/Cargo.toml @@ -19,7 +19,7 @@ links = "cortex-m" # prevent multiple versions of this crate to be linked toget [dependencies] critical-section = "1.0.0" volatile-register = "0.2.2" -bitfield = "0.13.2" +bitfield = "0.15.0" eh0 = { package = "embedded-hal", version = "0.2.4", optional = true } eh1 = { package = "embedded-hal", version = "1.0.0" } From 6eec6adc790536d47c7ae36c08303b23cdfb6e7e Mon Sep 17 00:00:00 2001 From: Alex Martens Date: Sun, 30 Jun 2024 16:04:22 -0700 Subject: [PATCH 07/11] xtask/ar: 0.8.0 -> 0.9.0 --- xtask/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index 73047eef..0abe8e19 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -10,6 +10,6 @@ name = "ci" harness = false [dependencies] -ar = "0.8.0" +ar = "0.9.0" cortex-m = { path = "../cortex-m", features = ["serde", "std"] } serde_json = "1" From dfd5da085ec9db299be2cc117eaab077144ad36a Mon Sep 17 00:00:00 2001 From: Alex Martens Date: Sun, 30 Jun 2024 16:06:13 -0700 Subject: [PATCH 08/11] testsuite/minitest/syn: 1.0.80 -> 2.0.68 --- testsuite/minitest/macros/Cargo.toml | 2 +- testsuite/minitest/macros/src/lib.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/testsuite/minitest/macros/Cargo.toml b/testsuite/minitest/macros/Cargo.toml index 5f11235c..8e76cab5 100644 --- a/testsuite/minitest/macros/Cargo.toml +++ b/testsuite/minitest/macros/Cargo.toml @@ -14,4 +14,4 @@ rtt = [] [dependencies] proc-macro2 = "1.0.29" quote = "1.0.10" -syn = { version = "1.0.80", features = ["extra-traits", "full"] } +syn = { version = "2.0.68", features = ["extra-traits", "full"] } diff --git a/testsuite/minitest/macros/src/lib.rs b/testsuite/minitest/macros/src/lib.rs index 0d0dd0a8..64000153 100644 --- a/testsuite/minitest/macros/src/lib.rs +++ b/testsuite/minitest/macros/src/lib.rs @@ -42,13 +42,13 @@ fn tests_impl(args: TokenStream, input: TokenStream) -> parse::Result Vec { let mut cfgs = vec![]; for attr in attrs { - if attr.path.is_ident("cfg") { + if attr.path().is_ident("cfg") { cfgs.push(attr.clone()); } } From 16760818be869199fb210ad29cd9efb827a855dc Mon Sep 17 00:00:00 2001 From: Alex Martens Date: Sun, 30 Jun 2024 16:12:19 -0700 Subject: [PATCH 09/11] cortex-m: update changelog after #539 --- cortex-m/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/cortex-m/CHANGELOG.md b/cortex-m/CHANGELOG.md index 9a706fe9..b13405da 100644 --- a/cortex-m/CHANGELOG.md +++ b/cortex-m/CHANGELOG.md @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Added `critical-section-single-core` feature which provides an implementation for the `critical_section` crate for single-core systems, based on disabling all interrupts. (#447) - Added support for `embedded-hal` version 1 delay traits, requiring rust 1.60. - `singleton!()` now forwards attributes (#522). +- Added `set_sevonpend` and `clear_sevonpend` (#539). ### Fixed - Fixed `singleton!()` statics sometimes ending up in `.data` instead of `.bss` (#364, #380). From dd08f5f5210e949a3a5b9f57bfa53348d6f1d8d8 Mon Sep 17 00:00:00 2001 From: Alex Martens Date: Sun, 30 Jun 2024 16:39:01 -0700 Subject: [PATCH 10/11] cortex-m: fix typos --- cortex-m/src/interrupt.rs | 2 +- cortex-m/src/macros.rs | 2 +- cortex-m/src/peripheral/ac.rs | 2 +- cortex-m/src/peripheral/scb.rs | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cortex-m/src/interrupt.rs b/cortex-m/src/interrupt.rs index f6ce9908..6b8f9e96 100644 --- a/cortex-m/src/interrupt.rs +++ b/cortex-m/src/interrupt.rs @@ -54,7 +54,7 @@ pub unsafe fn enable() { /// Execute closure `f` with interrupts disabled in the current core. /// -/// This method does not synchronise multiple cores and may disable required +/// This method does not synchronize multiple cores and may disable required /// interrupts on some platforms; see the `critical-section` crate for a cross-platform /// way to enter a critical section which provides a `CriticalSection` token. /// diff --git a/cortex-m/src/macros.rs b/cortex-m/src/macros.rs index ba780481..c2f45083 100644 --- a/cortex-m/src/macros.rs +++ b/cortex-m/src/macros.rs @@ -37,7 +37,7 @@ macro_rules! iprintln { /// have to provide one from elsewhere, typically your chip's HAL crate. /// /// For debuggability, you can set an explicit name for a singleton. This name only shows up the -/// the debugger and is not referencable from other code. See example below. +/// the debugger and is not referenceable from other code. See example below. /// /// # Example /// diff --git a/cortex-m/src/peripheral/ac.rs b/cortex-m/src/peripheral/ac.rs index 1ac5be10..6169b654 100644 --- a/cortex-m/src/peripheral/ac.rs +++ b/cortex-m/src/peripheral/ac.rs @@ -16,7 +16,7 @@ pub struct RegisterBlock { /// AHB Slave Control Register pub ahbscr: RW, reserved0: u32, - /// Auxilary Bus Fault Status Register + /// Auxiliary Bus Fault Status Register pub abfsr: RW, } diff --git a/cortex-m/src/peripheral/scb.rs b/cortex-m/src/peripheral/scb.rs index 7fa25b9a..46eb3a4e 100644 --- a/cortex-m/src/peripheral/scb.rs +++ b/cortex-m/src/peripheral/scb.rs @@ -362,7 +362,7 @@ impl SCB { let mut cbp = unsafe { CBP::new() }; // Disable I-cache - // NOTE(unsafe): We have synchronised access by &mut self + // NOTE(unsafe): We have synchronized access by &mut self unsafe { self.ccr.modify(|r| r & !SCB_CCR_IC_MASK) }; // Invalidate I-cache @@ -435,7 +435,7 @@ impl SCB { } // Turn off the D-cache - // NOTE(unsafe): We have synchronised access by &mut self + // NOTE(unsafe): We have synchronized access by &mut self unsafe { self.ccr.modify(|r| r & !SCB_CCR_DC_MASK) }; // Clean and invalidate whatever was left in it From 38dfcb7ffcb1376d0eb1f37869236e08792b9305 Mon Sep 17 00:00:00 2001 From: Alex Martens Date: Sun, 30 Jun 2024 16:40:00 -0700 Subject: [PATCH 11/11] Fix dead/ambiguous links --- cortex-m-semihosting/src/lib.rs | 2 +- cortex-m/src/peripheral/dwt.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cortex-m-semihosting/src/lib.rs b/cortex-m-semihosting/src/lib.rs index e72dbe67..6a6e9da5 100644 --- a/cortex-m-semihosting/src/lib.rs +++ b/cortex-m-semihosting/src/lib.rs @@ -200,7 +200,7 @@ pub unsafe fn syscall(nr: usize, arg: &T) -> usize { /// /// # Safety /// -/// Same as [`syscall`]. +/// Same as [`syscall()`]. #[inline(always)] pub unsafe fn syscall1(_nr: usize, _arg: usize) -> usize { match () { diff --git a/cortex-m/src/peripheral/dwt.rs b/cortex-m/src/peripheral/dwt.rs index 72575d37..05657f33 100644 --- a/cortex-m/src/peripheral/dwt.rs +++ b/cortex-m/src/peripheral/dwt.rs @@ -368,7 +368,7 @@ pub enum EmitOption { WatchpointDebugEvent, /// Generate a `CMPMATCH[N]` event. /// - /// See more in section "CMPMATCH[N] event generation" page C1-730. + /// See more in section "`CMPMATCH[N]` event generation" page C1-730. CompareMatchEvent, }