@@ -21,7 +21,15 @@ pub struct Cpu {
2121 pub mpu_present : bool ,
2222
2323 /// Indicate whether the processor is equipped with a hardware floating point unit (FPU)
24- pub fpu_present : bool ,
24+ #[ cfg_attr(
25+ feature = "serde" ,
26+ serde(
27+ default ,
28+ skip_serializing_if = "Option::is_none" ,
29+ rename = "fpuPresent"
30+ )
31+ ) ]
32+ pub fpu_present : Option < bool > ,
2533
2634 /// Indicate whether the processor is equipped with a double precision floating point unit.
2735 /// This element is valid only when `fpu_present` is set to `true`
@@ -126,7 +134,7 @@ impl From<Cpu> for CpuBuilder {
126134 revision : Some ( c. revision ) ,
127135 endian : Some ( c. endian ) ,
128136 mpu_present : Some ( c. mpu_present ) ,
129- fpu_present : Some ( c. fpu_present ) ,
137+ fpu_present : c. fpu_present ,
130138 fpu_double_precision : c. fpu_double_precision ,
131139 dsp_present : c. dsp_present ,
132140 icache_present : c. icache_present ,
@@ -164,8 +172,8 @@ impl CpuBuilder {
164172 self
165173 }
166174 /// Set the fpu_present of the cpu.
167- pub fn fpu_present ( mut self , value : bool ) -> Self {
168- self . fpu_present = Some ( value) ;
175+ pub fn fpu_present ( mut self , value : Option < bool > ) -> Self {
176+ self . fpu_present = value;
169177 self
170178 }
171179 /// Set the fpu_double_precision of the cpu.
@@ -238,9 +246,7 @@ impl CpuBuilder {
238246 mpu_present : self
239247 . mpu_present
240248 . ok_or_else ( || BuildError :: Uninitialized ( "mpu_present" . to_string ( ) ) ) ?,
241- fpu_present : self
242- . fpu_present
243- . ok_or_else ( || BuildError :: Uninitialized ( "fpu_present" . to_string ( ) ) ) ?,
249+ fpu_present : self . fpu_present ,
244250 fpu_double_precision : self . fpu_double_precision ,
245251 dsp_present : self . dsp_present ,
246252 icache_present : self . icache_present ,
@@ -281,8 +287,8 @@ impl Cpu {
281287 if let Some ( mpu_present) = builder. mpu_present {
282288 self . mpu_present = mpu_present;
283289 }
284- if let Some ( fpu_present ) = builder. fpu_present {
285- self . fpu_present = fpu_present;
290+ if builder. fpu_present . is_some ( ) {
291+ self . fpu_present = builder . fpu_present ;
286292 }
287293 if builder. fpu_double_precision . is_some ( ) {
288294 self . fpu_double_precision = builder. fpu_double_precision ;
0 commit comments