diff --git a/svd-parser/src/cpu.rs b/svd-parser/src/cpu.rs index e5430da..8602d2b 100644 --- a/svd-parser/src/cpu.rs +++ b/svd-parser/src/cpu.rs @@ -20,12 +20,22 @@ impl Parse for Cpu { _ => false, }; + let has_mpu_present = match tree.get_child_bool("mpuPresent") { + Ok(v) => v, + _ => false, + }; + + let has_fpu_present = match tree.get_child_bool("fpuPresent") { + Ok(v) => v, + _ => false, + }; + Cpu::builder() .name(tree.get_child_text("name")?) .revision(tree.get_child_text("revision")?) .endian(Endian::parse(&tree.get_child_elem("endian")?, config)?) - .mpu_present(tree.get_child_bool("mpuPresent")?) - .fpu_present(tree.get_child_bool("fpuPresent")?) + .mpu_present(has_mpu_present) + .fpu_present(has_fpu_present) .fpu_double_precision(optional::("fpuDP", tree, &())?) .dsp_present(optional::("dspPresent", tree, &())?) .icache_present(optional::("icachePresent", tree, &())?) diff --git a/tests/src/cpu.rs b/tests/src/cpu.rs index 8ee5348..6ed93c8 100644 --- a/tests/src/cpu.rs +++ b/tests/src/cpu.rs @@ -16,7 +16,7 @@ fn decode_encode() { .unwrap(), " - EFM32JG12B500F512GM48 + EFM32JG12B500F512GM48 5.1.1 little true @@ -27,7 +27,7 @@ fn decode_encode() { ", " - EFM32JG12B500F512GM48 + EFM32JG12B500F512GM48 5.1.1 little true