we're getting into very compiler/platform specific features with trying to stuff the data and using pragmas to do it. I've learned to avoid it altogether and to defined memory regions as simple uint8_t vectors, then to write accessor methods that push and pull the data by brute force and bit shifting/stuffing. I must do this a lot with ad-hoc networking protocols. One thing you never want to do is
int v =*(int*)&(vec[17]);at the minimum it creates an innefficient memory access, and at the maximum generates an alignment fault on some processors. The better way is:
int v; memcpy(&v, &vec[17], sizeof(int));manually setting significant bit order if necessary