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

版本 5ab573416a715d754d3136c9ad1366ac617342c7

embedded/Lab29

Changes from 5ab573416a715d754d3136c9ad1366ac617342c7 to 9490ee52b839700de02eb350009364d5816f0817

---
title: Lab29: FreeRTOS
toc: no
...

預期目標
-------
* 配合 `Week #5</embedded/2014-w5>`_ 進度
* 在 QEMU 模擬的 STM32 環境中,嘗試執行 `FreeRTOS<http://www.freertos.org/>`_ 並且學習相關的操作
  - 熟悉 FreeRTOS 的內部運作機制
  - 實地練習 Multi-tasking 程式設計

* 學習 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

* FreeRTOS extensions: https://github.com/hugovincent/mbed-freertos
  - lib/semifs.c
  - mbed (mbed.org) target supports semihosted local filesystem, accessible via the mbed USB interface. Should also work with semihosting-compatible debuggers.

* QEMU ARM semihosting
  - http://balau82.wordpress.com/2010/11/04/qemu-arm-semihosting/

qemu-semihost 操作
---------------------------------
* cd ~/workspace
* git clone git://github.com/embedded2013/qemu-semihost.git
* git clone git@github.com:embedded2013/qemu-semihost.git # 如果上一行失敗
* cd qemu-semihost
* ./test.sh

參考執行畫面:

 .. image:: /embedded/Lab20/semihost.png