lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] ip_addr_copy alignment issue


From: Dirk Ziegelmeier
Subject: Re: [lwip-users] ip_addr_copy alignment issue
Date: Sun, 24 Sep 2017 21:18:12 +0200

Packed structs imply two things: No padding inside the struct AND the struct's location may be unaligned in memory. So when this u32 access fails at runtime your compiler did not generate correct code for your platform. When copying an u32 to/from a packed struct, something like memcpy needs to be used when the processor requires aligned access.
Some ARM platforms can be configured to handle unaligned access, and there is a gcc command line flag that tells the compiler it can assume this capability (sorry forgot the name of the flag, something like -munaligned-access, google it). Maybe this points you in the right direction.


Ciao
Dirk


On Sun, Sep 24, 2017 at 2:47 PM, Ran Shalit <address@hidden> wrote:
Hello,

I get stuck in ip_addr_copy when called by ip_input.
I am using MEM_ALIGNMENT 4, and packed structs.
I tried many stuff, but nothing yet helped.
If I try MEM_ALIGNMENT 1, I get stuck in much earlier phase.
I'm using lwip 1.4.1 , which is a stable release as I understand.

Is there any idea how this issue can be fixed ?

This is the code for ip_addr_copy
#define ip_addr_copy(dest, src) ((dest).addr = (src).addr)

Best Regards,
Ran

_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users


reply via email to

[Prev in Thread] Current Thread [Next in Thread]