It would work just fine since there are no unaligned accesses in lwip,
assuming the two byte pad at the beginning of the 14byte ethernet frame
has been enabled.
The structure packing in lwip is really only there to prevent the
compiler from inserting unnecessary padding. By "unnecessary padding" I
mean padding which is not required in order to guarantee aligned accesses.
I have used lwip on a processor which _will_ crash if there is a single
unaligned access.
Regards,
Timmy Brolin
Simon Goldschmidt wrote:
#define FIELD1(A) (*((short int*)&A[0]))
#define FIELD2(A) (*((long*)&A[2]))
x=FIELD1(data); /* using field1 */
I don't know how this should help: say A starts at 0x03, then accessing
FIELD2 would still result in a long-pointer being accessed at 0x03+2 = 0x05.
This is what will not work on most platforms.
Simon