
Wofgang,
Did you inspect the generated assembly statemens of __attribute__ ((packed)) on the struct NS16650 when CFG_NS16550_REG_SIZE is 4? If you did then you would have noticed gcc (atleast 3.4.3 and 3.4.0) generates byte access code for it. As I mailed to this mailinglist at the first of March 2005. Subject: "[PATCH] revised word alignment fixes for word aligned NS16550 UART"
Kind greetings,
Jean-Paul Saman
Philips Semiconductors CTO/RTG Philips HighTech Campus, building WDA 3.29 Professor van den Holstlaan 4 5655 AA Eindhoven tel: +31 (0)40 27 45131
Wolfgang Denk wd@denx.de Sent by: u-boot-users-admin@lists.sourceforge.net 22-04-2005 20:39
To: Woojung.Huh@smsc.com cc: U-Boot-Users@lists.sourceforge.net (bcc: Jean-Paul Saman/EHV/SC/PHILIPS) Subject: Re: [U-Boot-Users] struct NS16550 {...} __attribute__ ((packed)) at ns16550.h Classification:
In message OF34DF8405.50E611E8-ON85256FEB.0051A68A-85256FEB.00522DF9@smsc.com you wrote:
We are using u-boot for proprietary ARM board with NS16550 compatible
serial controller.
It is configured as 4bytes access to serial controller, so set
CFG_NS16550_REG_SIZE to 4.
But, because of "__attribute__ ((packed))" of struct NS16550, all
register accesses to NS16550 are generated to byte
access (LDRB, STRB in ARM).
No, this staement makes no sense to me.
I think it should NOT have __attribute__ ((packed)) if NS16550 is
configured as 4bytes access.
Am I missed something?
I think so.
"__attribute__ ((packed))" only affects the alignment of the entries in the structure. It has no influence on how to access these entries. If your access is a 32 bit read or write access then it will not be changed whether there is a "__attribute__ ((packed))" in place or not.
Best regards,
Wolfgang Denk