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

RE: [bluetooth-dev] Re: Porting to ARM

I do not know how gcc handles accesses to the structures with packed
attribute, but in my experience with the arm toolkit this is sufficient to
solve the problem.  What packed tells the compiler is not only DO NOT PAD
the structure, but also that the structure is of UNKNOWN alignment.  That
means that data sizes greater than bytes are accessed as bytes and assembled
into larger units, at least for ARM7.  Take a look at the assembly output of
your compiler to check its behavior on packed structures.

Best of luck,

-----Original Message-----
From: Erwin Authried [mailto:eauth@xxxxxxx.at]
Sent: Friday, September 22, 2000 11:52 AM
To: 'Gordon McNutt'
Cc: bluetooth-dev@xxxxxxx.com
Subject: Re: [bluetooth-dev] Re: Porting to ARM

Gordon McNutt[SMTP:gmcnutt@xxxxxxx.com] wrote:

> gcc can handle it if you use __attribute__ ((packed)) on the guilty
> See 'info gcc' or http://gcc.gnu.org/onlinedocs/gcc_toc.html and search
> packed.
> --Gordon

That will align the variables correctly, but it doesn't solve the problem
when the processor doesn't allow misaligned access, as well as the
endianness problem.