@@ -79,13 +79,17 @@ pub mod cbp;
79
79
pub mod cpuid;
80
80
pub mod dcb;
81
81
pub mod dwt;
82
+ #[ cfg( any( armv7m, test) ) ]
82
83
pub mod fpb;
84
+ #[ cfg( any( has_fpu, test) ) ]
83
85
pub mod fpu;
86
+ #[ cfg( any( armv7m, test) ) ]
84
87
pub mod itm;
85
88
pub mod mpu;
86
89
pub mod nvic;
87
90
pub mod scb;
88
91
pub mod syst;
92
+ #[ cfg( any( armv7m, test) ) ]
89
93
pub mod tpiu;
90
94
91
95
#[ cfg( test) ]
@@ -106,10 +110,13 @@ pub struct Peripherals {
106
110
/// Data Watchpoint and Trace unit
107
111
pub DWT : DWT ,
108
112
/// Flash Patch and Breakpoint unit
113
+ #[ cfg( armv7m) ]
109
114
pub FPB : FPB ,
110
115
/// Floating Point Unit
116
+ #[ cfg( has_fpu) ]
111
117
pub FPU : FPU ,
112
118
/// Instrumentation Trace Macrocell
119
+ #[ cfg( armv7m) ]
113
120
pub ITM : ITM ,
114
121
/// Memory Protection Unit
115
122
pub MPU : MPU ,
@@ -120,6 +127,7 @@ pub struct Peripherals {
120
127
/// SysTick: System Timer
121
128
pub SYST : SYST ,
122
129
/// Trace Port Interface Unit;
130
+ #[ cfg( armv7m) ]
123
131
pub TPIU : TPIU ,
124
132
}
125
133
@@ -161,12 +169,15 @@ impl Peripherals {
161
169
DWT : DWT {
162
170
_marker : PhantomData ,
163
171
} ,
172
+ #[ cfg( armv7m) ]
164
173
FPB : FPB {
165
174
_marker : PhantomData ,
166
175
} ,
176
+ #[ cfg( has_fpu) ]
167
177
FPU : FPU {
168
178
_marker : PhantomData ,
169
179
} ,
180
+ #[ cfg( armv7m) ]
170
181
ITM : ITM {
171
182
_marker : PhantomData ,
172
183
} ,
@@ -182,6 +193,7 @@ impl Peripherals {
182
193
SYST : SYST {
183
194
_marker : PhantomData ,
184
195
} ,
196
+ #[ cfg( armv7m) ]
185
197
TPIU : TPIU {
186
198
_marker : PhantomData ,
187
199
} ,
@@ -282,17 +294,20 @@ impl Deref for DWT {
282
294
}
283
295
284
296
/// Flash Patch and Breakpoint unit
297
+ #[ cfg( any( armv7m, test) ) ]
285
298
pub struct FPB {
286
299
_marker : PhantomData < * const ( ) > ,
287
300
}
288
301
302
+ #[ cfg( any( armv7m, test) ) ]
289
303
impl FPB {
290
304
/// Returns a pointer to the register block
291
305
pub fn ptr ( ) -> * const fpb:: RegisterBlock {
292
306
0xE000_2000 as * const _
293
307
}
294
308
}
295
309
310
+ #[ cfg( armv7m) ]
296
311
impl Deref for FPB {
297
312
type Target = self :: fpb:: RegisterBlock ;
298
313
@@ -302,18 +317,20 @@ impl Deref for FPB {
302
317
}
303
318
304
319
/// Floating Point Unit
320
+ #[ cfg( any( has_fpu, test) ) ]
305
321
pub struct FPU {
306
322
_marker : PhantomData < * const ( ) > ,
307
323
}
308
324
325
+ #[ cfg( any( has_fpu, test) ) ]
309
326
impl FPU {
310
327
/// Returns a pointer to the register block
311
328
pub fn ptr ( ) -> * const fpu:: RegisterBlock {
312
329
0xE000_EF30 as * const _
313
330
}
314
331
}
315
332
316
- #[ cfg( any ( has_fpu, test ) ) ]
333
+ #[ cfg( has_fpu) ]
317
334
impl Deref for FPU {
318
335
type Target = self :: fpu:: RegisterBlock ;
319
336
@@ -323,17 +340,20 @@ impl Deref for FPU {
323
340
}
324
341
325
342
/// Instrumentation Trace Macrocell
343
+ #[ cfg( any( armv7m, test) ) ]
326
344
pub struct ITM {
327
345
_marker : PhantomData < * const ( ) > ,
328
346
}
329
347
348
+ #[ cfg( any( armv7m, test) ) ]
330
349
impl ITM {
331
350
/// Returns a pointer to the register block
332
351
pub fn ptr ( ) -> * mut itm:: RegisterBlock {
333
352
0xE000_0000 as * mut _
334
353
}
335
354
}
336
355
356
+ #[ cfg( armv7m) ]
337
357
impl Deref for ITM {
338
358
type Target = self :: itm:: RegisterBlock ;
339
359
@@ -342,6 +362,7 @@ impl Deref for ITM {
342
362
}
343
363
}
344
364
365
+ #[ cfg( armv7m) ]
345
366
impl DerefMut for ITM {
346
367
fn deref_mut ( & mut self ) -> & mut Self :: Target {
347
368
unsafe { & mut * Self :: ptr ( ) }
@@ -429,17 +450,20 @@ impl Deref for SYST {
429
450
}
430
451
431
452
/// Trace Port Interface Unit;
453
+ #[ cfg( any( armv7m, test) ) ]
432
454
pub struct TPIU {
433
455
_marker : PhantomData < * const ( ) > ,
434
456
}
435
457
458
+ #[ cfg( any( armv7m, test) ) ]
436
459
impl TPIU {
437
460
/// Returns a pointer to the register block
438
461
pub fn ptr ( ) -> * const tpiu:: RegisterBlock {
439
462
0xE004_0000 as * const _
440
463
}
441
464
}
442
465
466
+ #[ cfg( armv7m) ]
443
467
impl Deref for TPIU {
444
468
type Target = self :: tpiu:: RegisterBlock ;
445
469
0 commit comments