lwip-devel
[Top][All Lists]
Advanced

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

RE: [lwip-devel] memory alignment in 32bit architecture


From: Bill Auerbach
Subject: RE: [lwip-devel] memory alignment in 32bit architecture
Date: Fri, 20 Mar 2009 18:37:17 -0400

It's possible that that code can never generate an unaligned access.  It
depends if the compiler was smart, or being safe seeing a cast to a pointer
and an address operator.

If the addition is a multiple of 4 (in your case) and for x[y] and sizeof x
is a multiple of 4, you're ok and the warning is safe.  You can tell from
the disassembly of the source line if you see any adds or multiplies that
are not a multiple of 4.

For what it's worth, on my system unaligned accesses return garbage.  I'm
using DHCP and it works well.

Bill

>-----Original Message-----
>From: address@hidden
>[mailto:address@hidden On
>Behalf Of Piero 74
>Sent: Friday, March 20, 2009 5:08 PM
>To: lwip-devel
>Subject: Re: [lwip-devel] memory alignment in 32bit architecture
>
>you shoul be right..
>i'm thinking to arm7 data abort can occur even for unaligned access,
>but it could be possible to have only wrong data... anyway, in my
>application i never try to recovery from exceptions, managing i prefer
>to force a board restart.
>
>i'd like to search a way to fix problem in lwip code
>
>thanks for your reply
>piero
>
>2009/3/20, Sprow <address@hidden>:
>> In article
><address@hidden>,
>>    Piero 74 <address@hidden> wrote:
>>> my micro will generate a data abort exception.
>>> what solution do you suggest?
>>
>> ARM7? I doubt it, the abort-on-unaligned-word-load option wasn't added
>to
>> the ARM core until architechture 6, which the ARM7 isn't.
>>
>> Your memory controller might produce an abort, in which case you could
>write
>> an exception handler to look at the aborting instruction, do a
>corresponding
>> set of byte loads and shifts, store the result in the appropriate
>register
>> then return from the abort.
>>
>> More simply you could look at the assembler output, if I remember IAR
>right
>> it outputs correct code but warns you about too for good measure as
>it's
>> often a mistake,
>> Sprow.
>>
>>
>>
>> _______________________________________________
>> lwip-devel mailing list
>> address@hidden
>> http://lists.nongnu.org/mailman/listinfo/lwip-devel
>>
>
>
>_______________________________________________
>lwip-devel mailing list
>address@hidden
>http://lists.nongnu.org/mailman/listinfo/lwip-devel





reply via email to

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