Hello, I would just like to add, for someone with related issue. A better (and working) solution, for arm core , would be to change the A bit in SCTRL register.
This A bit shall allow/not-allow unaligned access in armv7 core. see here: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka15414.html Regards, Ran On Tue, Sep 26, 2017 at 1:14 PM, Ran Shalit <ransha...@gmail.com> wrote: > Dirk, > > Thanks a lot for the idea with the compilation flag. > That was the key. I wasn't familiar with this feature before. > > Best Regards, > Ran > > On Sun, Sep 24, 2017 at 10:18 PM, Dirk Ziegelmeier <d...@ziegelmeier.net> > wrote: > > 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 >
_______________________________________________ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users