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 a79bc3c1..dc067989 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,6 +27,10 @@ version = "1" features = [ "derive" ] optional = true +[dependencies.serde_json] +version = "1" +optional = true + [features] cm7 = [] cm7-r0p1 = ["cm7"] 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 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, }) } 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);