Closed kistenklaus closed 2 months ago
Should be fixed as we don't have any issues, but might still arise from structured stream data not sure has to be tested
Not needed for fragmentation buffers. They are uint32_t and we never write to them as anything else.
So i actually also didn't know this about C, but given the example.
the write or read at the second line is actually undefined behavior, which depends on the target platform. I always assumed that unaligned accesses are just bad for performance and the compiler will have to include special instructions to handle alignment edge cases, but for the cortexm7 platform on the teensy 4.1 this actually crashes the application completely. (Pretty bad).
The easiest fix is probably to ensure the alignment of a couple of variables.
This includes a couple of points in our code:
Serialization
During serialization we write
*((uint64_t*)data) = 0;
this is undefined behavior if data is is not aligned on a 8byte boundary. Data is from canzero_frame. So it's probably a good idea to change the member alignement ofuint8_t data[8];
toFragmentation
Get resp fragmentation buffers should also be aligned to the 8 byte boundaries