[U-Boot] packed attribute problem
Wolfgang Denk
wd at denx.de
Mon Oct 4 12:17:14 CEST 2010
Dear Vipin Kumar,
In message <4CA9A095.9000900 at st.com> you wrote:
>
> I encountered a problem something like
>
> struct xyz {
> int x;
> int y;
> int z[CONST];
> } __attribute__ ((packed));
>
> struct xyz *abc;
> u32 * status_reg = (u32 *)&abc->z[0];
>
> writel(status, status_reg);
>
> This writel results in writing byte by byte on the address pointed to by status_reg.
> This problem is visible with both gcc version 4.4.1 as well as 4.5.0
I bet this is on some ARM system?
> Incidently, the same code works well with 4.2.4
...which surprises me. I thought this has always been an ARM
"feature".
> The problem is visible in the usb host driver which uses the packed structures for
> accessing device registers.
Hm... Why do these structs have any "__attribute__ ((packed))" at all?
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If I had to live my life again, I'd make the same mistakes, only
sooner. -- Tallulah Bankhead
More information about the U-Boot
mailing list