__packed typecast

Hello all,

Previously i was using MDKARM 4.0 and now i've upgraded to the 4.7. I am writing the program for LPC17xx. In the previous version i was using unsigned long long data type for 64 bit data storage. When i want to store the data in buffer i was using following

 *(unsigned long long *)buf->dptr   = n->ex;

where ex is __packed unsigned long long data type.

I used __packed because of the data alignment boundary.

Now when i am upgraded to 4.7 same instruction gave me unaligned fault, may be because of some changes in compiler. Just out of the hunch i changes above statement to following

 *(__packed unsigned long long *)buf->dptr   = n->ex;

Now there is now unaligned fault. I just wanted to ask if it is the correct way or it may lead to unexplained behavior in future. If not what could be the correct way to typecast. Please point me in correct direction.

Thanks in advance
Ra

Parents Reply Children
No data
More questions in this forum