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: address@hidden
Subject: Re: [lwip-users] Trouble at compile time with __packed attribute.
Date: Fri, 09 Oct 2009 13:16:23 +0200
User-agent: Thunderbird 2.0.0.23 (Macintosh/20090812)

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.







reply via email to

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