1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
#![cfg_attr(feature = "cargo-clippy", allow(doc_markdown))]
use drone_core::reg::map;
use reg::prelude::*;
include!(concat!(env!("OUT_DIR"), "/svd_reg_map.rs"));
map! {
/// Instrumentation trace macrocell.
pub mod ITM;
/// Trace Privilege Register.
TPR {
0xE000_0E40 0x20 0x0000_0000
RReg WReg;
/// Bit mask to enable unprivileged access to ITM stimulus ports.
PRIVMASK { 0 32 RRRegField WWRegField }
}
/// Trace Control Register.
TCR {
0xE000_0E80 0x20 0x0000_0000
RReg WReg;
/// Indicates whether the ITM is currently processing events.
BUSY { 23 1 RRRegField RoRRegField }
/// Identifier for multi-source trace stream formatting.
TraceBusID { 16 7 RRRegField WWRegField }
/// Global timestamp frequency.
GTSFREQ { 10 2 RRRegField WWRegField }
/// Local timestamp prescaler, used with the trace packet reference clock.
TSPrescale { 8 2 RRRegField WWRegField }
/// Enables asynchronous clocking of the timestamp counter.
SWOENA { 4 1 RRRegField WWRegField }
/// Enables forwarding of hardware event packet from the DWT unit to the ITM
/// for output to the TPIU.
TXENA { 3 1 RRRegField WWRegField }
/// Enables Synchronization packet transmission for a synchronous TPIU.
SYNCENA { 2 1 RRRegField WWRegField }
/// Enables Local timestamp generation.
TSENA { 1 1 RRRegField WWRegField }
/// Enables the ITM.
ITMENA { 0 1 RRRegField WWRegField }
}
/// ITM lock access register.
LAR {
0xE000_0FB0 0x20 0x0000_0000
WReg WoReg;
/// Write `0xC5ACCE55` to unlock Write Access to the other ITM registers.
UNLOCK { 0 32 WWRegField WoWRegField }
}
}
map! {
/// System control block.
pub mod SCB;
/// Interrupt control and state register.
ICSR {
0xE000_ED04 0x20 0x0000_0000
RReg WReg WoReg;
/// NMI set-pending bit.
NMIPENDSET { 31 1 RRRegField WWRegField WoWRegField }
/// PendSV set-pending bit.
PENDSVSET { 28 1 RRRegField WWRegField WoWRegField }
/// PendSV clear-pending bit.
PENDSVCLR { 27 1 WWRegField WoWRegField }
/// SysTick exception set-pending bit.
PENDSTSET { 26 1 RRRegField WWRegField WoWRegField }
/// SysTick exception clear-pending bit.
PENDSTCLR { 25 1 WWRegField WoWRegField }
/// Interrupt pending flag, excluding NMI and Faults.
ISRPENDING { 22 1 RRRegField RoRRegField }
/// Pending vector. Indicates the exception number of the highest priority
/// pending enabled exception.
VECTPENDING { 12 7 RRRegField RoRRegField }
/// Return to base level. Indicates whether there are preempted active
/// exceptions.
RETTOBASE { 11 1 RRRegField RoRRegField }
/// Active vector. Contains the active exception number.
VECTACTIVE { 0 9 RRRegField RoRRegField }
}
/// Application interrupt and reset control register.
AIRCR {
0xE000_ED0C 0x20 0xFA05_0000
RReg WReg;
/// Register key. On writes, write `0x5FA` to `VECTKEY`, otherwise the write
/// is ignored.
VECTKEY { 16 16 RRRegField WWRegField }
/// Data endianness bit.
ENDIANESS { 15 1 RRRegField RoRRegField }
/// Interrupt priority grouping field.
PRIGROUP { 8 3 RRRegField WWRegField }
/// System reset request.
SYSRESETREQ { 2 1 WWRegField WoWRegField }
/// Clears all active state information for exceptions.
VECTCLRACTIVE { 1 1 WWRegField WoWRegField }
/// Resets the processor (except debug logic), but this will not reset
/// circuits outside the processor.
VECTRESET { 0 1 WWRegField WoWRegField }
}
/// System control register.
SCR {
0xE000_ED10 0x20 0x0000_0000
RReg WReg;
/// Send Event on Pending bit.
SEVEONPEND { 4 1 RRRegField WWRegField }
/// Controls whether the processor uses sleep or deep sleep as its low power
/// mode.
SLEEPDEEP { 2 1 RRRegField WWRegField }
/// Configures sleep-on-exit when returning from Handler mode to Thread
/// mode.
SLEEPONEXIT { 1 1 RRRegField WWRegField }
}
/// Configuration and control register.
CCR {
0xE000_ED14 0x20 0x0000_0200
RReg WReg;
/// Force exception stacking start in double word aligned address.
STKALIGN { 9 1 RRRegField WWRegField }
/// Ignore data bus fault during HardFault and NMI handlers.
BFHFNMIGN { 8 1 RRRegField WWRegField }
/// Trap on divide by 0.
DIV_0_TRP { 4 1 RRRegField WWRegField }
/// Trap on unaligned accesses.
UNALIGN_TRP { 3 1 RRRegField WWRegField }
/// Enables unprivileged software access to Software Trigger Interrupt
/// Register.
USERSETMPEND { 1 1 RRRegField WWRegField }
/// Non-base thread enable.
NONBASETHRDENA { 0 1 RRRegField WWRegField }
}
/// System handler priority register 1.
SHPR1 {
0xE000_ED18 0x20 0x0000_0000
RReg WReg;
/// Priority of system handler 6, usage fault.
PRI_USAGE_FAULT { 16 8 RRRegField WWRegField }
/// Priority of system handler 5, bus fault.
PRI_BUS_FAULT { 8 8 RRRegField WWRegField }
/// Priority of system handler 4, memory management fault.
PRI_MEM_MANAGE { 0 8 RRRegField WWRegField }
}
/// System handler priority register 2.
SHPR2 {
0xE000_ED1C 0x20 0x0000_0000
RReg WReg;
/// Priority of system handler 11, SVCall.
PRI_SV_CALL { 24 8 RRRegField WWRegField }
}
/// System handler priority register 3.
SHPR3 {
0xE000_ED20 0x20 0x0000_0000
RReg WReg;
/// Priority of system handler 15, SysTick exception.
PRI_SYS_TICK { 24 8 RRRegField WWRegField }
/// Priority of system handler 14, PendSV.
PRI_PEND_SV { 16 8 RRRegField WWRegField }
}
/// System handler control and state register.
SHCSR {
0xE000_ED24 0x20 0x0000_0000
RReg WReg;
/// Usage fault enable bit.
USGFAULTENA { 18 1 RRRegField WWRegField }
/// Bus fault enable bit.
BUSFAULTENA { 17 1 RRRegField WWRegField }
/// Memory management fault enable bit.
MEMFAULTENA { 16 1 RRRegField WWRegField }
/// SVC call pending bit.
SVCALLPENDED { 15 1 RRRegField WWRegField }
/// Bus fault exception pending bit.
BUSFAULTPENDED { 14 1 RRRegField WWRegField }
/// Memory management fault exception pending bit.
MEMFAULTPENDED { 13 1 RRRegField WWRegField }
/// Usage fault exception pending bit.
USGFAULTPENDED { 12 1 RRRegField WWRegField }
/// SysTick exception active bit.
SYSTICKACT { 11 1 RRRegField WWRegField }
/// PendSV exception active bit.
PENDSVACT { 10 1 RRRegField WWRegField }
/// Debug monitor active bit.
MONITORACT { 8 1 RRRegField WWRegField }
/// SVC call active bit.
SVCALLACT { 7 1 RRRegField WWRegField }
/// Usage fault exception active bit.
USGFAULTACT { 3 1 RRRegField WWRegField }
/// Bus fault exception active bit.
BUSFAULTACT { 1 1 RRRegField WWRegField }
/// Memory management fault exception active bit.
MEMFAULTACT { 0 1 RRRegField WWRegField }
}
/// MemManage Status Register.
MMFSR {
0xE000_ED28 0x8 0x0000_0000
RReg WReg;
/// MMFAR has valid contents.
MMARVALID { 7 1 RRRegField WWRegField }
/// A MemManage fault occurred during FP lazy state preservation.
MLSPERR { 5 1 RRRegField WWRegField }
/// A derived MemManage fault occurred on exception entry.
MSTKERR { 4 1 RRRegField WWRegField }
/// A derived MemManage fault occurred on exception return.
MUNSTKERR { 3 1 RRRegField WWRegField }
/// Data access violation. The MMFAR shows the data address that the load or
/// store tried to access.
DACCVIOL { 1 1 RRRegField WWRegField }
/// MPU or Execute Never (XN) default memory map access violation on an
/// instruction fetch has occurred. The fault is signalled only if the
/// instruction is issued.
IACCVIOL { 0 1 RRRegField WWRegField }
}
/// BusFault Status Register.
BFSR {
0xE000_ED29 0x8 0x0000_0000
RReg WReg;
/// BFAR has valid contents.
BFARVALID { 7 1 RRRegField WWRegField }
/// A bus fault occurred during FP lazy state preservation.
LSPERR { 5 1 RRRegField WWRegField }
/// A derived bus fault has occurred on exception entry.
STKERR { 4 1 RRRegField WWRegField }
/// A derived bus fault has occurred on exception return.
UNSTKERR { 3 1 RRRegField WWRegField }
/// Imprecise data access error has occurred.
IMPRECISERR { 2 1 RRRegField WWRegField }
/// A precise data access error has occurred, and the processor has written
/// the faulting address to the BFAR.
PRECISERR { 1 1 RRRegField WWRegField }
/// A bus fault on an instruction prefetch has occurred. The fault is
/// signaled only if the instruction is issued.
IBUSERR { 0 1 RRRegField WWRegField }
}
/// UsageFault Status Register.
UFSR {
0xE000_ED2A 0x10 0x0000_0000
RReg WReg;
/// Divide by zero error has occurred.
DIVBYZERO { 9 1 RRRegField WWRegField }
/// Unaligned access error has occurred.
UNALIGNED { 8 1 RRRegField WWRegField }
/// A coprocessor access error has occurred. This shows that the coprocessor
/// is disabled or not present.
NOCP { 3 1 RRRegField WWRegField }
/// An integrity check error has occurred on EXC_RETURN.
INVPC { 2 1 RRRegField WWRegField }
/// Instruction executed with invalid EPSR.T or EPSR.IT field.
INVSTATE { 1 1 RRRegField WWRegField }
/// The processor has attempted to execute an undefined instruction.
UNDEFINSTR { 0 1 RRRegField WWRegField }
}
/// HardFault Status Register.
HFSR {
0xE000_ED2C 0x20 0x0000_0000
RReg WReg;
/// Debug event has occurred. The Debug Fault Status Register has been
/// updated.
DEBUGEVT { 31 1 RRRegField WWRegField }
/// Indicates that a fault with configurable priority has been escalated to
/// a HardFault exception, because it could not be made active, because of
/// priority or because it was disabled.
FORCED { 30 1 RRRegField WWRegField }
/// Indicates when a fault has occurred because of a vector table read error
/// on exception processing.
VECTTBL { 1 1 RRRegField WWRegField }
}
/// Debug Fault Status Register.
DFSR {
0xE000_ED30 0x20 0x0000_0000
RReg WReg;
/// Indicates a debug event generated because of the assertion of an
/// external debug request.
EXTERNAL { 4 1 RRRegField WWRegField }
/// Indicates triggering of a Vector catch.
VCATCH { 3 1 RRRegField WWRegField }
/// Indicates a debug event generated by the DWT.
DWTTRAP { 2 1 RRRegField WWRegField }
/// Indicates a debug event generated by BKPT instruction execution or a
/// breakpoint match in FPB.
BKPT { 1 1 RRRegField WWRegField }
/// Indicates a debug event generated by either.
HALTED { 0 1 RRRegField WWRegField }
}
/// MemManage Fault Address Register.
MMFAR {
0xE000_ED34 0x20 0x0000_0000
RReg;
/// Data address for an MPU fault. This is the location addressed by an
/// attempted load or store access that was faulted. The MemManage Status
/// Register shows the cause of the fault, and whether MMFAR.ADDRESS is
/// valid. When an unaligned access faults, the address is the actual
/// address that faulted. Because an access might be split into multiple
/// parts, each aligned, this address can be any offset in the range of the
/// requested size.
ADDRESS { 0 32 RRRegField }
}
/// BusFault Address Register.
BFAR {
0xE000_ED38 0x20 0x0000_0000
RReg;
/// Data address for a precise bus fault. This is the location addressed by
/// an attempted data access that was faulted. The BFSR shows the reason for
/// the fault and whether BFAR.ADDRESS is valid.
///
/// For unaligned access faults, the value returned is the address requested
/// by the instruction. This might not be the address that faulted.
ADDRESS { 0 32 RRRegField }
}
/// Floating Point Context Control Register.
FPCCR {
0xE000_EF34 0x20 0xC000_0000
RReg WReg;
/// When this bit is set to 1, execution of a floating-point instruction
/// sets the CONTROL.FPCA bit to 1.
ASPEN { 31 1 RRRegField WWRegField }
/// Enables lazy context save of FP state.
LSPEN { 30 1 RRRegField WWRegField }
/// Indicates whether the software executing when the processor allocated
/// the FP stack frame was able to set the DebugMonitor exception to
/// pending.
MONRDY { 8 1 RRRegField }
/// Indicates whether the software executing when the processor allocated
/// the FP stack frame was able to set the BusFault exception to pending.
BFRDY { 6 1 RRRegField }
/// Indicates whether the software executing when the processor allocated
/// the FP stack frame was able to set the MemManage exception to pending.
MMRDY { 5 1 RRRegField }
/// Indicates whether the software executing when the processor allocated
/// the FP stack frame was able to set the HardFault exception to pending.
HFRDY { 4 1 RRRegField }
/// Indicates the processor mode when it allocated the FP stack frame.
THREAD { 3 1 RRRegField }
/// Indicates the privilege level of the software executing when the
/// processor allocated the FP stack frame.
USER { 1 1 RRRegField }
/// Indicates whether Lazy preservation of the FP state is active.
LSPACT { 0 1 RRRegField }
}
/// Floating Point Context Address Register.
FPCAR {
0xE000_EF38 0x20 0x0000_0000
RReg;
/// The location of the unpopulated floating-point register space allocated
/// on an exception stack frame.
ADDRESS { 3 29 RRRegField }
}
/// Floating Point Default Status Control Register.
FPDSCR {
0xE000_EF3C 0x20 0x0000_0000
RReg WReg;
/// Default value for FPSCR.AHP.
AHP { 26 1 RRRegField WWRegField }
/// Default value for FPSCR.DN.
DN { 25 1 RRRegField WWRegField }
/// Default value for FPSCR.FZ.
FZ { 24 1 RRRegField WWRegField }
/// Default value for FPSCR.RMode.
RMode { 22 2 RRRegField WWRegField }
}
/// Debug Exception and Monitor Control Register.
DEMCR {
0xE000_EDFC 0x20 0x0000_0000
RReg WReg;
/// Global enable for all DWT and ITM features.
TRCENA { 24 1 RRRegField WWRegField }
/// DebugMonitor semaphore bit.
MON_REQ { 19 1 RRRegField WWRegField }
/// Setting this bit to 1 makes the step request pending.
MON_STEP { 18 1 RRRegField WWRegField }
/// Sets or clears the pending state of the DebugMonitor exception.
MON_PEND { 17 1 RRRegField WWRegField }
/// Enable the DebugMonitor exception.
MON_EN { 16 1 RRRegField WWRegField }
/// Enable halting debug trap on a HardFault exception.
VC_HARDERR { 10 1 RRRegField WWRegField }
/// Enable halting debug trap on a fault occurring during exception entry or
/// exception return.
VC_INTERR { 9 1 RRRegField WWRegField }
/// Enable halting debug trap on a BusFault exception.
VC_BUSERR { 8 1 RRRegField WWRegField }
/// Enable halting debug trap on a UsageFault exception caused by a state
/// information error, for example an Undefined Instruction exception.
VC_STATERR { 7 1 RRRegField WWRegField }
/// Enable halting debug trap on a UsageFault exception caused by a checking
/// error, for example an alignment check error.
VC_CHKERR { 6 1 RRRegField WWRegField }
/// Enable halting debug trap on a UsageFault caused by an access to a
/// Coprocessor.
VC_NOCPERR { 5 1 RRRegField WWRegField }
/// Enable halting debug trap on a MemManage exception.
VC_MMERR { 4 1 RRRegField WWRegField }
/// Enable Reset Vector Catch. This causes a Local reset to halt a running
/// system.
VC_CORERESET { 0 1 RRRegField WWRegField }
}
}
map! {
/// SysTick timer.
pub mod STK;
/// SysTick control and status register.
CTRL {
0xE000_E010 0x20 0x0000_0000
RReg WReg;
/// Returns `true` if timer counted to `0` since last time this was read.
COUNTFLAG { 16 1 RRRegField WWRegField }
/// Clock source selection.
CLKSOURCE { 2 1 RRRegField WWRegField }
/// SysTick exception request enable.
TICKINT { 1 1 RRRegField WWRegField }
/// Counter enable.
ENABLE { 0 1 RRRegField WWRegField }
}
/// SysTick reload value register.
LOAD {
0xE000_E014 0x20 0x0000_0000
RReg WReg;
/// RELOAD value.
RELOAD { 0 24 RRRegField WWRegField }
}
/// SysTick current value register.
VAL {
0xE000_E018 0x20 0x0000_0000
RReg WReg;
/// Current counter value.
CURRENT { 0 24 RRRegField WWRegField }
}
/// SysTick calibration value register.
CALIB {
0xE000_E01C 0x20 0x0000_0000
RReg RoReg;
/// NOREF flag.
NOREF { 31 1 RRRegField RoRRegField }
/// SKEW flag.
SKEW { 30 1 RRRegField RoRRegField }
/// Calibration value.
TENMS { 0 24 RRRegField RoRRegField }
}
}
map! {
/// Memory protection unit.
pub mod MPU;
/// Indicates how many regions the MPU support.
TYPE {
0xE000_ED90 0x20 0x0000_0000
RReg RoReg;
/// Instruction region.
IREGION { 16 8 RRRegField RoRRegField }
/// Number of regions supported by the MPU.
DREGION { 8 8 RRRegField RoRRegField }
/// Indicates support for separate instruction and data address maps.
SEPARATE { 0 1 RRRegField RoRRegField }
}
/// Enables the MPU, and when the MPU is enabled, controls whether the
/// default memory map is enabled as a background region for privileged
/// accesses, and whether the MPU is enabled for HardFaults, NMIs, and
/// exception handlers when FAULTMASK is set to 1.
CTRL {
0xE000_ED94 0x20 0x0000_0000
RReg WReg;
/// Enable priviliged software access to default memory map.
PRIVDEFENA { 2 1 RRRegField WWRegField }
/// Enables the operation of MPU during hard fault, NMI, and FAULTMASK
/// handlers.
HFNMIENA { 1 1 RRRegField WWRegField }
/// Enables the MPU.
ENABLE { 0 1 RRRegField WWRegField }
}
/// Selects the region currently accessed by MPU_RBAR and MPU_RASR.
RNR {
0xE000_ED98 0x20 0x0000_0000
RReg WReg;
/// Indicates the memory region accessed by MPU_RBAR and MPU_RASR.
REGION { 0 8 RRRegField WWRegField }
}
/// Holds the base address of the region identified by MPU_RNR. On a write,
/// can also be used to update the base address of a specified region, in
/// the range 0 to 15, updating MPU_RNR with the new region number.
RBAR {
0xE000_ED9C 0x20 0x0000_0000
RReg WReg;
/// Region base address field.
ADDR { 5 27 RRRegField WWRegField }
/// MPU region number valid.
VALID { 4 1 RRRegField WWRegField }
/// MPU region field.
REGION { 0 4 RRRegField WWRegField }
}
/// Defines the size and access behavior of the region identified by
/// MPU_RNR, and enables that region.
RASR {
0xE000_EDA0 0x20 0x0000_0000
RReg WReg;
/// Instruction access disable bit.
XN { 28 1 RRRegField WWRegField }
/// Access permission.
AP { 24 3 RRRegField WWRegField }
/// Memory attribute.
TEX { 19 3 RRRegField WWRegField }
/// Shareable memory attribute.
S { 18 1 RRRegField WWRegField }
/// Memory attribute.
C { 17 1 RRRegField WWRegField }
/// Memory attribute.
B { 16 1 RRRegField WWRegField }
/// Subregion disable bits.
SRD { 8 8 RRRegField WWRegField }
/// Size of the MPU protection region.
SIZE { 1 5 RRRegField WWRegField }
/// Region enable bit.
ENABLE { 0 1 RRRegField WWRegField }
}
}
map! {
/// Trace port interface unit.
pub mod TPIU;
/// Selected Pin Protocol Register.
SPPR {
0xE004_00F0 0x20 0x0000_0001
RReg WReg;
/// Specified the protocol for trace output from the TPIU.
TXMODE { 0 2 RRRegField WWRegField }
}
/// Formatter and Flush Control Register.
FFCR {
0xE004_0304 0x20 0x0000_0102
RReg WReg;
/// This bit Reads-As-One (RAO), specifying that triggers are inserted when
/// a trigger pin is asserted.
TrigIn { 8 1 RRRegField RoRRegField }
/// Enable continuous formatting.
EnFCont { 1 1 RRRegField WWRegField }
}
}