u-boot-2014.10移植第11天----深入分析代碼(六),uboot2014.10移植

來源:互聯網
上載者:User

u-boot-2014.10移植第11天----深入分析代碼(六),uboot2014.10移植

硬體平台:tq2440

開發環境:Ubuntu-3.11

u-boot版本:2014.10

本文允許轉載,請註明出處:http://blog.csdn.net/fulinus


“從relocate_code回到_main中,接下來是main最後一段代碼”也就是arch/arm/lib/crt0.S檔案中:

    b   relocate_code
here:
//從這裡開始u-boot已經在重定位的地方運行了

/* Set up final (full) environment */


    bl  c_runtime_cpu_setup /* we still call old routine here */ 但是這裡還需要調用一下重定位之前的代碼。??為什麼呢?難道這個函數值沒有被修改嗎?估計是,rel.dyn段中放著的應該是C函數中用到的一些變數,而彙編中用到的地址沒有改變吧?(有待進一步研究),我們進入c_runtime_cpu_setup函數中去。明天繼續。


    ldr r0, =__bss_start    /* this is auto-relocated! */
    ldr r1, =__bss_end      /* this is auto-relocated! */


    mov r2, #0x00000000     /* prepare zero to clear BSS */


clbss_l:cmp r0, r1          /* while not at end of BSS */
    strlo   r2, [r0]        /* clear 32-bit BSS word */
    addlo   r0, r0, #4      /* move to next */
    blo clbss_l


    bl coloured_LED_init
    bl red_led_on


    /* call board_init_r(gd_t *id, ulong dest_addr) */
    mov     r0, r9                  /* gd_t */
    ldr r1, [r9, #GD_RELOCADDR] /* dest_addr */
    /* call board_init_r */
    ldr pc, =board_init_r   /* this is auto-relocated! */


    /* we should not return here. */


#endif


ENDPROC(_main)


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.