[oe] need help: cdrkit & bitifields
Phil Blundell
pb at reciva.com
Fri Mar 6 09:03:50 UTC 2009
On Thu, 2009-03-05 at 22:10 +0100, Frans Meulenbroeks wrote:
> main(int argc, char **argv)
> {
> char c = 0xf0;
> bitfields *bf = &c;
This isn't a legal thing to do. Struct addresses on ARM need to be
32-bit aligned, whereas &c is only guaranteed aligned to an 8-bit
boundary. You can't, in general, take a pointer to an arbitrary type,
cast it to a struct and expect to get good results.
You need to use a union, or something like:
struct wrapped_char {
char c;
}
struct wrapped_char wc;
wc.c = 0xf0;
bitfields &bf = &wc;
p.
More information about the Openembedded-devel
mailing list