1. 程式人生 > >移植 u-boot-1.1.6 到 FL2440(1)---實現基本功能

移植 u-boot-1.1.6 到 FL2440(1)---實現基本功能

/* Set up the stack   */
stack_setup:
ldrr0, _TEXT_BASE/* upper 128 KiB: relocated uboot   */
subr0, r0, #CFG_MALLOC_LEN/* malloc area                      */
subr0, r0, #CFG_GBL_DATA_SIZE /* bdinfo                        */
#ifdef CONFIG_USE_IRQ
subr0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
#endif
subsp, r0, #12/* leave 3 words for abort-stack    */

#ifndef CONFIG_SKIP_LOWLEVEL_INIT
    bl clock_init/* ³õʼ»¯Ê±ÖÓƵÂÊ */
#endif    

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

ldrr2, _armboot_start
ldrr3, _bss_start
subr2, r3, r2/* r2 <- size of armboot            */
#if 1
blCopyCode2Ram/* r0:source, r1:dest, r2:size */
#else
addr2, r0, r2/* r2 <- source end address         */

copy_loop:
ldmiar0!, {r3-r10}/* copy from source address [r0]    */
stmiar1!, {r3-r10}/* copy to   target address [r1]    */
cmpr0, r2/* until source end addreee [r2]    */
blecopy_loop
#endif
#endif/* CONFIG_SKIP_RELOCATE_UBOOT */

clear_bss:
ldrr0, _bss_start/* find start of bss segment        */
ldrr1, _bss_end/* stop here                        */
mov r2, #0x00000000/* clear                            */

clbss_l:strr2, [r0]/* clear loop...                    */
addr0, r0, #4
cmpr0, r1
bleclbss_l

SetLoadFlag:
/* Set a global flag, PreLoadedONRAM */
adrr0, _start/* r0 <- current position of code   */
ldrr1, _TEXT_BASE/* test if we run from flash or RAM */
cmp     r0, r1                  /* don't reloc during debug         */
ldr r2, =PreLoadedONRAM
mov r3, #1
streq r3, [r2]