@@ -73,7 +73,7 @@ pub mod fpb;
73
73
// NOTE(target_arch) is for documentation purposes
74
74
#[ cfg( any( has_fpu, target_arch = "x86_64" ) ) ]
75
75
pub mod fpu;
76
- #[ cfg( not( armv6m) ) ]
76
+ #[ cfg( all ( not( armv6m) , not ( armv8m_base ) ) ) ]
77
77
pub mod itm;
78
78
pub mod mpu;
79
79
pub mod nvic;
@@ -90,7 +90,9 @@ mod test;
90
90
/// Core peripherals
91
91
#[ allow( non_snake_case) ]
92
92
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.
95
+ #[ cfg( not( armv6m) ) ]
94
96
pub CBP : CBP ,
95
97
96
98
/// CPUID
@@ -102,13 +104,19 @@ pub struct Peripherals {
102
104
/// Data Watchpoint and Trace unit
103
105
pub DWT : DWT ,
104
106
105
- /// Flash Patch and Breakpoint unit (not present on Cortex-M0 variants)
107
+ /// Flash Patch and Breakpoint unit.
108
+ /// Not available on Armv6-M.
109
+ #[ cfg( not( armv6m) ) ]
106
110
pub FPB : FPB ,
107
111
108
- /// Floating Point Unit (only present on `thumbv7em-none-eabihf`)
112
+ /// Floating Point Unit.
113
+ /// Available only on `hf` targets.
114
+ #[ cfg( any( has_fpu, target_arch = "x86_64" ) ) ]
109
115
pub FPU : FPU ,
110
116
111
- /// Instrumentation Trace Macrocell (not present on Cortex-M0 variants)
117
+ /// Instrumentation Trace Macrocell.
118
+ /// Not available on Armv6-M and Armv8-M Baseline.
119
+ #[ cfg( all( not( armv6m) , not( armv8m_base) ) ) ]
112
120
pub ITM : ITM ,
113
121
114
122
/// Memory Protection Unit
@@ -123,7 +131,9 @@ pub struct Peripherals {
123
131
/// SysTick: System Timer
124
132
pub SYST : SYST ,
125
133
126
- /// Trace Port Interface Unit (not present on Cortex-M0 variants)
134
+ /// Trace Port Interface Unit.
135
+ /// Not available on Armv6-M.
136
+ #[ cfg( not( armv6m) ) ]
127
137
pub TPIU : TPIU ,
128
138
129
139
// Private field making `Peripherals` non-exhaustive. We don't use `#[non_exhaustive]` so we
@@ -155,6 +165,7 @@ impl Peripherals {
155
165
CORE_PERIPHERALS = true ;
156
166
157
167
Peripherals {
168
+ #[ cfg( not( armv6m) ) ]
158
169
CBP : CBP {
159
170
_marker : PhantomData ,
160
171
} ,
@@ -167,12 +178,15 @@ impl Peripherals {
167
178
DWT : DWT {
168
179
_marker : PhantomData ,
169
180
} ,
181
+ #[ cfg( not( armv6m) ) ]
170
182
FPB : FPB {
171
183
_marker : PhantomData ,
172
184
} ,
185
+ #[ cfg( any( has_fpu, target_arch = "x86_64" ) ) ]
173
186
FPU : FPU {
174
187
_marker : PhantomData ,
175
188
} ,
189
+ #[ cfg( all( not( armv6m) , not( armv8m_base) ) ) ]
176
190
ITM : ITM {
177
191
_marker : PhantomData ,
178
192
} ,
@@ -188,6 +202,7 @@ impl Peripherals {
188
202
SYST : SYST {
189
203
_marker : PhantomData ,
190
204
} ,
205
+ #[ cfg( not( armv6m) ) ]
191
206
TPIU : TPIU {
192
207
_marker : PhantomData ,
193
208
} ,
@@ -197,10 +212,12 @@ impl Peripherals {
197
212
}
198
213
199
214
/// Cache and branch predictor maintenance operations
215
+ #[ cfg( not( armv6m) ) ]
200
216
pub struct CBP {
201
217
_marker : PhantomData < * const ( ) > ,
202
218
}
203
219
220
+ #[ cfg( not( armv6m) ) ]
204
221
unsafe impl Send for CBP { }
205
222
206
223
#[ cfg( not( armv6m) ) ]
@@ -302,10 +319,12 @@ impl ops::Deref for DWT {
302
319
}
303
320
304
321
/// Flash Patch and Breakpoint unit
322
+ #[ cfg( not( armv6m) ) ]
305
323
pub struct FPB {
306
324
_marker : PhantomData < * const ( ) > ,
307
325
}
308
326
327
+ #[ cfg( not( armv6m) ) ]
309
328
unsafe impl Send for FPB { }
310
329
311
330
#[ cfg( not( armv6m) ) ]
@@ -328,10 +347,12 @@ impl ops::Deref for FPB {
328
347
}
329
348
330
349
/// Floating Point Unit
350
+ #[ cfg( any( has_fpu, target_arch = "x86_64" ) ) ]
331
351
pub struct FPU {
332
352
_marker : PhantomData < * const ( ) > ,
333
353
}
334
354
355
+ #[ cfg( any( has_fpu, target_arch = "x86_64" ) ) ]
335
356
unsafe impl Send for FPU { }
336
357
337
358
#[ cfg( any( has_fpu, target_arch = "x86_64" ) ) ]
@@ -354,13 +375,15 @@ impl ops::Deref for FPU {
354
375
}
355
376
356
377
/// Instrumentation Trace Macrocell
378
+ #[ cfg( all( not( armv6m) , not( armv8m_base) ) ) ]
357
379
pub struct ITM {
358
380
_marker : PhantomData < * const ( ) > ,
359
381
}
360
382
383
+ #[ cfg( all( not( armv6m) , not( armv8m_base) ) ) ]
361
384
unsafe impl Send for ITM { }
362
385
363
- #[ cfg( not( armv6m) ) ]
386
+ #[ cfg( all ( not( armv6m) , not ( armv8m_base ) ) ) ]
364
387
impl ITM {
365
388
/// Returns a pointer to the register block
366
389
#[ inline( always) ]
@@ -369,7 +392,7 @@ impl ITM {
369
392
}
370
393
}
371
394
372
- #[ cfg( not( armv6m) ) ]
395
+ #[ cfg( all ( not( armv6m) , not ( armv8m_base ) ) ) ]
373
396
impl ops:: Deref for ITM {
374
397
type Target = self :: itm:: RegisterBlock ;
375
398
@@ -379,7 +402,7 @@ impl ops::Deref for ITM {
379
402
}
380
403
}
381
404
382
- #[ cfg( not( armv6m) ) ]
405
+ #[ cfg( all ( not( armv6m) , not ( armv8m_base ) ) ) ]
383
406
impl ops:: DerefMut for ITM {
384
407
#[ inline( always) ]
385
408
fn deref_mut ( & mut self ) -> & mut Self :: Target {
@@ -484,10 +507,12 @@ impl ops::Deref for SYST {
484
507
}
485
508
486
509
/// Trace Port Interface Unit
510
+ #[ cfg( not( armv6m) ) ]
487
511
pub struct TPIU {
488
512
_marker : PhantomData < * const ( ) > ,
489
513
}
490
514
515
+ #[ cfg( not( armv6m) ) ]
491
516
unsafe impl Send for TPIU { }
492
517
493
518
#[ cfg( not( armv6m) ) ]
0 commit comments