Skip to content

Commit 8bd9668

Browse files
committed
fix: Add asm_cfg to all coprocessor instructions
1 parent e3ebba5 commit 8bd9668

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

cortex-m/src/coprocessor.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! Coprocessor access assembly instructions.
22
3+
use cortex_m_macros::asm_cfg;
4+
35
/// This instruction moves one Register to a Coprocessor Register.
46
/// This function generates inline assembly and needs the instruction configuration
57
/// during compilation time (i.e. as `const`).
@@ -10,6 +12,7 @@
1012
/// - CRN: Coprocessor register N.
1113
/// - CRM: Coprocessor register M.
1214
/// - OP2: Second optional operation for the coprocessor.
15+
#[asm_cfg(any(armv7m, armv8m))]
1316
#[inline(always)]
1417
pub unsafe fn mcr<const CP: u32, const OP1: u32, const CRN: u32, const CRM: u32, const OP2: u32>(
1518
value: u32,
@@ -38,6 +41,7 @@ pub unsafe fn mcr<const CP: u32, const OP1: u32, const CRN: u32, const CRM: u32,
3841
/// - CRN: Coprocessor register N.
3942
/// - CRM: Coprocessor register M.
4043
/// - OP2: Second optional operation for the coprocessor.
44+
#[asm_cfg(any(armv7m, armv8m))]
4145
#[inline(always)]
4246
pub unsafe fn mrc<const CP: u32, const OP1: u32, const CRN: u32, const CRM: u32, const OP2: u32>()
4347
-> u32 {
@@ -67,6 +71,7 @@ pub unsafe fn mrc<const CP: u32, const OP1: u32, const CRN: u32, const CRM: u32,
6771
/// - CP: The coprocessor's index.
6872
/// - OP1: First optional operation for the coprocessor.
6973
/// - CRM: Coprocessor register M.
74+
#[asm_cfg(any(armv7m, armv8m))]
7075
#[inline(always)]
7176
pub unsafe fn mcrr<const CP: u32, const OP1: u32, const CRM: u32>(a: u32, b: u32) {
7277
unsafe {
@@ -90,6 +95,7 @@ pub unsafe fn mcrr<const CP: u32, const OP1: u32, const CRM: u32>(a: u32, b: u32
9095
/// - CP: The coprocessor's index.
9196
/// - OP1: First optional operation for the coprocessor.
9297
/// - CRM: Coprocessor register M.
98+
#[asm_cfg(any(armv7m, armv8m))]
9399
#[inline(always)]
94100
pub unsafe fn mrrc<const CP: u32, const OPC: u32, const CRM: u32>() -> (u32, u32) {
95101
// Preallocate the values.

0 commit comments

Comments
 (0)