1. 程式人生 > >使用jlink燒寫uboot

使用jlink燒寫uboot

        .long   0
@ 0x24:
        .long   0
@ 0x28: where this vivi was linked, so we can put it in memory in the right place
        .long   _start
@ 0x2C: this contains the platform, cpu and machine id
        .long   ARCHITECTURE_MAGIC
@ 0x30: vivi capabilities
        .long   0
#ifdef CONFIG_PM
@ 0x34:
        b       SleepRamProc
#endif
#ifdef CONFIG_TEST
@ 0x38:
        b       hmi
#endif
.globl  _armboot_end_data
_armboot_end_data:
        .word   armboot_end_data
.globl  _armboot_end
_armboot_end:
        .word   armboot_end
.globl  IRQ_STACK_START
IRQ_STACK_START:
        .word   0x0badc0de
.globl  _armboot_real_end
_armboot_real_end:
        .word 0x0badc0de
.globl  _armboot_start
_armboot_start:
        .word _start
.globl  FIQ_STACK_START
FIQ_STACK_START:
        .word   0x0badc0de
@
@ Start VIVI head
@
Reset:                                      @復位後跳轉到這裡執行
        @ disable watch dog timer
        mov     r1, #0x53000000
        mov     r2, #0x0
        str     r2, [r1]
        @ bl led_on
#ifdef CONFIG_S3C2410_MPORT3                @未定義,不執行
        mov     r1, #0x56000000
        mov     r2, #0x00000005
        str     r2, [r1, #0x70]
        mov r2, #0x00000001
        str     r2, [r1, #0x78]
        mov     r2, #0x00000001
        str r2, [r1, #0x74]
#endif         @ disable all interrupts
        mov     r1, #INT_CTL_BASE                              @遮蔽中斷
        mov     r2, #0xffffffff
        str     r2, [r1, #oINTMSK]
        ldr     r2, =0x7ff
        str     r2, [r1, #oINTSUBMSK]           @ initialise system clocks
        mov     r1, #CLK_CTL_BASE
        mvn     r2, #0xff000000
        str     r2, [r1, #oLOCKTIME]         @ldr    r2, mpll_50mhz
        @str    r2, [r1, #oMPLLCON]
#ifndef CONFIG_S3C2410_MPORT1
        @ 1:2:4
        mov     r1, #CLK_CTL_BASE
        mov     r2, #0x3
        str     r2, [r1, #oCLKDIVN]     mrc p15, 0, r1, c1, c0, 0       @ read ctrl register                     想問具體的,這個可以百度下為什麼
    orr r1, r1, #0xc0000000     @ Asynchronous
    mcr p15, 0, r1, c1, c0, 0       @ write ctrl register     @ now, CPU clock is 100 Mhz
    mov r1, #CLK_CTL_BASE
    ldr r2, mpll_200mhz
    str r2, [r1, #oMPLLCON]
#endif .globl backlight_off
        @ All LED on
backlight_off:
        mov     r1, #GPIO_CTL_BASE
        add     r1, r1, #oGPIO_G
        ldr     r2,=0x100
        str     r2, [r1, #oGPIO_CON]
        mov     r2, #0xff
        str     r2, [r1, #oGPIO_UP]
        mov     r2, #0x00
        str     r2, [r1, #oGPIO_DAT]         bl      memsetup                @dram初始化 #ifdef CONFIG_PM
        @ Check if this is a wake-up from sleep
        ldr     r1, PMST_ADDR
        ldr     r0, [r1]
        tst     r0, #(PMST_SMR)
        bne     WakeupStart
#endif
/*#ifdef CONFIG_S3C2410
led_light_on:
        @ All LED on
        mov     r1, #GPIO_CTL_BASE
        add     r1, r1, #oGPIO_F
        ldr     r2,=0x55aa
        str     r2, [r1, #oGPIO_CON]
        mov     r2, #0xff
        str     r2, [r1, #oGPIO_UP]
        mov     r2, #0x00
        str     r2, [r1, #oGPIO_DAT]
#endif*/ #if 0
        @ SVC
        mrs     r0, cpsr
        bic     r0, r0, #0xdf
        orr     r1, r0, #0xd3
        msr     cpsr_all, r1
#endif         @ set GPIO for UART
        mov     r1, #GPIO_CTL_BASE       @配置串列埠
        add     r1, r1, #oGPIO_H
        ldr     r2, gpio_con_uart
        str     r2, [r1, #oGPIO_CON]
        ldr     r2, gpio_up_uart
        str     r2, [r1, #oGPIO_UP]    
        bl      InitUART
#ifdef CONFIG_DEBUG_LL
        @ Print current Program Counter
        ldr     r1, SerBase
        mov     r0, #'\r'
        bl      PrintChar
        mov     r0, #'\n'
        bl      PrintChar
        mov     r0, #'@'
        bl      PrintChar
        mov     r0, pc
        bl      PrintHexWord
#endif #ifdef CONFIG_BOOTUP_MEMTEST
        @ simple memory test to find some DRAM flaults.
        bl      memtest
#endif
#ifdef CONFIG_S3C2410_NAND_BOOT
#if 0
        bl      copy_myself
#else
        adr r0, _start
        ldr r1, =0x33f00000
        cmp r0, r1
        blne copy_myself                @將程式碼從nand拷貝到dram的0x33f0 0000
#endif         @ jump to ram
        mov     r1, #GPIO_CTL_BASE      @板上的led燈指示
        add     r1, r1, #oGPIO_F
        ldr     r2,=0x55aa
        str     r2, [r1, #oGPIO_CON]
        mov     r2, #0xff
        str     r2, [r1, #oGPIO_UP]
        mov     r2, #0xb0
        str     r2, [r1, #oGPIO_DAT]         ldr     r1, =on_the_ram        @這個指令時重定位的關鍵,彙編程式碼可以看到這個不是基於pc的,它是一個固定值,指向dram的相應位置
        add     pc, r1, #0                  @跳轉到dram執行,
        nop
        nop
1:      b       1b              @ infinite loop
on_the_ram:
#endif #ifdef CONFIG_DEBUG_LL
        ldr     r1, SerBase
        ldr     r0, STR_STACK
        bl      PrintWord
        ldr     r0, DW_STACK_START
        bl      PrintHexWord
#endif