stellaris 1day workshop - texas...

20
Stellaris 1day Workshop Student Guide 日本語版 Jan 2010

Upload: others

Post on 07-Sep-2020

13 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Stellaris 1day Workshop - Texas Instrumentsprocessors.wiki.ti.com/images/7/70/4stellaris_ws_jp...Stellaris 1day Workshop – For Application Development 4 - 3 USB インターフェイス準拠

Stellaris 1day Workshop

Student Guide 日本語版

Jan 2010

Page 2: Stellaris 1day Workshop - Texas Instrumentsprocessors.wiki.ti.com/images/7/70/4stellaris_ws_jp...Stellaris 1day Workshop – For Application Development 4 - 3 USB インターフェイス準拠

Notice Creation of derivative works unless agreed to in writing by the copyright owner is forbidden. No portion of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, without the prior written permission from the copyright holder.

Texas Instruments reserves the right to update this Guide to reflect the most current product information for the spectrum of users. If there are any differences between this Guide and a technical reference manual, references should always be made to the most current reference manual. Information contained in this publication is believed to be accurate and reliable. However, responsibility is assumed neither for its use nor any infringement of patents or rights of others that may result from its use. No license is granted by implication or otherwise under any patent or patent right of Texas Instruments or others.

Page 3: Stellaris 1day Workshop - Texas Instrumentsprocessors.wiki.ti.com/images/7/70/4stellaris_ws_jp...Stellaris 1day Workshop – For Application Development 4 - 3 USB インターフェイス準拠

Stellaris 1day Workshop – For Application Development 4 - 1

アプリケーション作成に向けて

Module Topics アプリケーション作成に向けて ............................................................................................................. 4-1

Stellaris 用ソフトウェア....................................................................................................................... 4-2 ファームウェア開発パッケージ .................................................................................................... 4-2 RTOS.................................................................................................................................................. 4-5 StellarisWare 3rdパーティ・フォルダ ............................................................................................. 4-6 日本の 3rd パーティ ......................................................................................................................... 4-6

Lab 4 サンプルプログラムのビルド、デバッグを行う................................................................... 4-7 Part1. LED の点滅周期をターミナルからコントロールするプログラムの作成 ...................... 4-8 Part2. StellarisWare のサンプルプロジェクトをビルド、デバッグ...........................................4-16

オプション演習....................................................................................................................................4-18 tiobj2bin ユーティリティを使い.bin ファイルを作成 .................................................................4-18

Page 4: Stellaris 1day Workshop - Texas Instrumentsprocessors.wiki.ti.com/images/7/70/4stellaris_ws_jp...Stellaris 1day Workshop – For Application Development 4 - 3 USB インターフェイス準拠

Stellaris 1day Workshop – For Application Development 4 - 2

Stellaris 用ソフトウェア

ファームウェア開発パッケージ

ファームウェア開発パッケージ

各評価キット/リファレンスキットごとに用意

多くのサンプルを同封ペリフェラル・ドライバ ライブラリ

USBライブラリ

グラフィックスライブラリ

オープンソースのTCP/IP、File Systemその他ユーティリティ・モジュール

グラフィックス・ライブラリのサンプル

基本 オプション・ボタン チェックボックス

キャンバス プッシュボタン コンテナ

セキュリティ・キーパッド

BLDC タッチスクリーン

モーター・コントローラ

※※このグラフィックス・ライブラリは特定のこのグラフィックス・ライブラリは特定のLCDLCDパネルパネル//コントローラを対象にしたコントローラを対象にしたソフトウェアではありません。ソフトウェアではありません。

Page 5: Stellaris 1day Workshop - Texas Instrumentsprocessors.wiki.ti.com/images/7/70/4stellaris_ws_jp...Stellaris 1day Workshop – For Application Development 4 - 3 USB インターフェイス準拠

Stellaris 1day Workshop – For Application Development 4 - 3

USB インターフェイス準拠

Stellaris は、USB デバイスおよび組み込みホスト準拠テストに合格

入手できるサンプル:

デバイスの例:HID キーボード

HID マウス

CDC シリアル

ジェネリック・バルク

