Skip to contentSkip to conversation

at91rm9200 lowlevel_init.S

U-Boot-Users Zhukov 2 participants 4 messages Jan 11, 2006 – Jan 12, 2006 1 message not in the archive

lore
Share & tools
lore

Zhukov

author
#0 lore raw

Hello, everybody.

Does anybody know, what can be tuned in "lowlevel_init" procedure in lowlevel_init.S module for at91rm9200dk? This init suspends u-boot. I tried to play with delays (loops), but it won't work anyway.

Regards
Andrew Zhukov

#1 lore raw
Quoted 3 lines · In message <[email protected]> you wrote:

Does anybody know, what can be tuned in "lowlevel_init" procedure in lowlevel_init.S module for at91rm9200dk? This init suspends u-boot. I

What exactly do you mean by "suspends u-boot" ?

Quoted 1 line

tried to play with delays (loops), but it won't work anyway.

???

The code is supposed to work fine on the at91rm9200dk board.

Are you really using such a board, or is this some custom hardware?

Best regards,

Wolfgang Denk

Signature · 6 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Die meisten Menschen pflegen im Kindesalter vom Zeigen auf Gegenst?n-
de (Mausbewegung) und "ga" sagen  (Mausklick)  abzukommen,  zugunsten
eines  m?chtigeren  und langwierig zu erlernenden Tools (Sprache).
                             -- Achim Linder in de.comp.os.linux.misc

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#3 lore raw
Quoted 2 lines
Quoted 2 lines

Does anybody know, what can be tuned in "lowlevel_init" procedure in lowlevel_init.S module for at91rm9200dk? This init suspends u-boot. I

WD> The code is supposed to work fine on the at91rm9200dk board. WD> Are you really using such a board, or is this some custom hardware?

Yes, my board is customozed - the hardware engineer edited RomBoot because of some differences in SDRAM system.

But... anyway, the lowlevel_init.S seems so strange, that some bug in its code is suspected.

Would you explain the meaning of _MTEXT_BASE in fragments like this:

        ldr     r0, =SMRDATA1
        ldr     r1, _MTEXT_BASE
        sub     r0, r0, r1
        add     r2, r0, #176
2:
        /* the address */
        ldr     r1, [r0], #4
        /* the value */
        ldr     r3, [r0], #4
        str     r3, [r1]
        cmp     r2, r0
        bne     2b

I guess _MTEXT_BASE is a start of code, the location just after vectors. But what's the use of it here?

Suspecting hardware problem, I skip everything after the first step of the procedure:

        /* Get the CKGR Base Address */
        ldr     r1, =AT91C_BASE_CKGR           
        /* Main oscillator Enable register */
#ifdef CFG_USE_MAIN_OSCILLATOR
        ldr     r0, =0x0000FF01 /* Enable main oscillator */
#else
        ldr     r0, =0x0000FF00 /* Disable main oscillator */
#endif
        str     r0, [r1, #CKGR_MOR]
        ...     /* delay */
        b         exit          

This cut works fine, u-boot loads. Next, I tried to replace this with the following:

        ldr     r0, =CKGRDATA      
        ldr     r1, _MTEXT_BASE    
        sub     r0, r0, r1         
        add     r2, r0, #8      /* 8 bytes */
3:
        /* the address */
        ldr     r1, [r0], #4
        /* the value */
        ldr     r3, [r0], #4
        str     r3, [r1]
        cmp     r2, r0
        bne     3b
        ...     /* delay */

        ...

CKGRDATA:

        .word AT91C_BASE_CKGR
        .word 0x0000FF01
        /* 8 bytes long */

It FAILS! Obviously, u-boot crashes here. Something wrong in code...

Best regards,

#4 lore raw
Quoted 2 lines · In message <[email protected]> you wrote:

I guess _MTEXT_BASE is a start of code, the location just after vectors.

Why are you guessing - why don't you read the code?

_MTEXT_BASE:
...
.word TEXT_BASE
...

As you can see your guess was wrong. _MTEXT_BASE is a word of memory which holds the value TEXT_BASE.

Quoted 1 line

But what's the use of it here?

So that you can load it easily into a register?

Quoted 1 line

It FAILS! Obviously, u-boot crashes here. Something wrong in code...

What does "it crashes here" mean? Where exactly does it crash, and why? You single-step this code, don't you?

Best regards,

Wolfgang Denk

Signature · 6 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
But the only way of discovering the limits  of  the  possible  is  to
venture a little way past them into the impossible.
                         - _Profiles of the Future_ (1962; rev. 1973)
                  ``Hazards of Prophecy: The Failure of Imagination''