lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Trouble at compile time with __packed attribute.


From: Yann Suisini
Subject: Re: [lwip-users] Trouble at compile time with __packed attribute.
Date: Fri, 9 Oct 2009 04:30:19 -0700 (PDT)

OK, thank it's compiling well now.  Witt a packed structure , the
documentation of Keil ARM compiler says that all the members inherit the
__packed attribute of the structure. 
But all the pointers for access to a packed structure have to be defined 
with the __packed too in order to access well to deferenced structs like :

__packed struct packed_struct_name *ptr; 

the Lwip code take cares about that point (that could depends of the
compiler) ?

Yann.



address@hidden wrote:
> 
> I haven't used your compiler, but from what you say, I think you can 
> leave away the PACK_STRUCT_FIELD() define, since lwIP only uses 
> completely packed structs, not normal structs with packed members.
> 
> Simon
> 
> 
> Yann Suisini wrote:
>> Hello,
>>
>> I'm trying to compile lwip using Keil ARM compiler but it returns an
>> error 
>> in ip_frag.c  :
>>
>> lwip\src\core\ipv4\ip_frag.c(91): error:  #1030: struct "struct pbuf"
>> previously declared without __packed
>>
>> at 
>>
>> PACK_STRUCT_BEGIN
>> struct ip_reass_helper {
>>   PACK_STRUCT_FIELD(struct pbuf *next_pbuf);    <---------------
>>   PACK_STRUCT_FIELD(u16_t start);
>>   PACK_STRUCT_FIELD(u16_t end);
>> } PACK_STRUCT_STRUCT;
>> PACK_STRUCT_END
>>
>> According to the doc of Keil compiler I have to use the define attribute
>> like this :
>> __packed struct foo
>> {
>>     char one;
>>     short two;
>>     char three;
>>     int four;
>> } c;
>> for a packed struct 
>>
>>  struct foo
>> {
>>     char one;
>>     __packed short two;
>>     char three;
>>     int four;
>> } c;
>> for a packed field
>>
>> So in cc.h I have this :
>> #ifndef PACK_STRUCT_BEGIN
>> #define PACK_STRUCT_BEGIN __packed
>> #endif /* PACK_STRUCT_BEGIN */
>>
>> #ifndef PACK_STRUCT_END
>> #define PACK_STRUCT_END
>> #endif /* PACK_STRUCT_END */
>>
>> #ifndef PACK_STRUCT_FIELD
>> #define PACK_STRUCT_FIELD(x) __packed x
>> #endif /* PACK_STRUCT_FIELD */
>>
>> #ifndef PACK_STRUCT_STRUCT
>> #define PACK_STRUCT_STRUCT
>> #endif /* PACK_STRUCT_STRUCT */
>>
>>
>> It seems the compiler don't understand the field is a pointer to a struct 
>> and not a structure itself .
>> I really don't know how to write it without getting an error :-(
>>
>> Yann.
>>
>>  
>>
>>
>>   
> 
> 
> 
> _______________________________________________
> lwip-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/lwip-users
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Trouble-at-compile-time-with-__packed-attribute.-tp25819211p25819518.html
Sent from the lwip-users mailing list archive at Nabble.com.





reply via email to

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