
Dear Graeme Russ,
In message AANLkTimDxzWm9-sekLv60-zNDFmBKE3dc=kxiO+ZqZZn@mail.gmail.com you wrote:
I agree that it would be nice to have U-Boot completely position- independent and completelky restartable, but this would be a new feature, which newer existed before.
x86 has a nice feature whereby I can build two images that differ only by TEXT_BASE. I can build using TEXT_BASE somewhere in low memory, tftp the image and the 'go' directly to the base address of the image
You can build such images for any architecture, but usually they will not work.
The code assumes to be started at the reset vector, and to find a CPU with all peripherals and registers in virgine state which is only present after a reset.
On many processors there are certain steps that are irreversiable by software - there are write-once registers, there are memory controller registers which change the behaviour of the memory controller when the are written for the first time, etc.
This works because the x86 reset vector is at top of memory (0xfffffff0), not bottom (0x00000000) so the very first bytes of u-boot.bin are not the reset vector, but rather where the reset vector jumps to after performing some very low-level hardware init
The actual position of the reset vector in the address space has nothing to do with that isse. It's other things like register states or mode of operation of certain units (memory controller, MMU etc.) that are different when coming frash out of reset versus when coming from a running U-Boot systems.
As long as I do not mess with the low-level init code, I can be confident that an image that 'boots' using the 'go' command will boot from Flash
This _may_ work on certain boards and processors, but it does not (and I think it cannot) work in general.
Best regards,
Wolfgang Denk