Stateflow    

Specifying Custom Code Options

You must specify various configuration options (see Custom Code Options) to build custom code into a simulation target.

To specify the custom code options:

  1. Open the Target Builder dialog box for the target in which you want to include custom code.

    You can do this by selecting the appropriate open target item (e.g., Open Simulation Target) from the Stateflow editor's Tools menu or by clicking on the simulation target in the Stateflow Explorer.

    The Target Builder dialog box appears, for example,

  1. Select Target Options from the dialog.

    The Target Options dialog box appears

    .

    The dialog box contains a drop-down list listing various options for specifying what code to include in the target and where the code is located. The edit box below the list displays the setting for the current option.

  1. Select the options required to specify your code and enter the specifications in the edit box.

    See Custom Code Options for information on how to use these options to specify your custom code.

  1. Select Apply to apply the specification to the target or OK to apply the specifications and close the dialog.

Custom Code Options

The target options dialog provides the following options for specifying custom code to be built into a simulation target:

Custom code included at the top of generate code.   Custom C code to be included at the top of a generated header file that is included at the top of all generated source code files. In other words, all generated code sees code specified by this option. Use this option to include header files that declare custom functions and data used by generated code.

Custom include directory paths.   Space-separated list of paths of directories containing custom header files to be included either directly (see first option above) or indirectly in the compiled target.

Custom source files.   Space separated list of source files to be compiled and linked into the target.

Custom libraries.   Space-separated list of libraries containing custom object code to be linked into the target.

Custom make files.   Space-separated list of custom makefiles. The Stateflow code generator includes these makefiles at the head of the makefile it generates to build the simulation target. You can use this option to include makefiles for building custom code required by the target.

Build command.   The MATLAB command used to build the target.

Code command.   The MATLAB command used to invoke the code generator (sfc, by default). You can add command-line arguments for sfc options not reflected on the Coder Options dialog box for the target.

Custom initialization code.   Code statements that are executed once at the start of simulation. You can use this initialization code to invoke functions that allocate memory or perform other initializations of your custom code.

Custom termination code.   Code statements that are executed at the end of simulation. You can use this code to invoke functions that free memory allocated by custom code or perform other cleanup tasks.


 RTW Coder Options Dialog Box Parsing