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 <ransha...@gmail.com> 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
> lwip-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>
_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to