From dd72f11186f6a815db495ed41636879b7db9614f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20J=C3=B6rdens?= Date: Thu, 16 Dec 2021 15:16:30 +0100 Subject: [PATCH 1/4] asm/inline: explicitly use asm macro MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit removed from prelude in current nightly https://github.com/rust-lang/rust/pull/91728 close #371 Signed-off-by: Robert Jördens --- asm/inline.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/asm/inline.rs b/asm/inline.rs index 5887bafb..13074995 100644 --- a/asm/inline.rs +++ b/asm/inline.rs @@ -7,6 +7,7 @@ //! applicable. use core::sync::atomic::{compiler_fence, Ordering}; +use core::arch::asm; #[inline(always)] pub unsafe fn __bkpt() { From 2bf12c62077cd5e533b5463256b3644e57a7c59d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20J=C3=B6rdens?= Date: Thu, 16 Dec 2021 20:51:27 +0100 Subject: [PATCH 2/4] fmt [nfc] --- asm/inline.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asm/inline.rs b/asm/inline.rs index 13074995..dd619253 100644 --- a/asm/inline.rs +++ b/asm/inline.rs @@ -6,8 +6,8 @@ //! All of these functions should be blanket-`unsafe`. `cortex-m` provides safe wrappers where //! applicable. -use core::sync::atomic::{compiler_fence, Ordering}; use core::arch::asm; +use core::sync::atomic::{compiler_fence, Ordering}; #[inline(always)] pub unsafe fn __bkpt() { From fcc09857b3cd61466ff86a58c2b16759766783fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20J=C3=B6rdens?= Date: Thu, 16 Dec 2021 21:19:36 +0100 Subject: [PATCH 3/4] asm/inline: also use asm macro in mods --- asm/inline.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/asm/inline.rs b/asm/inline.rs index dd619253..14771034 100644 --- a/asm/inline.rs +++ b/asm/inline.rs @@ -215,6 +215,7 @@ pub unsafe fn __bootstrap(msp: u32, rv: u32) -> ! { pub use self::v7m::*; #[cfg(any(armv7m, armv8m_main))] mod v7m { + use core::arch::asm; use core::sync::atomic::{compiler_fence, Ordering}; #[inline(always)] @@ -284,6 +285,8 @@ mod v7m { pub use self::v7em::*; #[cfg(armv7em)] mod v7em { + use core::arch::asm; + #[inline(always)] pub unsafe fn __basepri_max_cm7_r0p1(val: u8) { asm!( @@ -320,6 +323,8 @@ pub use self::v8m::*; /// Baseline and Mainline. #[cfg(armv8m)] mod v8m { + use core::arch::asm; + #[inline(always)] pub unsafe fn __tt(mut target: u32) -> u32 { asm!("tt {target}, {target}", target = inout(reg) target); @@ -367,6 +372,8 @@ pub use self::v8m_main::*; /// Mainline only. #[cfg(armv8m_main)] mod v8m_main { + use core::arch::asm; + #[inline(always)] pub unsafe fn __msplim_r() -> u32 { let r; @@ -397,6 +404,8 @@ pub use self::fpu::*; /// All targets with FPU. #[cfg(has_fpu)] mod fpu { + use core::arch::asm; + #[inline(always)] pub unsafe fn __fpscr_r() -> u32 { let r; From 46a3320d11cade9c9a5f2a914fb5a5bcb53b31d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20J=C3=B6rdens?= Date: Thu, 16 Dec 2021 21:25:42 +0100 Subject: [PATCH 4/4] asm: silence warning about asm being stable --- src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index a2677503..09146390 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -76,6 +76,8 @@ // - A generated #[derive(Debug)] function (in which case the attribute needs // to be applied to the struct). #![deny(clippy::missing_inline_in_public_items)] +// Don't warn about feature(asm) being stable on Rust >= 1.59.0 +#![allow(stable_features)] extern crate bare_metal; extern crate volatile_register;