
Dear Graeme Russ,
In message 4CDF36E3.7060505@gmail.com you wrote:
board_early_init_f() is (in most cases) the very first entry in the init_sequence[]
Right.
So if global data is defined on the stack in board_init_f() and copied to the heap at the end of board_init_f() we should be OK. Is global data needed prior to board_init_f()?
Yes, as we have no writable data segmeit before relocation. We need a way to pass around some data.
For x86, I allocate global data in asm and set three members. The sticking point for me is the single ulong parameter to board_init_f() which does not present enough flexibility to pass all the information I need.
Pass a pointer to a struct ?
One nit-pick is that, in reality, the stack space used by board_init_f() is never reclaimed because it never returns. What we could do is reset the stack pointer prior to calling board_init_r()
This is not correct. After relocation, we set up a completely new stack in RAM.
Best regards,
Wolfgang Denk