Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions cortex-m/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,24 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Changed

- Breaking: Rewrote the `NVIC` peripheral to use `derive-mmio`.
- `Peripherals::NVIC` is now an `nvic::OwnedRegisterBlock`. Pass it to
`NVIC::new` to get the `NVIC` driver.
- The fields of `nvic::RegisterBlock` are private. Use the generated accessor
methods instead.
- `ICER` and `ICPR` are write-only. Read the state from `ISER` and `ISPR`.

### Added

- `NVIC::new` and `NVIC::steal`.
- `nvic::BASE_ADDRESS`.

### Removed

- Breaking: `NVIC::PTR` and the deprecated `NVIC::ptr()`.

## [v0.7.10] - 2026-10-21

### Removed
Expand Down
1 change: 1 addition & 0 deletions cortex-m/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ rust-version = "1.85"
[dependencies]
bare-metal = { version = "0.2.4", features = ["const-fn"] }
critical-section = "1.0.0"
derive-mmio = "0.8"
volatile-register = "0.2.2"
bitfield = "0.13.2"
eh0 = { package = "embedded-hal", version = "0.2.4" }
Expand Down
36 changes: 4 additions & 32 deletions cortex-m/src/peripheral/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ pub mod tpiu;
#[cfg(test)]
mod test;

pub use nvic::NVIC;

// NOTE the `PhantomData` used in the peripherals proxy is to make them `Send` but *not* `Sync`

/// Core peripherals
Expand Down Expand Up @@ -131,7 +133,7 @@ pub struct Peripherals {
pub MPU: MPU,

/// Nested Vector Interrupt Controller
pub NVIC: NVIC,
pub NVIC: nvic::OwnedRegisterBlock<{ nvic::BASE_ADDRESS }>,

/// Security Attribution Unit
pub SAU: SAU,
Expand Down Expand Up @@ -213,9 +215,7 @@ impl Peripherals {
MPU: MPU {
_marker: PhantomData,
},
NVIC: NVIC {
_marker: PhantomData,
},
NVIC: nvic::OwnedRegisterBlock::new(),
SAU: SAU {
_marker: PhantomData,
},
Expand Down Expand Up @@ -546,34 +546,6 @@ impl ops::Deref for MPU {
}
}

/// Nested Vector Interrupt Controller
pub struct NVIC {
_marker: PhantomData<*const ()>,
}

unsafe impl Send for NVIC {}

impl NVIC {
/// Pointer to the register block
pub const PTR: *const nvic::RegisterBlock = 0xE000_E100 as *const _;

/// Returns a pointer to the register block
#[inline(always)]
#[deprecated(since = "0.7.5", note = "Use the associated constant `PTR` instead")]
pub const fn ptr() -> *const nvic::RegisterBlock {
Self::PTR
}
}

impl ops::Deref for NVIC {
type Target = self::nvic::RegisterBlock;

#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}

/// Security Attribution Unit
pub struct SAU {
_marker: PhantomData<*const ()>,
Expand Down
Loading
Loading