Skip to content

Commit b22a910

Browse files
committed
Do not reject peripherals without registers.
For TM4C, interrupts cannot be automatically, easily, or possibly at all (since SVD does not define how interrupt sharing should work) be associated in an 1:n fashion to peripherals. Since svd2rust does not really care where the interrupts are in SVD, I simply emit a fake peripheral with the complete list of interrupts (but no registers at all). This peripheral thence does not show up in the generated code, except in `mod interrupts`.
1 parent 752b67b commit b22a910

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/generate.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,8 @@ pub fn peripheral(
274274

275275
let registers = p.registers
276276
.as_ref()
277-
.ok_or_else(|| {
278-
format!("Peripheral {} has no <registers> fields",
279-
p.name)
280-
})?;
277+
.map(|x| x.as_ref())
278+
.unwrap_or(&[][..]);
281279

282280
// No `struct RegisterBlock` can be generated
283281
if registers.is_empty() {

0 commit comments

Comments
 (0)