On 9/18/07, Jan Kiszka <[EMAIL PROTECTED]> wrote:
> Yeoh Chun Yeow wrote:
> > Dear Jan,
> >
> > I have found out that the cause of the AT91 problem. This is due to the
> > rtcfg frame structure which is defined using zero-length array and packed
> > attribute. I have modified all the addr in variable length to u32 since I
> > use the IP address and it works. I am afraid that it is something to do with
> > the ARM architecture and also the compiler. Do you have similar problem
> > before?
>
> Not that I recall right now. What toolchain are you using? Something
> pre-compiled or home-grown? What gcc version is involved?
>
> The current RTcfg code that handles this variably-sized frames is not
> really beautiful anyway, but before rewriting everything understanding
> the compiler's problem is required to avoid potentially papering over
> some other issue.
>
> >
> > By the way, attached the patch of real-time driver for AT91 built in the
> > rtnet tree.
>
> Thanks, will look into this soon.

I do not know if this is related to the issue you are observing, but
we got an issue with the packed attribute no ARM. It is illustrated by
the following example:

#include <stdio.h>

struct foo {
        struct a {
                char b;
        } c;
        char d;
        short e;
} __attribute__((packed));

struct bar {
        char a;
} __attribute__((packed));

struct qux {
        struct bar b;
        char c;
        short d;
} __attribute__((packed));

int main(void)
{
        printf("sizeof(foo): %u, sizeof(qux): %u\n",
               sizeof(struct foo), sizeof(struct qux));

        return 0;
}

Whereas, on x86, this program writes:
sizeof(foo): 4, sizeof(qux): 4
on ARM, it writes:
sizeof(foo): 7, sizeof(qux): 4

-- 
                                               Gilles Chanteperdrix

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
RTnet-users mailing list
RTnet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rtnet-users

Reply via email to