From 24a492672ea6304f4553db5a8f19c41bf928fdbe Mon Sep 17 00:00:00 2001 From: 9names <60134748+9names@users.noreply.github.com> Date: Sat, 11 Apr 2026 15:23:56 +1000 Subject: [PATCH 1/3] Document that inline-asm is deprecated --- cortex-m/Cargo.toml | 3 ++- cortex-m/src/lib.rs | 25 +++++++------------------ 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/cortex-m/Cargo.toml b/cortex-m/Cargo.toml index 74ce9f35..5431f48b 100644 --- a/cortex-m/Cargo.toml +++ b/cortex-m/Cargo.toml @@ -33,12 +33,13 @@ optional = true [features] cm7 = [] cm7-r0p1 = ["cm7"] -inline-asm = [] linker-plugin-lto = [] std = [] critical-section-single-core = ["critical-section/restore-state-u32"] # Deprecated feature from when critical-section was an optional dependency critical-section = [] +# Deprecated feature from when inline-asm was optional (to preserve a lower MSRV) +inline-asm = [] [package.metadata.docs.rs] targets = [ diff --git a/cortex-m/src/lib.rs b/cortex-m/src/lib.rs index caa2ecfa..481505b9 100644 --- a/cortex-m/src/lib.rs +++ b/cortex-m/src/lib.rs @@ -9,22 +9,6 @@ //! //! # Optional features //! -//! ## `inline-asm` -//! -//! When this feature is enabled the implementation of all the functions inside the `asm` and -//! `register` modules use inline assembly (`asm!`) instead of external assembly (FFI into separate -//! assembly files pre-compiled using `arm-none-eabi-gcc`). The advantages of enabling `inline-asm` -//! are: -//! -//! - Reduced overhead. FFI eliminates the possibility of inlining so all operations include a -//! function call overhead when `inline-asm` is not enabled. -//! -//! - Some of the `register` API only becomes available only when `inline-asm` is enabled. Check the -//! API docs for details. -//! -//! The disadvantage is that `inline-asm` requires a Rust version at least 1.59 to use the `asm!()` -//! macro. In the future 0.8 and above versions of `cortex-m`, this feature will always be enabled. -//! //! ## `critical-section-single-core` //! //! This feature enables a [`critical-section`](https://github.com/rust-embedded/critical-section) @@ -49,8 +33,7 @@ //! ## `linker-plugin-lto` //! //! This feature links against prebuilt assembly blobs that are compatible with [Linker-Plugin LTO]. -//! This allows inlining assembly routines into the caller, even without the `inline-asm` feature, -//! and works on stable Rust (but note the drawbacks below!). +//! This allows inlining assembly routines into the caller, and works on stable Rust (but note the drawbacks below!). //! //! If you want to use this feature, you need to be aware of a few things: //! @@ -66,6 +49,12 @@ //! [Linker-Plugin LTO]: https://doc.rust-lang.org/stable/rustc/linker-plugin-lto.html //! [rust-lang/rust#75940]: https://github.com/rust-lang/rust/issues/75940 //! +//! ## `inline-asm` +//! +//! This feature is deprecated. +//! Enabling this feature does nothing - it exists for backwards-compatibility only. +//! It will be removed in a future version of this crate. +//! //! # Minimum Supported Rust Version (MSRV) //! //! This crate is guaranteed to compile on stable Rust 1.61 and up. It *might* From 3cbd536c391660b8c560314a5a13e97c174893df Mon Sep 17 00:00:00 2001 From: 9names <60134748+9names@users.noreply.github.com> Date: Sat, 11 Apr 2026 15:24:16 +1000 Subject: [PATCH 2/3] Remove inline-asm feature from CI jobs --- xtask/tests/ci.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xtask/tests/ci.rs b/xtask/tests/ci.rs index 410e59b9..62530e29 100644 --- a/xtask/tests/ci.rs +++ b/xtask/tests/ci.rs @@ -44,7 +44,7 @@ fn build(package: &str, target: &str, features: &[&str]) { #[rustfmt::skip] static PACKAGE_FEATURES: &[(&str, &[&str], &[&str])] = &[ - ("cortex-m", ALL_TARGETS, &["inline-asm", "cm7-r0p1", "critical-section-single-core"]), // no `linker-plugin-lto` since it's experimental + ("cortex-m", ALL_TARGETS, &["cm7-r0p1", "critical-section-single-core"]), // no `linker-plugin-lto` since it's experimental ("cortex-m-semihosting", ALL_TARGETS, &["no-semihosting", "jlink-quirks"]), ("panic-semihosting", ALL_TARGETS, &["exit", "jlink-quirks"]), ("panic-itm", NON_BASE_TARGETS, &[]), From f4c43daaa143edce3e477b251316cec148237e6d Mon Sep 17 00:00:00 2001 From: 9names <60134748+9names@users.noreply.github.com> Date: Sat, 11 Apr 2026 15:24:42 +1000 Subject: [PATCH 3/3] Update fn comments that used to refer to inline-asm --- cortex-m/src/register/apsr.rs | 2 -- cortex-m/src/register/lr.rs | 4 ---- cortex-m/src/register/pc.rs | 4 ---- 3 files changed, 10 deletions(-) diff --git a/cortex-m/src/register/apsr.rs b/cortex-m/src/register/apsr.rs index 4326bfe7..8284df53 100644 --- a/cortex-m/src/register/apsr.rs +++ b/cortex-m/src/register/apsr.rs @@ -49,8 +49,6 @@ impl Apsr { } /// Reads the CPU register -/// -/// **NOTE** This function is available if `cortex-m` is built with the `"inline-asm"` feature. #[inline] #[asm_cfg(cortex_m)] pub fn read() -> Apsr { diff --git a/cortex-m/src/register/lr.rs b/cortex-m/src/register/lr.rs index ed845ded..89e622ed 100644 --- a/cortex-m/src/register/lr.rs +++ b/cortex-m/src/register/lr.rs @@ -5,8 +5,6 @@ use core::arch::asm; use cortex_m_macros::asm_cfg; /// Reads the CPU register -/// -/// **NOTE** This function is available if `cortex-m` is built with the `"inline-asm"` feature. #[inline] #[asm_cfg(cortex_m)] pub fn read() -> u32 { @@ -17,8 +15,6 @@ pub fn read() -> u32 { /// Writes `bits` to the CPU register /// -/// **NOTE** This function is available if `cortex-m` is built with the `"inline-asm"` feature. -/// /// # Safety /// This function can't be used soundly. #[inline] diff --git a/cortex-m/src/register/pc.rs b/cortex-m/src/register/pc.rs index 1d2a38a0..4c51f392 100644 --- a/cortex-m/src/register/pc.rs +++ b/cortex-m/src/register/pc.rs @@ -5,8 +5,6 @@ use core::arch::asm; use cortex_m_macros::asm_cfg; /// Reads the CPU register -/// -/// **NOTE** This function is available if `cortex-m` is built with the `"inline-asm"` feature. #[inline] #[asm_cfg(cortex_m)] pub fn read() -> u32 { @@ -16,8 +14,6 @@ pub fn read() -> u32 { } /// Writes `bits` to the CPU register -/// -/// **NOTE** This function is available if `cortex-m` is built with the `"inline-asm"` feature. #[inline] #[asm_cfg(cortex_m)] pub unsafe fn write(bits: u32) {