On Wed, Nov 5, 2008 at 8:53 AM, Kieran Mansley <address@hidden>
On Tue, 2008-11-04 at 18:30 +0000, Stanko Nedic wrote:>The only other thought is that structure packing isn't working properly
> Any ideas would be highly appreciated, I'm running out of ideas if the
> above doesn't help.
>for you. To ensure that all the header fields are correctly positioned
>we try to force the compiler to pack structures and not put padding in
>between fields to align them to their "natural" boundary. If your
>compiler wasn't doing this properly, or the port you're using hasn't set
>up the PACK_STRUCT... macros properly, this might explain fields being
Hi Kieran, I have checked the addresses of the fields in eth_hdr and ip_hdr structs (together these form the ethip_hdr struct) and compared them to the addresses of the packet data.
The addresses of the fields in eth_hdr struct are correctly aligned, but it seems that the address of the ip_hdr struct is 2 bytes after where it should be. (i.e. not packed properly as you mentioned).
I'm using an lwip port which was already tested for lpc2368 chip, so the macros should be defined properly (they appear fine in the code). I think you are right about the compiler issue mentioned above although I will have to check the default compiler setup that I have been provided with (online compiler).
Thanks a lot for your help,