デバイス・ファームウェアのアップグレード

オシロスコープ

ホスト例:

マス・ストレージ

HID キーボード

HID マウス

Windows INF ファイルの記述とサポート対象クラス

ベースとなる Windows ドライバを指す

config 文字列をセットする

PID/VID をセットする

プリコンパイルされた DLL が用意されているため開発時間が短縮される

デバイス・フレームワークを USBLib に統合

USB ライブラリ

2010/1/26 5

USB ホスト/デバイスオシロスコープのデモンストレーション

USB ホスト・モード

メモリ・スティックへのデータ・ダンプ

オシロスコープ配線 オシロスコープ・デモ オシロスコープ・オプション

USB デバイス・モードPC によるデモの制御

Page 6: Stellaris 1day Workshop - Texas Instrumentsprocessors.wiki.ti.com/images/7/70/4stellaris_ws_jp...Stellaris 1day Workshop – For Application Development 4 - 3 USB インターフェイス準拠

Stellaris 1day Workshop – For Application Development 4 - 4

システム・プログラミング・オプション

Stellaris Stellaris シリアル・フラッシュ・ローダシリアル・フラッシュ・ローダデバッグ・インターフェイスを必要とすることなく、フラッシュ・プログラミングを可能にする小さなプログラム

Stellaris MCU 製品はすべて、このローダがフラッシュ・メモリに事前にロードされた状態で出荷

インターフェイス・オプションには、UART または SSI がある

アプリケーション・ノート AN01242 を参照

Stellaris Stellaris ブート・ローダブート・ローダアプリケーション・ローダとして機能する小さなプログラム

また、Stellaris マイクロコントローラ上で実行中のアプリケーションのアップデート・メカニズムとしても使われる

インターフェイス・オプションには、UART(デフォルト)、I2C、SSI、イーサネット、USB がある

アプリケーション・ノート AN01248 を参照

オンチップ・ソフトウェアの機能拡張(ROM)

ROMに搭載されているStellarisWare®

StellarisWare® DriverLibStellarisWare® ブートローダ

その他のフラッシュ・メモリ節約オプション(AESテーブル、CRC)

※※すべてのすべてのStellarisStellarisデバイスにデバイスにROMROMが搭載されているわけではありません。が搭載されているわけではありません。

使い方概要使い方概要1. ビルド・オプションにてTARGET_IS_TEMPEST_RB1

またはTARGET_IS_DUSTDEVIL_RA0をプリ・デファイン

2.2. driverlib/rom.hdriverlib/rom.hをインクルードをインクルード

3.3. ROM_xxxROM_xxx() API() APIを使用を使用

Page 7: Stellaris 1day Workshop - Texas Instrumentsprocessors.wiki.ti.com/images/7/70/4stellaris_ws_jp...Stellaris 1day Workshop – For Application Development 4 - 3 USB インターフェイス準拠

Stellaris 1day Workshop – For Application Development 4 - 5

RTOS

SafeRTOS概要

割り込み禁止(Disable可能なもののみ)、もしくはスケジューラのサスペンド(ISRの実行が可能)

クリティカルセクション

0:最低 < 10:最高 (ROM版での制限)、動的変更可能タスクプライオリティ

Ready / Running / Blocked (WAIT) / Suspendedタスク状態

プリエンプティブかつタイムスライス(同優先度のラウンドロビン)スケジューリング

Systick timer を利用。Tick数の取得、一定時間のDelayが可能時間管理

Disable可能 7:最低 < 5:最高 (API実行可能)Disable不可能 4:最低 < 0:最高 (API実行禁止)

ISRプライオリティ

なしメモリプール

なしmutex

なし(キューを利用した実装が可能)セマフォ

なしイベントフラグ

あり(バッファは動的生成せず)メッセージキュー

524Byte (0x20000000 – 0x0000020C固定)使用SRAM

数量無制限(メモリ依存)、動的生成(スタックは動的生成せず)タスク生成

freeRTOSをベースとした独自仕様規格

LM3S9B96LM3S9B96ののROMROMに搭載に搭載

DSP/BIOS6概要

0:最低 < 31:最高、動的変更不可Swiプライオリティ

