[U-Boot-Users] struct NS16550 {...} __attribute__ ((packed)) at ns16550.h

Jean-Paul Saman jean-paul.saman at philips.com
Mon Apr 25 09:44:43 CEST 2005


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 at denx.de>
Sent by: 
u-boot-users-admin at lists.sourceforge.net
22-04-2005 20:39
 
        To:     Woojung.Huh at smsc.com
        cc:     U-Boot-Users at 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 at 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

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Every program has at least one bug and can be shortened by  at  least
one  instruction  --  from  which,  by induction, one can deduce that
every program can be reduced to one instruction which doesn't work.


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users






More information about the U-Boot mailing list