分享到plurk 分享到twitter 分享到facebook

版本 40348004613ddbecc40482d4a2b4ea010a4503d3

embedded/Lab36

Changes from 40348004613ddbecc40482d4a2b4ea010a4503d3 to 5603177eea7fc8a833cdf701d2d6a0d0430e78a1

---
title: Lab36: ELF
toc: no
...

預期目標
-------------
* 在 `STM32F429i Discovery</embedded/STM32F429>`_ 開發簡易 ELF loader
* 學習 OpenOCD 和 gdb

預先準備
------------
* 確認 $PATH 可找到 `Lab 35</embedded/Lab35>`_ 設定的 GNU Toolchain
  - ``arm-none-eabi-gcc -v`` 預期輸出 ``4.8.3-11ubuntu1`` 一類包含 ubuntu 的字串
  - 若否,請重新設定 PATH 環境變數

* 確認 `STM32F429i Discovery</embedded/STM32F429>`_ 板子已經由 USB 線接上裝有 GNU/Linux 的開發環境,並確保 `Lab 35</embedded/Lab35>`_ 所提及的工具均已正確安裝,如 openocd 與 gdb


$ make oocd 
參考執行結果:

.. code-block:: prettyprint

    make[1]: Entering directory 'elfloader/app'
     CLEAN
     CC main.c
     CC start.c
     LINK app.elf
       text	   data	    bss	    dec	    hex	filename
        164	      8	      4	    176	     b0	app.elf
     Creating list...
    make[1]: Leaving directory 'elfloader/app'
     Launch OpenOCD for stm32f4discovery
    Open On-Chip Debugger 0.9.0-dev-00105-ge1bc7f4 (2014-08-08-20:38)
    ...
    ELF: Scan ELF indexs...
    ELF: Examining section 1 .text
    ELF: Examining section 2 .rel.text
    ELF: Examining section 3 .rodata
    ...
    ELF: Examining section 11 .symtab
    ELF: Examining section 12 .strtab
    ELF: Done
    ELF: Relocating section .text
    ELF:  Offset   Info     Type             Name
    ELF:  00000034 00001202 R_ARM_ABS32      i
    ...
    ELF: Relocating section .rodata
    ELF:  Offset   Info     Type             Name
    ELF:  00000038 00001502 R_ARM_ABS32      banner
    ...
    ELF:   symAddr=20000F48 relAddr=20000F8C
    ELF:   R_ARM_ABS32 relocated is 0x20000F54
    Hello world on Oct 30 2014 at 17:28:11 (0)
    ...
    Done
    semihosting: *** application exited ***


預期目標
------------
* 在 `STM32F429i Discovery</embedded/STM32F429>`_ 開發簡易 ELF loader
* 學習 OpenOCD 和 gdb

參考資訊
------------
* `BeagleBoard OpenOCD<http://elinux.org/BeagleBoardOpenOCD>`_
* `GDB and OpenOCD<http://openocd.sourceforge.net/doc/html/GDB-and-OpenOCD.html>`_