Skip to content

Commit 9c1a467

Browse files
committed
Update cfg gates with Armv8-M
Update cfg attributes and code documentation to take into consideration the new Armv8-M architecture profiles. Signed-off-by: Hugues de Valon <[email protected]>
1 parent 6a0432a commit 9c1a467

File tree

7 files changed

+19
-15
lines changed

7 files changed

+19
-15
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pub mod asm;
6262
#[cfg(armv8m)]
6363
pub mod cmse;
6464
pub mod interrupt;
65-
#[cfg(not(armv6m))]
65+
#[cfg(all(not(armv6m), not(armv8m_base)))]
6666
pub mod itm;
6767
pub mod peripheral;
6868
pub mod register;

src/peripheral/cbp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Cache and branch predictor maintenance operations
22
//!
3-
//! *NOTE* Available only on ARMv7-M (`thumbv7*m-none-eabi*`)
3+
//! *NOTE* Not available on Armv6-M.
44
55
use volatile_register::WO;
66

src/peripheral/fpb.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Flash Patch and Breakpoint unit
22
//!
3-
//! *NOTE* Available only on ARMv7-M (`thumbv7*m-none-eabi*`)
3+
//! *NOTE* Not available on Armv6-M.
44
55
use volatile_register::{RO, RW, WO};
66

src/peripheral/fpu.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Floating Point Unit
22
//!
3-
//! *NOTE* Available only on ARMv7E-M (`thumbv7em-none-eabihf`)
3+
//! *NOTE* Available only on targets with a Floating Point Unit (FPU) extension.
44
55
use volatile_register::{RO, RW};
66

src/peripheral/itm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Instrumentation Trace Macrocell
22
//!
3-
//! *NOTE* Available only on ARMv7-M (`thumbv7*m-none-eabi*`)
3+
//! *NOTE* Not available on Armv6-M and Armv8-M Baseline.
44
55
use core::cell::UnsafeCell;
66
use core::ptr;

src/peripheral/mod.rs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pub mod fpb;
7373
// NOTE(target_arch) is for documentation purposes
7474
#[cfg(any(has_fpu, target_arch = "x86_64"))]
7575
pub mod fpu;
76-
#[cfg(not(armv6m))]
76+
#[cfg(all(not(armv6m), not(armv8m_base)))]
7777
pub mod itm;
7878
pub mod mpu;
7979
pub mod nvic;
@@ -90,7 +90,8 @@ mod test;
9090
/// Core peripherals
9191
#[allow(non_snake_case)]
9292
pub struct Peripherals {
93-
/// Cache and branch predictor maintenance operations (not present on Cortex-M0 variants)
93+
/// Cache and branch predictor maintenance operations.
94+
/// Not available on Armv6-M.
9495
pub CBP: CBP,
9596

9697
/// CPUID
@@ -102,13 +103,15 @@ pub struct Peripherals {
102103
/// Data Watchpoint and Trace unit
103104
pub DWT: DWT,
104105

105-
/// Flash Patch and Breakpoint unit (not present on Cortex-M0 variants)
106+
/// Flash Patch and Breakpoint unit.
107+
/// Not available on Armv6-M.
106108
pub FPB: FPB,
107109

108-
/// Floating Point Unit (only present on `thumbv7em-none-eabihf`)
110+
/// Floating Point Unit.
109111
pub FPU: FPU,
110112

111-
/// Instrumentation Trace Macrocell (not present on Cortex-M0 variants)
113+
/// Instrumentation Trace Macrocell.
114+
/// Not available on Armv6-M and Armv8-M Baseline.
112115
pub ITM: ITM,
113116

114117
/// Memory Protection Unit
@@ -123,7 +126,8 @@ pub struct Peripherals {
123126
/// SysTick: System Timer
124127
pub SYST: SYST,
125128

126-
/// Trace Port Interface Unit (not present on Cortex-M0 variants)
129+
/// Trace Port Interface Unit.
130+
/// Not available on Armv6-M.
127131
pub TPIU: TPIU,
128132

129133
// Private field making `Peripherals` non-exhaustive. We don't use `#[non_exhaustive]` so we
@@ -360,7 +364,7 @@ pub struct ITM {
360364

361365
unsafe impl Send for ITM {}
362366

363-
#[cfg(not(armv6m))]
367+
#[cfg(all(not(armv6m), not(armv8m_base)))]
364368
impl ITM {
365369
/// Returns a pointer to the register block
366370
#[inline(always)]
@@ -369,7 +373,7 @@ impl ITM {
369373
}
370374
}
371375

372-
#[cfg(not(armv6m))]
376+
#[cfg(all(not(armv6m), not(armv8m_base)))]
373377
impl ops::Deref for ITM {
374378
type Target = self::itm::RegisterBlock;
375379

@@ -379,7 +383,7 @@ impl ops::Deref for ITM {
379383
}
380384
}
381385

382-
#[cfg(not(armv6m))]
386+
#[cfg(all(not(armv6m), not(armv8m_base)))]
383387
impl ops::DerefMut for ITM {
384388
#[inline(always)]
385389
fn deref_mut(&mut self) -> &mut Self::Target {

src/peripheral/tpiu.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Trace Port Interface Unit;
22
//!
3-
//! *NOTE* Available only on ARMv7-M (`thumbv7*m-none-eabi*`)
3+
//! *NOTE* Not available on Armv6-M.
44
55
use volatile_register::{RO, RW, WO};
66

0 commit comments

Comments
 (0)