[U-Boot] Warning NetReceive(): Make sure packet buffers start on an even address
Wolfgang Denk
wd at denx.de
Fri Aug 6 12:31:34 CEST 2010
Dear "Reinhard Meyer (-VC)",
In message <4C5BE2CF.2020306 at emk-elektronik.de> you wrote:
>
> Instead of:
> static unsigned char buffer[ENC_MAX_FRM_LEN];
> The following works fine:
> static unsigned long lbuffer[ENC_MAX_FRM_LEN/4];
> #define buffer ((unsigned char *)lbuffer)
>
> Is there a more elegant way of forcing a char array to start
> on an even address?
Sure. Use something like
static unsigned char buffer[ENC_MAX_FRM_LEN] __attribute__ ((aligned(4)));
Or, probably even better, use malloc() to allocate the buffer.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It is impractical for the standard to attempt to constrain the
behavior of code that does not obey the constraints of the standard.
- Doug Gwyn
More information about the U-Boot
mailing list