On Wed, Sep 26, 2012 at 04:27:57PM +1000, Peter Crosthwaite wrote: > Hi All, > > Can anyone think of a reason why the arm primary bootloader cant be > done by just direct interaction with the CPU? Currently we have this > ... > > /* The worlds second smallest bootloader. Set r0-r2, then jump to kernel. */ > static uint32_t bootloader[] = { > 0xe3a00000, /* mov r0, #0 */ > 0xe59f1004, /* ldr r1, [pc, #4] */ > 0xe59f2004, /* ldr r2, [pc, #4] */ > 0xe59ff004, /* ldr pc, [pc, #4] */ > 0, /* Board ID */ > 0, /* Address of kernel args. Set by integratorcp_init. */ > 0 /* Kernel entry point. Set by integratorcp_init. */ > }; > > ... which gets injected into RAM then we set the PC to this blob and > go. But couldnt we just set R0-2 directly from the bootloader and just > straight to the kernel entry point? Why do we have to blob in a > lightweight bootloader?
Hi Peter, I can't speak for this specific case but I've used similar approaches for other boards when needing more realistic emulation, e.g if emulating possible boot loaders in rom and supporting warm jumps back to the rom etc. Cheers