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

版本 16a3e828bdb0a71d612ec3b17ab205b6e4a8dd5d

embedded/Lab7

Changes from 16a3e828bdb0a71d612ec3b17ab205b6e4a8dd5d to 95dc5ed9c0d5faaf0dfbdaafa722a9aa2007f0c3

---
title: Lab7: RTOS
toc: no
...

預期目標
-------
- 學習 OpenOCD 的操作與擴充
- ARM Semihosting 機制的應用

ARM Semihost
------------
* 使用 ARM 所開發的目標系統 (target system),不一定會提供所有的輸入/輸出設備。因此 ARM 設計了 semihost 這種機制,讓運行 ARM debugger 的主機可以與目標系統進行 I/O 溝通,以利產品開發
  - http://albert-oma.blogspot.tw/2012/04/semihosting.html
* Semihost 的實作是透過使用定義好的軟體中斷 (SVCs),使程式在執行過程中產生中斷。一旦目標系統上的程式呼叫到對應的指令 (semihosting call),便產生軟體中斷,接著 Debug Agent 就會負責處理此中斷,進行與主機的溝通
  - http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0205g/Bgbjhiea.html
* sudo apt-get install qemu-user
* sudo apt-get install qemu-user-static
* cd Labs/Lab7
* make factorial
* ./factorial

OpenOCD + STM32F4
------------------
* OpenOCD 的安裝請見 `Lab-6</embedded/Lab6>`_
* ARM On-Chip Debugging demonstration: http://www.youtube.com/watch?v=NSVOuHToJ6c
* Beginner’s look at On-Chip Debugging: http://hackaday.com/2012/09/27/beginners-look-at-on-chip-debugging/
* Architecture and Core Commands of OpenOCD
  - http://openocd.sourceforge.net/doc/html/Architecture-and-Core-Commands.html
  - Command: arm semihosting [enable|disable]
    + Display status of semihosting, after optionally changing that status.
    + "Semihosting allows for code executing on an ARM target to use the I/O facilities on the host computer i.e. the system where OpenOCD is running. The target application must be linked against a library implementing the ARM semihosting convention that forwards operation requests by using a special SVC instruction that is trapped at the Supervisor Call vector by OpenOCD."