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

版本 e4daa3ba8f03d1834918cdb82210a0a8b42c52da

embedded/Lab6

Changes from e4daa3ba8f03d1834918cdb82210a0a8b42c52da to 978601a8e6f832b170a6d89786ce436e043721bc

---
title: Lab6: Hardware
toc: no
...


預期目標
-------
- 實際體驗 STM32 硬體操作
- 以 `STM32F4-Discovery<http://www.st.com/internet/evalboard/product/252419.jsp>`_ 為參考硬體,探討相關的軟體開發工具與流程
- Unit Test 概念的落實


開發工具介紹與準備
----------------
- GNU Toolchain: 同之前 Lab
- ICE = In-Circuit Emulator
- st-link
  * git clone https://github.com/texane/stlink.git

- `Remote Debugging using GDB<http://www.codeproject.com/Articles/14983/Remote-Debugging-using-GDB>`_
- sudo apt-get install git automake libusb-1.0-0-dev
- sudo cp 49-stlinkv2.rules /etc/udev/rules.d/

.. code-block:: prettyprint

    sudo apt-get install automake* libusb-1.0-0-dev
    git clone https://github.com/texane/stlink.git
    cd stlink
    ./autogen.sh
    ./configure
    make
    sudo cp 49-stlinkv2.rules /etc/udev/rules.d/

- 安裝必要的 Ubuntu 套件

.. code-block:: prettyprint

    sudo apt-get install automake*
    sudo apt-get install libjim-dev

- 取得 OpenOCD 原始程式碼

.. code-block:: prettyprint

    git clone git://openocd.git.sourceforge.net/gitroot/openocd/openocd

  * 或者 `openocd-d2f61e1a4592449188305164b27f495f78dca00a.tar.bz2</embedded/Lab6/openocd-d2f61e1a4592449188305164b27f495f78dca00a.tar.bz2>`_

- 編譯 OpenOCD

.. code-block:: prettyprint

    cd openocd
    export SKIP_SUBMODULE=1
    mkdir -p jimtcl
    ./bootstrap
    ./configure --prefix=/opt/openocd \
        --enable-jlink \
        --enable-amtjtagaccel \
        --enable-buspirate \
        --enable-stlink \
        --disable-libftdi \
        --disable-internal-jimtcl
    echo -e "all:\ninstall:" > doc/Makefile
    make
    sudo make install


Programming STM32 F2, F4 ARMs under Linux
------------------------------------------
- `A Tutorial from Scratch<http://www.triplespark.net/elec/pdev/arm/stm32.html>`_
  * Introduction STM32, STM32F2, STM32F4
  * Obtaining and Setting Up OpenOCD
  * Setting up the Hardware: STM32F4Discovery with integrated ST-Link/V2
  * The Minimalistic Hello-World Program
  * Running the Minimalistic Hello-World Program
  * Debugging
  * Automating the Steps


具備互動操作的 USB serial 實做
----------------------------
- http://wenku.baidu.com/view/595ae5124431b90d6c85c741.html
- http://wenku.baidu.com/view/72c30fc59ec3d5bbfd0a74cf.html
- http://www.sparetimelabs.com/usbcdcacm/ (文末提到與之前指定作業相關的技術議題)
- USB list: /var/lib/usbutils/usb.ids
- Neocon 離開方法: ~. -> exit
  * neocon /dev/ttyACM0

- http://wiki.openmoko.org/wiki/NeoCon
- http://wiki.openmoko.org/wiki/CDC_ACM



參考資訊
-------
- `STM32F4-Discovery 繁體中文簡易操作<http://cms.mcuapps.com/products/stm32f4-discovery/README.html>`_
- `OpenOCD 繁體中文簡易操作<http://cms.mcuapps.com/techinfo/toolchains/openocd/>`_