From 206523500d39a798ec77289a91c1ee99c172565c Mon Sep 17 00:00:00 2001 From: SkyGrel19 Date: Thu, 14 Dec 2023 15:49:10 +0300 Subject: [PATCH 1/6] Fixed VectActive::from() --- src/peripheral/scb.rs | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/src/peripheral/scb.rs b/src/peripheral/scb.rs index f998b17c..ecf98e5a 100644 --- a/src/peripheral/scb.rs +++ b/src/peripheral/scb.rs @@ -172,25 +172,8 @@ impl SCB { pub fn vect_active() -> VectActive { let icsr = unsafe { ptr::read(&(*SCB::PTR).icsr as *const _ as *const u32) }; - match icsr as u8 { - 0 => VectActive::ThreadMode, - 2 => VectActive::Exception(Exception::NonMaskableInt), - 3 => VectActive::Exception(Exception::HardFault), - #[cfg(not(armv6m))] - 4 => VectActive::Exception(Exception::MemoryManagement), - #[cfg(not(armv6m))] - 5 => VectActive::Exception(Exception::BusFault), - #[cfg(not(armv6m))] - 6 => VectActive::Exception(Exception::UsageFault), - #[cfg(any(armv8m, native))] - 7 => VectActive::Exception(Exception::SecureFault), - 11 => VectActive::Exception(Exception::SVCall), - #[cfg(not(armv6m))] - 12 => VectActive::Exception(Exception::DebugMonitor), - 14 => VectActive::Exception(Exception::PendSV), - 15 => VectActive::Exception(Exception::SysTick), - irqn => VectActive::Interrupt { irqn: irqn - 16 }, - } + // NOTE(unsafe): Assume correctly selected target. + unsafe { VectActive::from(icsr as u8).unwrap_unchecked() } } } @@ -300,7 +283,7 @@ impl VectActive { 12 => VectActive::Exception(Exception::DebugMonitor), 14 => VectActive::Exception(Exception::PendSV), 15 => VectActive::Exception(Exception::SysTick), - irqn if irqn >= 16 => VectActive::Interrupt { irqn }, + irqn if irqn >= 16 => VectActive::Interrupt { irqn: irqn - 16 }, _ => return None, }) } From 1e1eebe5fbc6d276af74a00771df80169461de9d Mon Sep 17 00:00:00 2001 From: SkyGrel19 Date: Thu, 18 Jan 2024 23:46:09 +0300 Subject: [PATCH 2/6] replace unwrap_unchecked to support older versions --- src/peripheral/scb.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/peripheral/scb.rs b/src/peripheral/scb.rs index ecf98e5a..54c0fdb2 100644 --- a/src/peripheral/scb.rs +++ b/src/peripheral/scb.rs @@ -173,7 +173,10 @@ impl SCB { let icsr = unsafe { ptr::read(&(*SCB::PTR).icsr as *const _ as *const u32) }; // NOTE(unsafe): Assume correctly selected target. - unsafe { VectActive::from(icsr as u8).unwrap_unchecked() } + match VectActive::from(icsr as u8) { + Some(val) => val, + None => unsafe { core::hint::unreachable_unchecked() }, + } } } From 96313727520981ea6c9babc28973d864f027a4a8 Mon Sep 17 00:00:00 2001 From: SkyGrel19 Date: Fri, 19 Jan 2024 00:30:20 +0300 Subject: [PATCH 3/6] specify version serde --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index a79bc3c1..b2c20db9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ bitfield = "0.13.2" embedded-hal = "0.2.4" [dependencies.serde] -version = "1" +version = ">=1.0.0,<=1.0.100" features = [ "derive" ] optional = true From 2d333f3fe50f55d98f4e8c2884c4f441c93814d5 Mon Sep 17 00:00:00 2001 From: SkyGrel19 Date: Fri, 19 Jan 2024 00:38:48 +0300 Subject: [PATCH 4/6] set serde_json version --- Cargo.toml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index b2c20db9..8cf4adbd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,10 +23,14 @@ bitfield = "0.13.2" embedded-hal = "0.2.4" [dependencies.serde] -version = ">=1.0.0,<=1.0.100" +version = "1" features = [ "derive" ] optional = true +[dependencies.serde_json] +version = ">=1.0.0,<=1.0.100" +optional = true + [features] cm7 = [] cm7-r0p1 = ["cm7"] From fb33ee5332de511563ab74a517222b4ef435ba49 Mon Sep 17 00:00:00 2001 From: SkyGrel19 Date: Fri, 19 Jan 2024 01:22:44 +0300 Subject: [PATCH 5/6] fix other version for serde_derive,nb,proc-macro2 --- Cargo.toml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 8cf4adbd..4b65ace9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,6 +31,19 @@ optional = true version = ">=1.0.0,<=1.0.100" optional = true + +[dependencies.nb] +version = "=0.1.2" +optional = true + +[dependencies.proc-macro2] +version = "=1.0.65" +optional = true + +[dependencies.serde_derive] +version = "=1.0.156" +optional = true + [features] cm7 = [] cm7-r0p1 = ["cm7"] From e15768d6b40a0f22453791efba9e179b0c8066d0 Mon Sep 17 00:00:00 2001 From: SkyGrel19 Date: Fri, 19 Jan 2024 21:57:17 +0300 Subject: [PATCH 6/6] bump MSRV to 1.59 --- .github/bors.toml | 2 +- .github/workflows/ci.yml | 2 +- Cargo.toml | 15 +-------------- README.md | 2 +- src/lib.rs | 2 +- src/peripheral/scb.rs | 5 +---- xtask/tests/ci.rs | 4 +--- 7 files changed, 7 insertions(+), 25 deletions(-) diff --git a/.github/bors.toml b/.github/bors.toml index 63d883fd..9af0108f 100644 --- a/.github/bors.toml +++ b/.github/bors.toml @@ -3,7 +3,7 @@ delete_merged_branches = true required_approvals = 1 status = [ "ci-linux (stable)", - "ci-linux (1.38.0)", + "ci-linux (1.59.0)", "rustfmt", "clippy", ] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e792872a..7006c5eb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: include: # Test MSRV - - rust: 1.38.0 + - rust: 1.59.0 features: "" # Test nightly but don't fail diff --git a/Cargo.toml b/Cargo.toml index 4b65ace9..dc067989 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,20 +28,7 @@ features = [ "derive" ] optional = true [dependencies.serde_json] -version = ">=1.0.0,<=1.0.100" -optional = true - - -[dependencies.nb] -version = "=0.1.2" -optional = true - -[dependencies.proc-macro2] -version = "=1.0.65" -optional = true - -[dependencies.serde_derive] -version = "=1.0.156" +version = "1" optional = true [features] diff --git a/README.md b/README.md index 6bd8aedd..a0457651 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ This project is developed and maintained by the [Cortex-M team][team]. ## Minimum Supported Rust Version (MSRV) -This crate is guaranteed to compile on stable Rust 1.38 and up. It might compile with older versions but that may change in any new patch release. +This crate is guaranteed to compile on stable Rust 1.59 and up. It might compile with older versions but that may change in any new patch release. ## License diff --git a/src/lib.rs b/src/lib.rs index 044085ed..4ba0ad86 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -63,7 +63,7 @@ //! //! # Minimum Supported Rust Version (MSRV) //! -//! This crate is guaranteed to compile on stable Rust 1.38 and up. It *might* +//! This crate is guaranteed to compile on stable Rust 1.59 and up. It *might* //! compile with older versions but that may change in any new patch release. #![deny(missing_docs)] diff --git a/src/peripheral/scb.rs b/src/peripheral/scb.rs index 54c0fdb2..ecf98e5a 100644 --- a/src/peripheral/scb.rs +++ b/src/peripheral/scb.rs @@ -173,10 +173,7 @@ impl SCB { let icsr = unsafe { ptr::read(&(*SCB::PTR).icsr as *const _ as *const u32) }; // NOTE(unsafe): Assume correctly selected target. - match VectActive::from(icsr as u8) { - Some(val) => val, - None => unsafe { core::hint::unreachable_unchecked() }, - } + unsafe { VectActive::from(icsr as u8).unwrap_unchecked() } } } diff --git a/xtask/tests/ci.rs b/xtask/tests/ci.rs index ded7555c..b7bfc3dc 100644 --- a/xtask/tests/ci.rs +++ b/xtask/tests/ci.rs @@ -58,8 +58,6 @@ fn check_crates_build(is_nightly: bool, is_msrv: bool) { // Relies on all crates in this repo to use the same convention. let should_use_feature = |feat: &str| { match feat { - // critical-section doesn't build in 1.38 due to using `#[doc(include_str!(..))]` - "critical-section-single-core" => !is_msrv, // This is nightly-only, so don't use it on stable. "inline-asm" => is_nightly, // This only affects thumbv7em targets. @@ -105,7 +103,7 @@ fn main() { let output = Command::new("rustc").arg("-V").output().unwrap(); let is_nightly = str::from_utf8(&output.stdout).unwrap().contains("nightly"); - let is_msrv = str::from_utf8(&output.stdout).unwrap().contains("1.38"); + let is_msrv = str::from_utf8(&output.stdout).unwrap().contains("1.59"); check_crates_build(is_nightly, is_msrv);