Skip to content

Commit 0ed4dec

Browse files
committed
Add warning when we failed to emit padding at the start of a union
This currently triggers for the atsamd21 for these fields: ``` WARNING: field Some(Ident("pmux1_1")) has different offset 177 than its union container 176 WARNING: field Some(Ident("pmux1_2")) has different offset 178 than its union container 176 ``` the issue there is that we're missing `derivedFrom` support for registers, and once implemented, that issue goes away.
1 parent 50fe8e8 commit 0ed4dec

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/generate/peripheral.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,12 @@ fn register_or_cluster_block(
297297
let mut region_fields = Tokens::new();
298298

299299
for reg_block_field in &region.fields {
300+
if reg_block_field.offset != region.offset {
301+
eprintln!("WARNING: field {:?} has different offset {} than its union container {}",
302+
reg_block_field.field.ident,
303+
reg_block_field.offset,
304+
region.offset);
305+
}
300306
let comment = &format!(
301307
"0x{:02x} - {}",
302308
reg_block_field.offset,

0 commit comments

Comments
 (0)