Inactive / Ready / RunningSwi状態

数量無制限(メモリ依存)、動的生成可能Swi生成

Hwi / Swi / Task / Idleスレッド・モデル

各スレッド・スケジューラのDisable、プライオリティの動的変更クリティカルセクション

0:最低 < 31:最高、動的変更可能タスクプライオリティ

Ready / Running / Blocked / Terminatedタスク状態

プリエンプティブスケジューリング

Tick数の取得、一定時間のDelayが可能時間管理

ありメモリプール

ありmutex

ありセマフォ

ありイベントフラグ

ありキュー

スケーラブル(使用するモジュールごとに増加)使用SRAM

数量無制限(メモリ依存)、動的生成可能タスク生成

独自仕様規格

TI DSPTI DSP向け向けRTOSRTOSををARMARMコアに対応コアに対応

Page 8: Stellaris 1day Workshop - Texas Instrumentsprocessors.wiki.ti.com/images/7/70/4stellaris_ws_jp...Stellaris 1day Workshop – For Application Development 4 - 3 USB インターフェイス準拠

Stellaris 1day Workshop – For Application Development 4 - 6

StellarisWare 3rdパーティ・フォルダ

3rdパーティ・フォルダ

StellarisStellarisへ移植済みのソフトウェアへ移植済みのソフトウェア

※※ライセンス等は各ソフトウェアに従いますのでご注意くださいライセンス等は各ソフトウェアに従いますのでご注意ください

日本の 3rd パーティ

10

関連会社様(抜粋)

IARシステムズ株式会社統合開発環境「EWARM」を始め、ハード評価、ソフト開発に必要なOS、ミドル、開発ツールをトータルに提供

株式会社エーアイコーポレーションRLL機能対応μITRON仕様RTOS「TOPPERS-Pro」、iPodクラスドライバ対応USBをはじめ各種ミドルウェアの提供

イー・フォース株式会社Cortex-M3に最適化されたコンパクトタイプのμITRON仕様RTOS「μC3/Compact」とTCP/IPスタック「μNet3/Compact」

株式会社コンピューテックスSWD、SWVテクノロジー対応JTAGエミュレータ「PALMiCE3」、「J-STICK」、Flash Programmer「FP-10」、統合開発環境「CSIDE-IDE」

株式会社ソフィアシステムズARM KEIL製品正規代理店、ソフィアシステムズ製エミュレータ、オンボード・フラッシュROMライタ、各種評価ボード、受託開発

日本の3rdパーティ

Page 9: Stellaris 1day Workshop - Texas Instrumentsprocessors.wiki.ti.com/images/7/70/4stellaris_ws_jp...Stellaris 1day Workshop – For Application Development 4 - 3 USB インターフェイス準拠

Stellaris 1day Workshop – For Application Development 4 - 7

Lab 4 サンプルプログラムのビルド、デバッグを行う

Lab4:サンプルプログラムのビルド、デバッグを行う

1. ファームウェア開発パッケージに含まれるユーティリティ“Command Line Processing Module”を使いターミナル(UART接続)からLEDの点滅周期をコントロールするソフトウェアを作成

2. Lab1にて動かしたサンプルのプロジェクトをインポート、ビルド、デバッグ

Command Line Processing Module

データ型データ型typedef int (*pfnCmdLine)(int argc, char *argv[]);

typedeftypedef structstruct{{

const char *const char *pcCmdpcCmd;;pfnCmdLinepfnCmdLine pfnCmdpfnCmd;;const char *const char *pcHelppcHelp;;

}}tCmdLineEntrytCmdLineEntry変数変数tCmdLineEntrytCmdLineEntry g_sCmdTableg_sCmdTable[ ][ ]関数関数int CmdLineProcess (char *pcCmdLine)

コマンドラインの文字配列のポインタを渡して実行する。g_sCmdTableに該当するコマンドの構造体があれば、同構造体のpfnCmdメンバ(関数)を実行する。

APIAPI例)例)usb_host_mscusb_host_mscIntIntCmd_help(intCmd_help(int argcargc, char *, char *argvargv[])[]){{

<<中略中略>>return(0);return(0);

}}……

