From: PALFFY D. <dpa...@ra...> - 2003-11-11 17:59:45
|
Hi! > Yeah I think those few optimisations would make things a little less painless. > In fact it would be nice to be able to switch either the Linux or the Apple > firmware first so you could choose your default for load speed :) Ok, here's the next version. It's optimized enough for our needs I think. It loads from 0x4400, so the first image doesn't have to be moved. However moving is optimized now, too. > I think you can just re-write the boot table completely though (e.g without > caring for the flashupd image). If you want to update the flash then dd in > the original and run the updater.exe... Assuming people screw up and don't > save a backup I think the updater.exe does the equivalent of a dd anyhow. Ok, I'm doing this. However the first 512 bytes still have to be copied in from an original firmware. Do you know the meaning of those few bytes at 0x100? The text before doesn't seem to be important, but the first dword seems to be some magic number (it's included as a literal in the loader right after 0x55aa - the PC boot sector magic. I haven't disassembled it further yet). The other values seem to be required, too. > The best location for the stack is 0x40000000+stack_size. Thats the fast ram. Ok, done. > I haven't looked at the arm memmove in Linux but something using the > ldmia/stdmia and 4 or more registers should be pretty quick :) I've converted the memmove to move multiplies of 16 bytes (all images are aligned to sector boundaries, so it doesn't hurt), this is optimized to ldmia/stmia by gcc, and seems to be much faster than the original version. > Anyhow I'll take a look see in a few hours and see about giving it a whirl. Try this instead! Oh, I've nearly forgotten: This version can load up to 5 images, any of which can be the default, the others are load for the four keys on the top (or around the wheel). PS: I should really read ARM documentation before writing a boot loader... It's really funny to find out the hard way that the address of the current instruction is (pc & ~3) - 8 -- Dani ...and Linux for all. |