Skip to content

Commit eacad52

Browse files
bors[bot]jordens
andauthored
Merge #372
372: asm/inline: explicitly use asm macro r=adamgreig a=jordens `asm!()` removed from prelude in current nightly rust-lang/rust#91728 close #371 This is also a good candidate for the cortex-m v0.7 series. Co-authored-by: Robert Jördens <[email protected]>
2 parents ae1d2a6 + 46a3320 commit eacad52

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

asm/inline.rs

+10
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//! All of these functions should be blanket-`unsafe`. `cortex-m` provides safe wrappers where
77
//! applicable.
88
9+
use core::arch::asm;
910
use core::sync::atomic::{compiler_fence, Ordering};
1011

1112
#[inline(always)]
@@ -214,6 +215,7 @@ pub unsafe fn __bootstrap(msp: u32, rv: u32) -> ! {
214215
pub use self::v7m::*;
215216
#[cfg(any(armv7m, armv8m_main))]
216217
mod v7m {
218+
use core::arch::asm;
217219
use core::sync::atomic::{compiler_fence, Ordering};
218220

219221
#[inline(always)]
@@ -283,6 +285,8 @@ mod v7m {
283285
pub use self::v7em::*;
284286
#[cfg(armv7em)]
285287
mod v7em {
288+
use core::arch::asm;
289+
286290
#[inline(always)]
287291
pub unsafe fn __basepri_max_cm7_r0p1(val: u8) {
288292
asm!(
@@ -319,6 +323,8 @@ pub use self::v8m::*;
319323
/// Baseline and Mainline.
320324
#[cfg(armv8m)]
321325
mod v8m {
326+
use core::arch::asm;
327+
322328
#[inline(always)]
323329
pub unsafe fn __tt(mut target: u32) -> u32 {
324330
asm!("tt {target}, {target}", target = inout(reg) target);
@@ -366,6 +372,8 @@ pub use self::v8m_main::*;
366372
/// Mainline only.
367373
#[cfg(armv8m_main)]
368374
mod v8m_main {
375+
use core::arch::asm;
376+
369377
#[inline(always)]
370378
pub unsafe fn __msplim_r() -> u32 {
371379
let r;
@@ -396,6 +404,8 @@ pub use self::fpu::*;
396404
/// All targets with FPU.
397405
#[cfg(has_fpu)]
398406
mod fpu {
407+
use core::arch::asm;
408+
399409
#[inline(always)]
400410
pub unsafe fn __fpscr_r() -> u32 {
401411
let r;

src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@
7676
// - A generated #[derive(Debug)] function (in which case the attribute needs
7777
// to be applied to the struct).
7878
#![deny(clippy::missing_inline_in_public_items)]
79+
// Don't warn about feature(asm) being stable on Rust >= 1.59.0
80+
#![allow(stable_features)]
7981

8082
extern crate bare_metal;
8183
extern crate volatile_register;

0 commit comments

Comments
 (0)