Skip to content

Commit 2cd6092

Browse files
committed
ARMv6-M: remove fields that are not available from cpuid::RegisterBlock
1 parent 17bd0c8 commit 2cd6092

File tree

2 files changed

+47
-18
lines changed

2 files changed

+47
-18
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
3838
- [breaking-change] removed the `iabr` field from `scb::RegisterBlock` on ARMv6-M. This register is
3939
not available on that sub-architecture.
4040

41+
- [breaking-change] removed several fields from `cpuid::RegisterBlock` on ARMv6-M. These registers
42+
are not available on that sub-architecture.
43+
4144
### Removed
4245

4346
- [breaking-change] The `exception` module has been removed. A replacement for `Exception::active`

src/peripheral/cpuid.rs

+44-18
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,66 @@
11
//! CPUID
22
33
use volatile_register::RO;
4-
#[cfg(any(armv7m, target_arch = "x86_64"))]
4+
#[cfg(not(armv6m))]
55
use volatile_register::RW;
66

7-
#[cfg(any(armv7m, target_arch = "x86_64"))]
7+
#[cfg(not(armv6m))]
88
use peripheral::CPUID;
99

1010
/// Register block
1111
#[repr(C)]
1212
pub struct RegisterBlock {
1313
/// CPUID base
1414
pub base: RO<u32>,
15-
reserved0: [u32; 15],
16-
/// Processor Feature
15+
16+
_reserved0: [u32; 15],
17+
18+
/// Processor Feature (not present on Cortex-M0 variants)
19+
#[cfg(not(armv6m))]
1720
pub pfr: [RO<u32>; 2],
18-
/// Debug Feature
21+
#[cfg(armv6m)]
22+
_reserved1: [u32; 2],
23+
24+
/// Debug Feature (not present on Cortex-M0 variants)
25+
#[cfg(not(armv6m))]
1926
pub dfr: RO<u32>,
20-
/// Auxiliary Feature
27+
#[cfg(armv6m)]
28+
_reserved2: u32,
29+
30+
/// Auxiliary Feature (not present on Cortex-M0 variants)
31+
#[cfg(not(armv6m))]
2132
pub afr: RO<u32>,
22-
/// Memory Model Feature
33+
#[cfg(armv6m)]
34+
_reserved3: u32,
35+
36+
/// Memory Model Feature (not present on Cortex-M0 variants)
37+
#[cfg(not(armv6m))]
2338
pub mmfr: [RO<u32>; 4],
24-
/// Instruction Set Attribute
39+
#[cfg(armv6m)]
40+
_reserved4: [u32; 4],
41+
42+
/// Instruction Set Attribute (not present on Cortex-M0 variants)
43+
#[cfg(not(armv6m))]
2544
pub isar: [RO<u32>; 5],
26-
reserved1: u32,
27-
/// Cache Level ID
28-
#[cfg(any(armv7m, target_arch = "x86_64"))]
45+
#[cfg(armv6m)]
46+
_reserved5: [u32; 5],
47+
48+
_reserved6: u32,
49+
50+
/// Cache Level ID (only present on Cortex-M7)
51+
#[cfg(not(armv6m))]
2952
pub clidr: RO<u32>,
30-
/// Cache Type
31-
#[cfg(any(armv7m, target_arch = "x86_64"))]
53+
54+
/// Cache Type (only present on Cortex-M7)
55+
#[cfg(not(armv6m))]
3256
pub ctr: RO<u32>,
33-
/// Cache Size ID
34-
#[cfg(any(armv7m, target_arch = "x86_64"))]
57+
58+
/// Cache Size ID (only present on Cortex-M7)
59+
#[cfg(not(armv6m))]
3560
pub ccsidr: RO<u32>,
36-
/// Cache Size Selection
37-
#[cfg(any(armv7m, target_arch = "x86_64"))]
61+
62+
/// Cache Size Selection (only present on Cortex-M7)
63+
#[cfg(not(armv6m))]
3864
pub csselr: RW<u32>,
3965
}
4066

@@ -47,7 +73,7 @@ pub enum CsselrCacheType {
4773
Instruction = 1,
4874
}
4975

50-
#[cfg(any(armv7m, target_arch = "x86_64"))]
76+
#[cfg(not(armv6m))]
5177
impl CPUID {
5278
/// Selects the current CCSIDR
5379
///

0 commit comments

Comments
 (0)