On 07.02.21 07:33, Patrick Menschel wrote:
Interesting to know, apparently native alignment is 8 on X86_64 linux
and 4 on armhf linux. That's why it worked on X86_64.
Regarding python ctypes module, setting _pack_=8 has no remedy effect on
armhf platform, so I'll move to struct module.
Hi,
tying some loose ends here.
My final solution to force alignment after bcm_msg_head to the next 8
byte boundary in python3 is to use an alignment hack of struct module.
https://docs.python.org/3/library/struct.html#struct-examples
struct.pack("IIIllllII0q",opcode,flags,count,ival1_sec,ival1_usec,ival2_sec,ival2_usec,can_id,nframes)
The "0q" is a zero length long long which causes padding up to the next
8 byte boundary.
Excellent! Exactly what is needed here.
Thanks,
Oliver
This works for ARMHF (40 bytes) and X86_64 (72 bytes).
Regards,
Patrick