Skip to contentSkip to conversation

U-Boot Boot Sequence

U-Boot-Users Martin Winistörfer 2 participants 2 messages Jan 12, 2003

lore
Share & tools
lore
#0 lore raw

Hello all,

Im currently looking closely to the boot sequence for the MPC8xx but cant exactly
figure it out how it works. Every hint is appreciated.

Since most MPC8xx and MPCxx both start executing at adress 0x100 there must reside some code at this location at boot time. I assume the U-Boot image will
be burned to the external flash (CS0) and we start from there (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.

Are this assumptions true?

I have another question concerns the adress calculation
to in_flash label (Some guys already mentioned something about this on this list).
The U-Boot image is located in flash (CS0) we start executing at adress 0x100
in flash somehow. MPC is now executing instruction by instruction until the following lines:

Quoted 9 lines

/*
* Calculate absolute address in FLASH and jump there */

lis r3, CFG_MONITOR_BASE at h
ori r3, r3, CFG_MONITOR_BASE at l
addi r3, r3, in_flash - _start + EXC_OFF_SYS_RESET
mtlr r3
blr

My question is why to calculate the branch to in_flash and why adding the CFG_MONITOR_BASE? (dont be angry I know the same question has alredy been asked but....)

Since _start label is placed to location 0x100

Quoted 3 lines
	. = EXC_OFF_SYS_RESET
	.globl	_start
               _start:

and location counter will increase until to the in_flash label (and further of course),
the in_flash label will be always in a specific offset from the label _start.

Why we cant simply leave it (the branch calculation) and simply executing the next
instruction? (first instrution in in_flash)

I really dont know whether I simply make a huge mess but please help me to clarify it. 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!
#1 lore raw

Hello,

Quoted 4 lines · in message <[email protected]> you wrote:

Im currently looking closely to the boot sequence for the MPC8xx but cant exactly
figure it out how it works. Every hint is appreciated.

Did you read the README file? Section "System Initialization" ?

Quoted 1 line

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...

Quoted 7 lines

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.

Quoted 3 lines

I have another question concerns the adress calculation
to in_flash label (Some guys already mentioned something about this on this list).

So what was not clear in the previous explanations?

Quoted 3 lines

My question is why to calculate the branch to in_flash and why adding the CFG_MONITOR_BASE? (dont be angry I know the same question has alredy been asked but....)

Which exact part of the previous explanations did you not understand? It makes little sense to repeat the explanations if they are not clear enough for you.

Best regards,

Wolfgang Denk

Signature · 5 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
In a survey taken several years ago, all  incoming  freshmen  at  MIT
were  asked  if  they  expected  to graduate in the top half of their
class. Ninety-seven percent responded that they did.