why uboot copying itself to RAM

199 views
Skip to first unread message

Bharath R

unread,
Nov 22, 2015, 1:09:08 PM11/22/15
to BeagleBoard
Hi,

As per my knowledge, MLO(SPL) does basic operation like clock configuration, initialization of external eMMC, ext RAM and copy the u-boot image from eMMC to RAM(DDR3) and jumps to RAM locate where it has copied the u-boot.
But the u-boot startup code seems to mislead me.

Here is the code of u-boot start.S:

#ifndef CONFIG_SKIP_RELOCATE_UBOOT
relocate:                               /* relocate U-Boot to RAM           */
        adr     r0, _start              /* r0 <- current position of code   */
        ldr     r1, _TEXT_BASE          /* test if we run from flash or RAM */
        cmp     r0, r1                  /* don't reloc during debug         */
        beq     stack_setup

        ldr     r2, _armboot_start
        ldr     r3, _bss_start
        sub     r2, r3, r2              /* r2 <- size of armboot            */
        add     r2, r0, r2              /* r2 <- source end address         */

copy_loop:
        ldmia   r0!, {r3-r10}           /* copy from source address [r0]    */
        stmia   r1!, {r3-r10}           /* copy to   target address [r1]    */
        cmp     r0, r2                  /* until source end addreee [r2]    */
        ble     copy_loop
#endif  /* CONFIG_SKIP_RELOCATE_UBOOT */

why is u-boot's start.S copying itself to ext RAM(DDR3)?

Regards,
Bharath

Mark Lazarewicz

unread,
Nov 22, 2015, 1:28:21 PM11/22/15
to beagl...@googlegroups.com
Did you look where the reset vector points?


From: Bharath R <r.bhar...@gmail.com>
To: BeagleBoard <beagl...@googlegroups.com>
Sent: Sunday, November 22, 2015 1:09 PM
Subject: [beagleboard] why uboot copying itself to RAM

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Robert Nelson

unread,
Nov 22, 2015, 10:16:23 PM11/22/15
to Beagle Board

This is a standard procedure for u-boot, why don't you go ask them...

Regards,

Mark Lazarewicz

unread,
Nov 23, 2015, 7:52:49 AM11/23/15
to beagl...@googlegroups.com
Google is working now

From: Robert Nelson <robert...@gmail.com>
To: Beagle Board <beagl...@googlegroups.com>
Sent: Sunday, November 22, 2015 10:16 PM
Subject: Re: [beagleboard] why uboot copying itself to RAM

Jason Kridner

unread,
Nov 23, 2015, 8:50:27 AM11/23/15
to beagl...@googlegroups.com
If you want to avoid it, I believe you could run SPL from internal memory and compile in your kernel boot mechanism. 
--

Bharath R

unread,
Nov 25, 2015, 1:34:05 AM11/25/15
to BeagleBoard
Understood why we need this.

If we are using XIP memory then this is need else, SPL will be doing this operation.

Thanks a lot Jason.

Regards,
Bharath
Reply all
Reply to author
Forward
0 new messages