[U-Boot-Users] TEXT_BASE

Reinhard Meyer r.meyer at emk-elektronik.de
Wed Feb 5 22:20:20 CET 2003


Hello,

I just ported u-boot to our hardware. The Mystery about TEXT_BASE is as
follows:

1. of course your system starts with FLASH mapped repeatedly all over the
address space

2. but ultimately you want to remap FLASH to a higher address in order to
map RAM at 0
    (LinuX requires RAM at 0)

3. therefore u-boot has to transfer the Instruction Pointer to the address
range where you will map your FLASH

4. THAT address you tell by defining TEXT_BASE

for example:

I map my FLASH to 0x80000000. so I defined in TOP860.h (this is for a
MPC8xx):
#define CFG_FLASH_BASE 0x80000000 /* FLASH in final mapping */
#define CFG_FLASH_MAX 0x00400000 /* max FLASH to expect */
#define CFG_OR_TIMING_FLASH (OR_CSNT_SAM  | OR_ACS_DIV4 | OR_BI |
OR_SCY_4_CLK | OR_TRLX | OR_EHTR)
#define CFG_OR0_PRELIM (-CFG_FLASH_MAX | CFG_OR_TIMING_FLASH)
#define CFG_BR0_PRELIM (CFG_FLASH_BASE | BR_PS_16 | BR_V )

and in config.mk
TEXT_BASE = 0x80000000

TEXT_BASE MUST match the address in BR0

> So I am still confused.
> My board's flash sits at 0x00000000 this is where I load u-boot.bin and
> TEXT_BASE is also the same.
>
> This is also where the cpu jumps to to start executing.
>
> How does u-boot know where to relocate itself to in RAM?
>
>
> On Tuesday, February 4, 2003, at 05:28  PM, Wolfgang Denk wrote:
>
> > [Let's keep the list Cc:ed or others  will  ask  the  same  questions
> > again later. Well, they will anyhow :-( ]
> >
> > In message <8C12DADD-388E-11D7-8C12-00039390D626 at pepper.com> you wrote:
> >>
> >> I am still a bit confused.  Should I set TEXT_BASE to 0x0000000
> >> because
> >> that is where physical flash is located? or somewhere else.
> >
> > This depends. I don't  know  which  architecture  or  board  you  are
> > talking  about.  On  PowerPC  for  example, you will need to have RAM
> > mapped to physical address 0x0000 - at least if you ever want to  run
> > Linux.
> >
> > The thing is that it is _you_ who defines the physical  address  map,
> > and  who programs it with the memory controller of your board. In the
> > resulting final mapping, TEXT_BASE is the start address of the U-Boot
> > image.
> >
> > Let's stick with PPCBoot: after reset, a special temporary mapping is
> > in place, which will always access memory using /CS0. Note that  this
> > temporary  situation  has  nothing  to  do with the value defined for
> > TEXT_BASE.
> >
> > Best regards,
> >
> > Wolfgang Denk





More information about the U-Boot mailing list