U-Boot Boot Sequence
Hi,
Quoted 5 lines
Quoted 1 line
Since most MPC8xx and MPCxx both start executing at adress
0x100thereThis is not necessarily true. It may be
0xFFF00100as well, depending on the HRCW...
This is true but lets assume we start from 0x100.
Quoted 11 lines
Quoted 3 lines
What I dont understand is, that the label
_start(Incpu/mpc8xx/start.S) will be placed to the runtime
adress0x100, but resides in the .text section which according to thelinker
Quoted 2 lines
file
(take as exampleboard/cogent/u-boot.lds) wont probably start atadresse
Quoted 2 lines
0x100
in the image. The .text section is located after the .interp section.See the README.
I've already looked. Here is a part:
Quoted 6 lines
System Initialization:
----------------------
In the reset configuration, U-Boot starts at the reset entry point (on most PowerPC systens at address0x00000100). 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":
Quoted 4 lines
CFG_MONITOR_BASEis 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
Quoted 3 lines
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
Quoted 2 lines
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?
Quoted 2 lines
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
Quoted 1 line
where the CPU will "start" execution - i.e. the hard reset vector.
"in_flash"
Quoted 1 line
is where we want to continue execution after the jump (its the next
instruction
Quoted 1 line
after the "blr" above - THEREFORE THIS REALLY ISN'T A JUMP BECAUSE YOU
SIMPLY
Quoted 1 line
EXECUTE THE NEXT INSTRUCTION).
EXC_OFF_SYS_RESETis added because we need
the
Quoted 2 lines
address to be relative to the start of the boot device, not the hard reset vector.
Best regards, Martin
Signature · 2 lines
+++ GMX - Mail, Messaging & more http://www.gmx.net +++ NEU: Mit GMX ins Internet. Rund um die Uhr f?r 1 ct/ Min. surfen!
Quoted 5 lines · In message <[email protected]> you wrote:
Quoted 2 lines
See the README.
I've already looked. Here is a part:
Quoted 8 lines
Quoted 6 lines
System Initialization:
----------------------
In the reset configuration, U-Boot starts at the reset entry point (on most PowerPC systens at address0x00000100). 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).
Quoted 3 lines
But anyway whether to boot from, at adress
0x100must be the the_startlabel located. How (or where) do you set the_startlabel 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.
Quoted 1 line
The other question was why to jump to the
in_flashlabel? 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".
Quoted 3 lines
When I look what happens before the jump to the
in_flashlabel, 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.
Quoted 3 lines
Anyway, what important is, are the following statments true:
1) We, for instance, burn U-Boot image to external flash
OK.
Quoted 1 line
2) and start at adress
0x100.
OK.
Quoted 3 lines
3) 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.
Quoted 1 line
4) You simply must ensure
_startis at your entry point
This sentence makes no sense. _start _IS_ the entry point. Period.
Quoted 2 lines
-> How is this done on the MPC8xx, since
_startwill 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.
Quoted 3 lines
5) Since we procced executing from
_startin flash,-> why to jump to
in_flashas 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
Signature · 3 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de Any technology distinguishable from magic is insufficiently advanced.