[U-Boot-Users] Re: U-Boot Boot Sequence

Hi,
Since most MPC8xx and MPCxx both start executing at adress 0x100 there
This is not necessarily true. It may be 0xFFF00100 as well, depending on the HRCW...
This is true but lets assume we start from 0x100.
What I dont understand is, that the label _start (In cpu/mpc8xx/start.S) will be placed to the runtime adress 0x100, but resides in the .text section which according to the
linker
file (take as example board/cogent/u-boot.lds) wont probably start at
adresse
0x100 in the image. The .text section is located after the .interp section.
See the README.
I've already looked. Here is a part:
System Initialization:
In the reset configuration, U-Boot starts at the reset entry point (on most PowerPC systens at address 0x00000100). Because of the reset configuration for CS0# this is a mirror of the onboard Flash memory. To be able to re-map memory U-Boot then jumps to it's link address.
What means link adress exactly? Run-Time adresses to RAM?
On MPC5xx processors CS0 belongs to the external flash memory. You either set RCW to boot from external (CS0 asserted) or internal (onboard) flash. But anyway whether to boot from, at adress 0x100 must be the the _start label located. How (or where) do you set the _start label to this adress in U-Boot image?
The other question was why to jump to the in_flash label? Following some subparts from the mailinglist thread "why jump at absolute address in start.S":
CFG_MONITOR_BASE is the physical address where you want the boot device to reside. It will be used to program the memory controller registers which select the boot device (OR0/BR0). As soon as the mask in OR0 is programmed correctly, the boot device will disappear from the entire address space,
and
be accessible only at the base address programmed in BR0.
This code jumps to the address that the boot device will appear at after
you
program the memory controller registers, so that the boot device will not disappear out from underneath you.
When I look what happens before the jump to the in_flash label, I see, that there no BRx or ORx have been set. Actually we still running, still the flash is mirrored over the whole adress space.
Anyway, what important is, are the following statments true:
1) We, for instance, burn U-Boot image to external flash 2) and start at adress 0x100. 3) Because code is relocatable, you can start executing where you like, for instance on adress X, depending on your processor. 4) You simply must ensure _start is at your entry point
-> How is this done on the MPC8xx, since _start will be in .text and .text following .interp in the flash image?
5) Since we procced executing from _start in flash,
-> why to jump to in_flash as already been mentioned?
Because the code is relocatable you can jump to any address you like - as long as the offset within the boot device is correct. "_start" is the
address
where the CPU will "start" execution - i.e. the hard reset vector.
"in_flash"
is where we want to continue execution after the jump (its the next
instruction
after the "blr" above - THEREFORE THIS REALLY ISN'T A JUMP BECAUSE YOU
SIMPLY
EXECUTE THE NEXT INSTRUCTION). EXC_OFF_SYS_RESET is added because we need
the
address to be relative to the start of the boot device, not the hard reset vector.
Best regards, Martin

In message 29726.1042461249@www64.gmx.net you wrote:
See the README.
I've already looked. Here is a part:
System Initialization:
In the reset configuration, U-Boot starts at the reset entry point (on most PowerPC systens at address 0x00000100). Because of the reset configuration for CS0# this is a mirror of the onboard Flash memory. To be able to re-map memory U-Boot then jumps to it's link address.
What means link adress exactly? Run-Time adresses to RAM?
Link address is the address for which the code is linked, i. e. the argument to the "-Ttext" linker option. You defined this as TEXT_BASE in your board specific config file. And no, this is not a RAM address, this is an address in flash memory (after the final flash mapping has been set up).
But anyway whether to boot from, at adress 0x100 must be the the _start label located. How (or where) do you set the _start label to this adress in U-Boot image?
See the previous discussion on the list, and read the MPC860 User's manual about the reset sequence. In short: after reset, the memory addresses by CS0 will be mirrored, so it will be visible at 0x00000000 and 0xFFF00000 and many other addresses as well.
The other question was why to jump to the in_flash label? Following
This has been answered in detail before. Once we program an address mask to OR0, the mirroring will stop, and we must be sure that our code is executing from an address that "stays visible".
When I look what happens before the jump to the in_flash label, I see, that there no BRx or ORx have been set. Actually we still running, still the flash is mirrored over the whole adress space.
Right, if we would program OR0 before jumping to a correct address in the area defined by the link address we would simply crash as the code woul be no longer visible.
Anyway, what important is, are the following statments true:
- We, for instance, burn U-Boot image to external flash
OK.
- and start at adress 0x100.
OK.
- Because code is relocatable, you can start executing where you like, for
instance on adress X, depending on your processor.
Wrong. You start at _start only, which in your case seems to be visible at 0x100 after reset.
- You simply must ensure _start is at your entry point
This sentence makes no sense. _start _IS_ the entry point. Period.
-> How is this done on the MPC8xx, since _start will be in .text and .text following .interp in the flash image?
There is no ".interp" in the image. Here is an example:
-> objdump -h u-boot
u-boot: file format elf32-big
Sections: Idx Name Size VMA LMA File off Algn 0 .text 00021590 40000000 40000000 00000078 2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE 1 .reloc 00001158 40021600 40021600 00021678 2**0 CONTENTS, ALLOC, LOAD, DATA 2 .data 0000642c 40022758 40022758 000227d0 2**3 CONTENTS, ALLOC, LOAD, DATA 3 .bss 00004270 40028c00 40028c00 00028c78 2**2 ALLOC 4 .stab 000318d8 00000000 00000000 00028c78 2**2 CONTENTS, READONLY, DEBUGGING 5 .stabstr 00010335 00000000 00000000 0005a550 2**0 CONTENTS, READONLY, DEBUGGING 6 .comment 00000cb1 00000000 00000000 0006a885 2**0 CONTENTS, READONLY
I have no idea what ".iterp" is. There is no single reference to any ".interp" in the whole U-Boot code.
- Since we procced executing from _start in flash,
-> why to jump to in_flash as already been mentioned?
Go back to position 0, and re-read this message from beginning.
I am NOT going to explain this YET ANOTHER TIME.
Best regards,
Wolfgang Denk
participants (2)
-
Martin Winistörfer
-
Wolfgang Denk