I am emulating code from an embedded system (stm32, Keil µVision 5, MDK-ARM) on a PC (mingw32, 32bit arch). The alignment of the ARM compiler does not match my desktop m
According to the GCC manual's examples, the attribute
should go after the struct's fields, i.e.:
// PC Code
typedef struct
{
uint8_t var1;
uint16_t var2;
} __attribute__((packed, aligned(1))) FILE;
I also dropped the pointless struct tag (_file
).
The above has a sizeof
value of 3
when I tested it quickly.