- I don't want to erase my flash memory because I'm not sure if my new U-Boot image will work. Is it possible to configure U-Boot such that I can load it into RAM instead of flash, and start it from my old boot loader?
- No. (Unless you're using a Blackfin processor, but you probably aren't.)
- But I've been told it is possible??
- Well, yes. Of course this is possible. This is software, so everything is possible. But it is difficult, unsupported, and fraught with peril. You are on your own if you choose to do it. And it will not help you to solve your problem.
- U-Boot expects to see a virgin CPU, i. e. the CPU state must match what you see
if the processor starts executing the first instructions when it comes out of reset.
If you want to start U-Boot from another boot loader, you must disable a lot of code, i. e. all
initialization parts that already have been performed by this other boot loader, like
setting up the memory controller, initializing the SDRAM, initializing the serial port,
setting up a stack frame etc.
Also you must disable the relocation to RAM and adjust the link addresses etc.
This requires a lot of experience with U-Boot, and the fact that you had to ask if this can be done means that you are not in a position to do this.
The code you have to disable contains the most critical parts in U-Boot, i. e. these are the areas where 99% or more of all errors are located when you port U-Boot to a new hardware. In the result, your RAM image may work, but in the end you will need a full image to program the flash memory with it, and then you will have to enable all this highly critical and completely untested code.
You see? You cannot use a RAM version of U-Boot to avoid testing a flash version, so you can save all this effort and just burn your image to flash.
- So how can I test an U-Boot image and recover my system if it doesn't work?
- Attach a BDI2000 to your board, burn the image to flash, and debug it in it's natural environment, i. e. U-Boot being the boot loader of the system and taking control over the CPU right as it comes out of reset. If something goes wrong, erase the flash and program a new image. This is a routine job using a BDI2000.
|14.2. U-Boot||1. Abstract||14.2.2. Relocation cannot be done when using -mrelocatable|