
On 14/11/10 11:07, Wolfgang Denk wrote:
Dear Reinhard Meyer,
In message 4CDF15BB.1090107@emk-elektronik.de you wrote:
Correct, that's why its even now copied over to storage in SDRAM... (at least on ARM: debug ("relocation Offset is: %08lx\n", gd->reloc_off); memcpy (id, (void *)gd, sizeof (gd_t));
relocate_code (addr_sp, id, addr); )
At this time board_early_init_f() has terminated long ago, i. e. the data is not available any more.
Above code is *IN* board_early_init_f !
That's totally broken, then.
See init_sequence[] in "arch/arm/lib/board.c":
board_early_init_f() [in line 244] runs a long, long time before the SDRAM has been tested and initialized, which happens in dram_init() [in line 264].
You cannot and must not touch SDRAM in board_early_init_f(). And even more, you must not at all run relocate_code() there!
See: arch/powerpc/lib/board.c arch/m68k/lib/board.c arch/arm/lib/board.c
They all malloc the final global data structure, memcpy the temporary global data to the malloc'd global data, and call relocate_code passing a pointer to the new global data all at the very end board_init_f() and therefore after SDRAM has been initialised
Regards,
Graeme