このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。
target.MainFunction クラス
名前空間: target
ターゲット ハードウェア アプリケーションの main
関数の C および C++ 依存関係を提供
説明
target.MainFunction
クラスを使用して、ターゲット ハードウェア上で実行されるアプリケーションの main
関数について、main
関数の依存関係を提供します。たとえば、アプリケーションの C および C++ 初期化および終了コード、include
プリプロセッサ命令、main
関数の引数の指定などです。
target.MainFunction
オブジェクトの作成には関数 target.create
を使用します。
プロパティ
main
依存関係のコレクションの名前。
属性:
GetAccess | public |
SetAccess | public |
main
関数のコンパイラ ビルド ツールの依存関係。これには、ヘッダー ファイル、ソース ファイル、およびライブラリが含まれます。
属性:
GetAccess | public |
SetAccess | public |
実行時のコマンド ライン引数の依存関係を取得します。
属性:
GetAccess | public |
SetAccess | public |
プリプロセッサ命令 #include "path-spec"
を使用してターゲットの main
関数に含めなければならないヘッダー ファイルの配列。
属性:
GetAccess | public |
SetAccess | public |
プリプロセッサ命令 #include
を使用してターゲットの <path-spec>
main
関数に含めなければならないヘッダー ファイルの配列。
属性:
GetAccess | public |
SetAccess | 保護 |
main
関数がターゲット リソースの初期化に使用する、C または C++ コードの書式設定済み string。
属性:
GetAccess | public |
SetAccess | public |
main
関数がターゲット リソースの終了に使用する、C または C++ コードの書式設定済み string。
属性:
GetAccess | public |
SetAccess | public |
例
target.MainFunction
オブジェクトを作成し、target.Board object
と関連付けます。これにより、Arduino® ボードの main
関数の依存関係が取得されます。ターゲット ハードウェア上で実行されるアプリケーションの main
関数を生成するときに、プロセッサインザループ (PIL) などのワークフローでこの情報を使用できます。
board = target.create('Board', 'Name', 'Arduino Board') mainFunction = target.create('MainFunction'); mainFunction.Name = 'Arduino Main Dependencies'; mainFunction.IncludeFiles = { 'Arduino.h' }; mainFunction.InitializationCode = fileread('arduino_main_initialization.c'); board.MainFunctions = mainFunction;
このコードの抜粋では、arduino_main_initialization.c
に C コードが含まれます。以下に例を示します。
/* Initialize system */
init();
Set Up PIL Connectivity by Using Target Framework から抜粋した以下のコードは、target.MainFunction
オブジェクトを作成および使用して、API 実装に必要な main
関数の引数を指定する方法を示しています。
comms = target.create('CommunicationInterface'); comms.Name = 'Linux TCP Interface'; comms.Channel = 'TCPChannel'; comms.APIImplementations = target.create('APIImplementation', ... 'Name', 'x86 rtiostream Implementation'); comms.APIImplementations.API = target.create('API', 'Name', 'rtiostream'); comms.APIImplementations.BuildDependencies = target.create('BuildDependencies'); comms.APIImplementations.BuildDependencies.SourceFiles = ... {fullfile('$(MATLABROOT)', ... 'toolbox', ... 'coder', ... 'rtiostream', ... 'src', ... 'rtiostreamtcpip', ... 'rtiostream_tcpip.c')}; comms.APIImplementations.MainFunction = target.create('MainFunction', ... 'Name', 'TCP RtIOStream Main'); comms.APIImplementations.MainFunction.Arguments = {'-blocking', '1', '-port', '0'}; hostTarget.CommunicationInterfaces = comms;
バージョン履歴
R2020b で導入
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)