[U-Boot] __attribute__((__packed__)) switching to byte-access on ARM

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Mon Aug 11 19:16:24 CEST 2008


On 17:48 Mon 11 Aug     , Guennadi Liakhovetski wrote:
> Hi
> 
> As I remarked in the opening email to the SMDK6400 patch-series, I've got 
> a strange problem, I cannot understand.
> 
> Here're the c-code:
> 
> typedef struct {
> 	volatile u32	TCNTB;
> 	volatile u32	TCMPB;
> 	volatile u32	TCNTO;
> } s3c64xx_timer;
> 
> typedef struct {
> 	volatile u32	TCFG0;
> 	volatile u32	TCFG1;
> 	volatile u32	TCON;
> 	s3c64xx_timer	ch[4];
> 	volatile u32	TCNTB4;
> 	volatile u32	TCNTO4;
> } s3c64xx_timers;
IIRC in gcc 4

you're supposed to declare the struct as packet and not the typedef

struct {
	volatile u32	TCNTB;
	volatile u32	TCMPB;
	volatile u32	TCNTO;
} _s3c64xx_timer __attribute__ ((__packed__));
typedef struct _s3c64xx_timer s3c64xx_timer;

struct {
	volatile u32	TCFG0;
	volatile u32	TCFG1;
	volatile u32	TCON;
	s3c64xx_timer	ch[4];
	volatile u32	TCNTB4;
	volatile u32	TCNTO4;
} _s3c64xx_timers __attribute__ ((__packed__));
typedef struct _s3c64xx_timers s3c64xx_timers;

Best Regards,
J.



More information about the U-Boot mailing list