C-SPYをバッチモードで使用
コマンドラインユーティリティの cspybat を使用すると、C-SPY をバッチモードで実行できます。このユーティリティは、common\bin ディレクトリにインストールされています。
cspybat の起動
Using a JSON launch file
The most convenient way to start cspybat is to generate and use a launch.json file. This file can also be used with Visual Studio Code.
The command syntax is:
iarbuild
project.ewp -launch_json [buildconfig]For example, this command:
iarbuild project.ewp -launch_json Debug
adds the Debug configuration to the file
launch.json.You can also create this file in the IDE by choosing Debug>Launch Configuration>Export as JSON.
Use this file by specifying
--launch_file launch.jsonas options to the cspybat command on the command line. If you have more than one build configuration, use--launch_configto specify which one, for example:cspybat --launch_file launch.json --launch_config Debug
For more information, see Saving and loading debugger launch settings.
Using an auto-generated batch file
You can also start cspybat using a batch file.

cspybatを起動するには、まずバッチファイルを作成する必要があります。その簡単な方法は、IDEでC-SPYを起動する際にC-SPYが自動的に生成するバッチファイルのいずれかを使用することです。C-SPY が初期化されるたびに、
projectname.buildconfiguration.cspy.batというバッチファイルが生成されます。また、あと 2 つのファイルが生成されます。project.buildconfiguration.general.xclには、cspybatに固有のオプションが含まれます。
このファイルは、
$PROJ_DIR$\settingsディレクトリに保存されています。これらのファイルには IDE と同じ設定が含まれており、使用可能なオプションについてのヒントになります。cspybatを起動するには、次のコマンドラインを使用できます。

On the command line, you can create a batch file using
iarbuild:iarbuild
project.ewp -cspybat_cmds [buildconfig] -output_typefiletypeFor example, this command:
iarbuild project.ewp -cspybat_cmds Debug -output_type bat
will create the batch file
project.Debug.cspy.bat.Invoke the
project.Debug.cspy.batfile on the command line to startcspybat.The file type can be another shell or batch type, for example
shif you work in a Linux environment.
注記
It is also possible to start an interactive debug session in the Embedded Workbench GUI. For more information, see Starting a debug session from the command line.
出力
cspybatの実行時、以下のタイプの出力を生成できます。
cspybatからのターミナル出力
このターミナル出力はすべて
stderrに転送されます。コマンドラインから引数なしでcspybatを実行する場合、cspybatのバージョン番号と利用可能なすべてのオプション(簡単な説明を含む)がstdoutに転送され、画面に表示されます。デバッグ対象アプリケーションからのターミナル出力
こうしたすべてのターミナル出力先は、
stdoutになります。ただし、‑‑pluginオプションを使用していることが条件です。‑‑pluginを参照してください。エラーリターンコード
cspybatは、バッチファイル内で評価可能なステータス情報をホストオペレーティングシステムに返します。成功の場合は値int0が、失敗の場合は値int1がそれぞれ返されます。
呼び出し構文
cspybat の呼び出し構文は以下のとおりです。
cspybatprocessor_DLLdriver_DLLdebug_file[cspybat_options]‑‑backenddriver_options
注記
ファイル名が要求される場合には、ファイル名のフルパスを指定することが推奨されます。DLL ファイルの場合、必須です。
パラメータ
パラメータを以下に示します。
パラメータ | 説明 |
|---|---|
| プロセッサ固有DLLファイルへのパスは、 |
| C-SPYドライバDLLファイルへのパスは、 |
| デバッグ対象のオブジェクトファイルです(ファイル名拡張子 |
|
|
| C-SPY ドライバに送信するパラメータの開始を示します。後に続くすべてのオプションがドライバに渡されます。このオプションは必須です。 |
| C-SPY ドライバに渡すコマンドラインオプションです。これらのオプションには、必須のものと省略可能なものがあります。それぞれのオプションについては、C-SPYコマンドラインオプションについてのリファレンス情報を参照してください。 |