From 60c55001466e0b072286538bd99c937b0cf138ea Mon Sep 17 00:00:00 2001 From: Tom Burdick Date: Mon, 2 Mar 2020 17:53:02 -0600 Subject: [PATCH] Ensure RegisterBlock memory layout is correct 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 --- imxrt-ral/imxrtral.py | 1 + 1 file changed, 1 insertion(+) diff --git a/imxrt-ral/imxrtral.py b/imxrt-ral/imxrtral.py index 26fa8973..4c4a24de 100644 --- a/imxrt-ral/imxrtral.py +++ b/imxrt-ral/imxrtral.py @@ -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} }}"""