Skip to content

Commit

Permalink
Ensure RegisterBlock memory layout is correct
Browse files Browse the repository at this point in the history
Without repr(C) the fields may be re-ordered and alignment is
whatever rustc decides is best. repr(C) enforced field ordering
and C alignment rules.

Fixes #13
  • Loading branch information
teburd committed Mar 2, 2020
1 parent 50a4806 commit 7c2bd30
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions imxrt-ral/imxrtral.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,7 @@ def to_rust_register_block(self):
address += register.size // 8
lines = "\n".join(lines)
return f"""
#[repr(C)]
pub struct RegisterBlock {{
{lines}
}}"""
Expand Down

0 comments on commit 7c2bd30

Please sign in to comment.