[U-Boot] Warning NetReceive(): Make sure packet buffers start on an even address

Reinhard Meyer (-VC) reinhard.meyer at emk-elektronik.de
Fri Aug 6 12:24:15 CEST 2010


Hi,

The network layer currently handles packets with
c-structures overlayd on the packets.

NetReceive() will fail to correctly parse packets that
are not word aligned (at least on ARM cpus).

Just figured that out debugging the enc28j60 driver.
Which had no fault except for having the receive
packet buffer on an odd address :)

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?

Reinhard



More information about the U-Boot mailing list