
In message 20050223100142.GA3003@nabla101 you wrote:
When u-boot starts and try to read the ethaddr, (lib_arm/board.c at 296), the parameter tmp used in the function getenv_r is pointing to the gd->bd structure, so the execution of this function corrupts the data stored in it.
You are wrong. "tmp" is a local array, declared in line 294:
294 uchar tmp[64]; 295 296 i = getenv_r ("ethaddr", tmp, sizeof (tmp));
I've found a "dirty" workaround of this problem rising the size of tmp buffer:
What exactly is your problem?
/* uchar tmp[64]; */ uchar tmp[128]; i = getenv_r ("ethaddr", tmp, sizeof (tmp));
Why do you think that 64 bytes should be insufficient to store the MAC address?
As you can see the tmp buffer is pointing to the gd->bd plus 4.
At least this is what the debugger claims.
Any hints ?
I cannot reproduce this problem here. WHat do you get when you use printf() to display the addresses _before_ calling getenv_r()?
Best regards,
Wolfgang Denk