在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,91精品国产91免费

<menu id="6qfwx"><li id="6qfwx"></li></menu>
    1. <menu id="6qfwx"><dl id="6qfwx"></dl></menu>

      <label id="6qfwx"><ol id="6qfwx"></ol></label><menu id="6qfwx"></menu><object id="6qfwx"><strike id="6qfwx"><noscript id="6qfwx"></noscript></strike></object>
        1. <center id="6qfwx"><dl id="6qfwx"></dl></center>

            新聞中心

            ARM移植之BootLoader(3)

            作者: 時間:2016-11-10 來源:網(wǎng)絡(luò) 收藏
            3.2Bootloader拷貝

              配置為從NAND FLASH啟動,需要將NAND FLASH中的vivi代碼copy到RAM中:

            #ifdef CONFIG_S3C2410_NAND_BOOT
            bl copy_myself

            @ jump to ram
            ldr r1, =on_the_ram
            add pc, r1, #0
            nop
            nop
            1: b 1b @ infinite loop

            #ifdef CONFIG_S3C2410_NAND_BOOT
            @
            @ copy_myself: copy vivi to ram
            @
            copy_myself:
            mov r10, lr

            @ reset NAND
            mov r1, #NAND_CTL_BASE
            ldr r2, =0xf830 @ initial value
            str r2, [r1, #oNFCONF]
            ldr r2, [r1, #oNFCONF]
            bic r2, r2, #0x800 @ enable chip
            str r2, [r1, #oNFCONF]
            mov r2, #0xff @ RESET command
            strb r2, [r1, #oNFCMD]
            mov r3, #0 @ wait
            1: add r3, r3, #0x1
            cmp r3, #0xa
            blt 1b
            2: ldr r2, [r1, #oNFSTAT] @ wait ready
            tst r2, #0x1
            beq 2b
            ldr r2, [r1, #oNFCONF]
            orr r2, r2, #0x800 @ disable chip
            str r2, [r1, #oNFCONF]

            @ get read to call C functions (for nand_read())
            ldr sp, DW_STACK_START @ setup stack pointer
            mov fp, #0 @ no previous frame, so fp=0

            @ copy vivi to RAM
            ldr r0, =VIVI_RAM_BASE
            mov r1, #0x0
            mov r2, #0x20000
            bl nand_read_ll

            tst r0, #0x0
            beq ok_nand_read
            #ifdef CONFIG_DEBUG_LL
            bad_nand_read:
            ldr r0, STR_FAIL
            ldr r1, SerBase
            bl PrintWord
            1: b 1b @ infinite loop
            #endif

            ok_nand_read:
            #ifdef CONFIG_DEBUG_LL
            ldr r0, STR_OK
            ldr r1, SerBase
            bl PrintWord
            #endif

            @ verify
            mov r0, #0
            ldr r1, =0x33f00000
            mov r2, #0x400 @ 4 bytes * 1024 = 4K-bytes
            go_next:
            ldr r3, [r0], #4
            ldr r4, [r1], #4
            teq r3, r4
            bne notmatch
            subs r2, r2, #4
            beq done_nand_read
            bne go_next
            notmatch:
            #ifdef CONFIG_DEBUG_LL
            sub r0, r0, #4
            ldr r1, SerBase
            bl PrintHexWord
            ldr r0, STR_FAIL
            ldr r1, SerBase
            bl PrintWord
            #endif
            1: b 1b
            done_nand_read:

            #ifdef CONFIG_DEBUG_LL
            ldr r0, STR_OK
            ldr r1, SerBase
            bl PrintWord
            #endif

            mov pc, r10

            @ clear memory
            @ r0: start address
            @ r1: length
            mem_clear:
            mov r2, #0
            mov r3, r2
            mov r4, r2
            mov r5, r2
            mov r6, r2
            mov r7, r2
            mov r8, r2
            mov r9, r2

            clear_loop:
            stmia r0!, {r2-r9}
            subs r1, r1, #(8 * 4)
            bne clear_loop

            mov pc, lr

            #endif @ CONFIG_S3C2410_NAND_BOOT

              3.3進入C代碼

              首先要設(shè)置堆棧指針sp,堆棧指針的設(shè)置是為了執(zhí)行C語言代碼作好準(zhǔn)備。設(shè)置好堆棧后,調(diào)用C語言的main函數(shù):

            @ get read to call C functions
            ldr sp, DW_STACK_START @ setup stack pointer
            mov fp, #0 @ no previous frame, so fp=0
            mov a2, #0 @ set argv to NULL

            bl main @ call main

            mov pc, #FLASH_BASE @ otherwise, reboot



            關(guān)鍵詞: ARM移植BootLoade

            評論


            技術(shù)專區(qū)

            關(guān)閉