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: Piero 74
Subject: Re: [lwip-devel] memory alignment in 32bit architecture
Date: Fri, 20 Mar 2009 19:46:15 +0100

Simon, as you said was my understanding.
but, why i have this warning:

"i'm trying to use lwip in cvs head...

 i tried the compilation, and i saw in these piece of code (file dhcp.c)

 #if LWIP_DNS
       dns_setserver( n, (struct ip_addr *)(&(dhcp->offered_dns_addr[n].addr)));
 #endif /* LWIP_DNS */

 a warning like this:
 Warning[Pa039]: use of address of unaligned structure member
....\lwip\src\core\dhcp.c 539
"

bye
Piero

2009/3/20, address@hidden <address@hidden>:
> Piero 74 wrote:
>> in my lwip porting, on arm7 architecture (so, 32bit architecture), i
>> have these defines in cc.h (the compiler is IAR):
>>
>> #define PACK_STRUCT_BEGIN   _Pragma("pack(1)")
>> #define PACK_STRUCT_STRUCT
>> #define PACK_STRUCT_END     _Pragma("pack()")
>> #define PACK_STRUCT_FIELD(x) x
>>
>> are they right?
>>
>> i'm thinking if it could be correct in 32bit architecture use
>> _Pragma("pack(4)")
> The defines are correct. The arm platform (as most 32-bit platforms) has
> a default alignment of 32 bit (i.e. 4). The defines are used to switch
> to byte-alignment for some structs, mostly network headers where there
> is no alignment offset allowed. This is a commonly used thing with
> network protocols and known in C as "packed structs".
>
> Simon
>
>
> _______________________________________________
> 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]