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

Woojung.Huh at smsc.com Woojung.Huh at smsc.com
Fri Apr 22 20:55:03 CEST 2005


Wolfgang,

Thanks for your reply.
Maybe my configuration was wrong at that time when I compile sources.
Now it works as you described. (It was non-sense to me too.)
It means "__attribute__((packed))" doesn't affect 4byte access to serial controller.

Thanks,
Woojung



                                                                                                                                                  
                      Wolfgang Denk                                                                                                               
                      <wd at denx.de>             To:       Woojung Huh/SMSC at SMSC                                                                    
                      Sent by:                 cc:       U-Boot-Users at lists.sourceforge.net                                                       
                      wd at denx.de               Subject:  Re: [U-Boot-Users] struct NS16550 {...} __attribute__ ((packed)) at ns16550.h            
                                                                                                                                                  
                                                                                                                                                  
                      04/22/2005 02:39                                                                                                            
                      PM                                                                                                                          
                                                                                                                                                  
                                                                                                                                                  




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.









More information about the U-Boot mailing list