tCmdLineEntrytCmdLineEntry g_sCmdTableg_sCmdTable[] =[] ={{

{ { ““helphelp””, , Cmd_helpCmd_help, , ““ : Display list of commands: Display list of commands”” },},<<中略中略>>

{ "cat", { "cat", Cmd_catCmd_cat, " : Show contents of a text file" },, " : Show contents of a text file" },{ 0, 0, 0 }{ 0, 0, 0 }

};};……

IntIntmain(voidmain(void)){{

intint iStatusiStatus;;<<中略中略> >

ReadLineReadLine();();if(g_cCmdBuf[0] == 'if(g_cCmdBuf[0] == '¥¥0')0'){{

continue;continue;}}

iStatusiStatus = = CmdLineProcess(g_cCmdBufCmdLineProcess(g_cCmdBuf););

if(iStatusif(iStatus == CMDLINE_BAD_CMD)== CMDLINE_BAD_CMD){{

UARTprintf("BadUARTprintf("Bad command!command!¥¥n");n");}}

……

ReadLine関数でターミナルの入力を配列g_cCmdBufへ代入しています

※ 演習で使用する StellarisWare は

“C:\StellarisWare” にインストールされているものとして説明します。

Page 10: Stellaris 1day Workshop - Texas Instrumentsprocessors.wiki.ti.com/images/7/70/4stellaris_ws_jp...Stellaris 1day Workshop – For Application Development 4 - 3 USB インターフェイス準拠

Stellaris 1day Workshop – For Application Development 4 - 8

Part1. LED の点滅周期をターミナルからコントロールする

プログラムの作成

1. プロジェクトを作成します。

lab4 という名前のプロジェクトを作成してください。ワークスペースにある lab4 以

外のプロジェクトは閉じておくといいでしょう。

2. 既存のファイルを追加します。

lab4 では lab3 で作成したプログラムをベースに Command Line Processing Module を使ったルーチンを追加してみます。以下のファイルをプロジェクトに追加してくだ

さい。

startup_ccs.c lab3.c driverlib.lib uartstdio.c

Page 11: Stellaris 1day Workshop - Texas Instrumentsprocessors.wiki.ti.com/images/7/70/4stellaris_ws_jp...Stellaris 1day Workshop – For Application Development 4 - 3 USB インターフェイス準拠

Stellaris 1day Workshop – For Application Development 4 - 9

lab3.c は lab4.c に名前を変更してください。プロジェクトビューから lab3.c を右クリ

ック→Rename より変更できます。

3. インクルード・サーチパスを追加します。

StellarisWare のライブラリ用ヘッダファイルを使用していますので、lab3 と同様に

ビルドオプションにインクルード・サーチパスを追加してください。

Page 12: Stellaris 1day Workshop - Texas Instrumentsprocessors.wiki.ti.com/images/7/70/4stellaris_ws_jp...Stellaris 1day Workshop – For Application Development 4 - 3 USB インターフェイス準拠

Stellaris 1day Workshop – For Application Development 4 - 10

4. ビルド、ロード、実行し、いったん動作確認します。

ここまでで lab3 と同じプログラムができあがったはずですので、動作確認してくだ

さい。

5. Command Line Processing Module のソースファイルを追加します。

Command Line Processing Module のソースファイル cmdline.c は uartstdio.c と同じ

く C:\StellarisWare\utils フォルダにありますのでプロジェクトに追加してください。

6. lab4.c に記述を追加します。

追加する記述が少し多めですので追加するコードを

C:\stellaris_1day\template\lab4_template.c に用意してあります。書かれているコードを

lab4.c の適当な場所へ追加してください。また SysTick の割込み処理関数内の

UARTprintf 関数の処理は、コマンド入力をしづらくすると思いますのでコメントア

ウトしてください。

処理の流れは以下のようになります。

① クロックや周辺機能の初期化

② 割込み許可

③ ターミナルからの入力読み込み

④ コマンドの実行及びエラー処理

⑤ ③に戻る

以下 lab4_template.c の解説です。行番号は次ページより掲載のソースにもとづいて

います。

1 行目から 6 行目は必要なヘッダファイルのインクルードです。追加するコードの

中でCスタンダードライブラリ関数、ペリフェラル・ドライバ・ライブラリの

UART 用関数、Command Line Processing Module ユーティリティの関数を使用してい

ます。

11 行目は Command Line Processing Module ユーティリティの CmdLineProcess 関数に

渡すコマンドライン文字列用の配列 g_cCmdBuf[]の宣言です。

13 行目から 97 行目はターミナルからの入力を g_cCmdBuf 配列へ代入する ReadLine関数(サブルーチン)の記述です。

99 行目から 136 行目はこのプログラムで使えるコマンドのヘルプをターミナルに表

示する関数(サブルーチン)の記述です。

Page 13: Stellaris 1day Workshop - Texas Instrumentsprocessors.wiki.ti.com/images/7/70/4stellaris_ws_jp...Stellaris 1day Workshop – For Application Development 4 - 3 USB インターフェイス準拠

Stellaris 1day Workshop – For Application Development 4 - 11

138 行目から 165 行目はターミナルの入力から SysTick に任意のピリオドを設定する

関数(サブルーチン)の記述です。

167 行目から 174 行目は Command Line Processing Module が参照する構造体の配列

g_sCmdTable[]の宣言です。 ※配列 g_sCmdTable[]は CmdLineProcess 関数から直接参照していますので配列名を

変更してはいけません。

177 行目から 226 行目は main 関数です。<中略>の部分にはクロックや周辺機能の設

定及び割込み許可のコードが入るでしょう。最後の while 文のなかでターミナルか

らのコマンド読み込みと CmdLineProcess 関数の実行を行っています。

Page 14: Stellaris 1day Workshop - Texas Instrumentsprocessors.wiki.ti.com/images/7/70/4stellaris_ws_jp...Stellaris 1day Workshop – For Application Development 4 - 3 USB インターフェイス準拠

Stellaris 1day Workshop – For Application Development 4 - 12

#include <stdlib.h> 1 #include <string.h> 2 3 #include "driverlib/uart.h" 4 5 #include "utils/cmdline.h" 6 7 #define CMD_BUF_SIZE 64 8 9 10 static char g_cCmdBuf[CMD_BUF_SIZE]; 11 12 void ReadLine(void) 13 { 14 unsigned long ulIdx, ulPrompt; 15 unsigned char ucChar; 16 17 g_cCmdBuf[0] = '\0'; 18 ulIdx = 0; 19 ulPrompt = 1; 20 21 while(1){ 22 if(ulPrompt){ 23 UARTprintf("> %s", g_cCmdBuf); 24 ulPrompt = 0; 25 } 26 27 // Loop while there are characters that have been received from 28 the 29 // UART. 30 // 31 while(UARTCharsAvail(UART0_BASE)) 32 { 33 // 34 // Read the next character from the UART. 35 // 36 ucChar = UARTgetc(); 37 38 // 39 // See if this character is a backspace and there is at 40 least one 41 // character in the input line. 42 // 43 if((ucChar == '\b') && (ulIdx != 0)) 44 { 45 // 46 // Erase the lsat character from the input line. 47 // 48 UARTprintf("\b \b"); 49 ulIdx--; 50 g_cCmdBuf[ulIdx] = '\0'; 51 } 52 53 // 54 // See if this character is a newline. 55 // 56 else if((ucChar == '\r') || (ucChar == '\n')) 57

Page 15: Stellaris 1day Workshop - Texas Instrumentsprocessors.wiki.ti.com/images/7/70/4stellaris_ws_jp...Stellaris 1day Workshop – For Application Development 4 - 3 USB インターフェイス準拠

Stellaris 1day Workshop – For Application Development 4 - 13

{ 58 // 59 // Return to the caller. 60 // 61 UARTprintf("\n"); 62 return; 63 } 64 65 // 66 // See if this character is an escape or Ctrl-U. 67 // 68 else if((ucChar == 0x1b) || (ucChar == 0x15)) 69 { 70 // 71 // Erase all characters in the input buffer. 72 // 73 while(ulIdx) 74 { 75 UARTprintf("\b \b"); 76 ulIdx--; 77 } 78 g_cCmdBuf[0] = '\0'; 79 } 80 81 // 82 // See if this is a printable ASCII character. 83 // 84 else if((ucChar >= ' ') && (ucChar <= '~') && 85 (ulIdx < (sizeof(g_cCmdBuf) - 1))) 86 { 87 // 88 // Add this character to the input buffer. 89 // 90 g_cCmdBuf[ulIdx++] = ucChar; 91 g_cCmdBuf[ulIdx] = '\0'; 92 UARTprintf("%c", ucChar); 93 } 94 } 95 } 96 } 97 98 int Cmd_help(int argc, char *argv[]) 99 { 100 tCmdLineEntry *pEntry; 101 102 // 103 // Print some header text. 104 // 105 UARTprintf("\nAvailable commands\n"); 106 UARTprintf("------------------\n"); 107 108 // 109 // Point at the beginning of the command table. 110 // 111 pEntry = &g_sCmdTable[0]; 112 113 // 114

Page 16: Stellaris 1day Workshop - Texas Instrumentsprocessors.wiki.ti.com/images/7/70/4stellaris_ws_jp...Stellaris 1day Workshop – For Application Development 4 - 3 USB インターフェイス準拠

Stellaris 1day Workshop – For Application Development 4 - 14

// Enter a loop to read each entry from the command table. The end 115 of the 116 // table has been reached when the command name is NULL. 117 // 118 while(pEntry->pcCmd) 119 { 120 // 121 // Print the command name and the brief description. 122 // 123 UARTprintf("%s%s\n", pEntry->pcCmd, pEntry->pcHelp); 124 125 // 126 // Advance to the next entry in the table. 127 // 128 pEntry++; 129 } 130 131 // 132 // Return success. 133 // 134 return(0); 135 } 136 137 int Cmd_systickPeriodSet(int argc, char *argv[]) 138 { 139 int period; 140 141 if(argc != 2) 142 { 143 UARTprintf("need argument ex) set 0xFFFFFF\n"); 144 return(CMDLINE_BAD_CMD); 145 } 146 else 147 { 148 period = strtol(argv[1], NULL, 0); 149 150 if(period < 0xfff){ 151 UARTprintf("the period looks too short\n"); 152 return(CMDLINE_BAD_CMD); 153 } 154 else if(period > 0xffffff){ 155 UARTprintf("the period is too long\n"); 156 return(CMDLINE_BAD_CMD); 157 } 158 159 SysTickPeriodSet((unsigned long)period); 160 UARTprintf("set successfully!\n"); 161 162 return(0); 163 } 164 } 165 166 tCmdLineEntry g_sCmdTable[] = 167 { 168 { "help", Cmd_help, " : Display list of commands" }, 169 { "h", Cmd_help, " : alias for help" }, 170 { "?", Cmd_help, " : alias for help" }, 171

Page 17: Stellaris 1day Workshop - Texas Instrumentsprocessors.wiki.ti.com/images/7/70/4stellaris_ws_jp...Stellaris 1day Workshop – For Application Development 4 - 3 USB インターフェイス準拠

Stellaris 1day Workshop – For Application Development 4 - 15

{ "set", Cmd_systickPeriodSet, " : Set SysTick Period" }, 172 {0,0,0} 173 }; 174 175 176 void main(void) 177 { 178 int iStatus; 179 180 181 <中略> 182 183 184 while(1){ 185 // 186 // Get a line of text from the user. 187 // 188 ReadLine(); 189 if(g_cCmdBuf[0] == '\0') 190 { 191 continue; 192 } 193 194 // 195 // Pass the line from the user to the command processor. 196 // It will be parsed and valid commands executed. 197 // 198 iStatus = CmdLineProcess(g_cCmdBuf); 199 200 // 201 // Handle the case of bad command. 202 // 203 if(iStatus == CMDLINE_BAD_CMD) 204 { 205 UARTprintf("Bad command!\n"); 206 } 207 208 // 209 // Handle the case of too many arguments. 210 // 211 else if(iStatus == CMDLINE_TOO_MANY_ARGS) 212 { 213 UARTprintf("Too many arguments for command processor!\n"); 214 } 215 216 // 217 // Otherwise the command was executed. Print the error 218 // code if one was returned. 219 // 220 else if(iStatus != 0) 221 { 222 UARTprintf("Command returned error code %d\n", iStatus); 223 } 224 } 225 } 226

Page 18: Stellaris 1day Workshop - Texas Instrumentsprocessors.wiki.ti.com/images/7/70/4stellaris_ws_jp...Stellaris 1day Workshop – For Application Development 4 - 3 USB インターフェイス準拠

Stellaris 1day Workshop – For Application Development 4 - 16

7. ターゲット・コンフィグレーションを作成します。

Lab3 同様、既存の TargetConfiguration.ccxml をプロジェクトに追加してください。

8. ビルド、ロード、実行し動作確認します。

それでは実行してみましょう。実行後ターミナルビューからコマンドを入力し、

LED の点滅周期が変化すれば成功です!

Part2. StellarisWare のサンプルプロジェクトをビルド、デ

バッグ

9. ワークスペースへ StellarisWare のサンプルプロジェクトをインポートします。

既存の CCS プロジェクトを使用するにはワークスペースへのインポートを行います。

StellarisWare の各サンプルは CCS プロジェクトが用意されています。例として

usb_host_msc のプロジェクトをインポートしてみます。

Page 19: Stellaris 1day Workshop - Texas Instrumentsprocessors.wiki.ti.com/images/7/70/4stellaris_ws_jp...Stellaris 1day Workshop – For Application Development 4 - 3 USB インターフェイス準拠

Stellaris 1day Workshop – For Application Development 4 - 17

CCS のメインメニュー、Project→Impoert Existing CCS/CCE Eclipse Project をクリ

ックしてください。すると下図のようなダイアログが現れますので、Select root directry フィールドに Browse…ボタンを使って C:\StellarisWare\boards\ek-lm3s9b92\usb_host_msc\ccs 評価キット名 を入力し、Finish をクリックしてください。

10. プロジェクトのソースコードなどを確認します。

プロジェクトビューより usb_host_msc.c をダブルクリックするとソースコードが確

認できます。アウトラインビューを使うと関数や変数の参照がしやすいと思います。

11. ビルド、ロード、実行し動作確認します。

プロジェクトをインポートし、実際に動作させながらコードを参照すると確認もし

やすいと思いますのでご活用下さい。

以上で lab4 は終了です。お疲れ様でした。時間に余裕のある方はオプション演習をご覧下さい。

Page 20: Stellaris 1day Workshop - Texas Instrumentsprocessors.wiki.ti.com/images/7/70/4stellaris_ws_jp...Stellaris 1day Workshop – For Application Development 4 - 3 USB インターフェイス準拠

Stellaris 1day Workshop – For Application Development 4 - 18

オプション演習

tiobj2bin ユーティリティを使い.bin ファイルを作成 12. lab4 のビルドオプションに tiobj2bin を実行する設定を追加します。

ビルドオプションの Build Steps タブを前に出し、Post-build step:内の Command フィ

ールドに以下のコマンドラインを入力してください。少し長いのでインポートした

usb_host_msc プロジェクトのビルドオプションからコピー&ペーストすると入力の

間違いがなくよいでしょう。

"${CCE_INSTALL_ROOT}/utils/tiobj2bin/tiobj2bin.bat" "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" "${CG_TOOL_ROOT}/bin/ofd470.exe" "${CG_TOOL_ROOT}/bin/hex470.exe" "${CCE_INSTALL_ROOT}/utils/tiobj2bin/mkhex4bin.exe" ※上記コマンドラインは 1 行です(改行なし)。

13. ビルドし.bin ファイルができていることを確認します。

.bin ファイルは C:\stellaris_1day\lab4\Debug フォルダに出来ていると思います。確認

してください。

14. CCS を終了し、LM Flash Programmer にて作成した.bin ファイルを書き込みます。

いくつか.bin ファイルを書込み、動作確認して、lab4 の.bin ファイルが問題ないこと

を確認してください。

オプション演習は以上です。お疲れ様でした。