Our embedded target board is ARM7 based.
unsigned short objectId;
unsigned long length;
We read sizeof(SOME_STRUCT) from buffer.
sizeof(SOME_STRUCT) - Not sure why the lenght is Eight bytes when the structure contains a short and a long.
The data in the buffer is as follows:
01 00 00 08 00 00 00 00 00 00
We thought we were reading six bytes from the buffer but we're reading eight bytes from it.
objectId is 0x0001
length is 0x00000000
We're using Keil compiler Armcc.Exe V184.108.40.2064
It looks like we have some kind of alignment issue? Does this compiler only read from word aligned addresses ? What is the root cause of the problem ? Do we need some kind of PACK or packed keyword so compiler reads six bytes from the buffer instead of eight ?
Here is the link to Keil's compiler: http://www.keil.com/support/man_arm.htm