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

Guennadi Liakhovetski lg at denx.de
Mon Aug 11 19:44:57 CEST 2008


On Mon, 11 Aug 2008, Jean-Christophe PLAGNIOL-VILLARD wrote:

> 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;

I believe you meant

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

but this doesn't change a thing, I checked it too. Even this

} __attribute__((__packed__,aligned(4)));

doesn't help.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de



More information about the U-Boot mailing list