| Real-Time Workshop® | ![]() |
Add compiler options to model's build information
addCompileFlags(buildinfo, options, groups)
groups is optional.
Build information returned by RTW.BuildInfo.
A character array or cell array of character arrays that specifies the compiler options to be added to the build information. The function adds each option to the end of a compiler option vector. If you specify multiple options within a single character array, for example '-Zi -Wall', the function adds the string to the vector as a single element. For example, if you add '-Zi -Wall' and then '-O3', the vector consists of two elements, as shown below.
'-Zi -Wall' '-O3'
A character array or cell array of character arrays that groups specified compiler options. You can use groups to
Document the use of specific compiler options
Retrieve or apply collections of compiler options
You can apply
A single group name to a compiler option
A single group name to multiple compiler options
Multiple group names to collections of compiler options
| To... | Specify groups as a... |
|---|---|
| Apply one group name to all compiler options | Character array. To specify compiler options to be used in the standard Real-Time Workshop® makefile build process, specify the character array 'OPTS' or 'OPT_OPTS'. |
| Apply different group names to compiler options | Cell array of character arrays such that the number of group names matches the number of elements you specify for options. Available for nonmakefile build environments only. |
Note To control compiler optimizations for your Real-Time Workshop makefile build at Simulink® GUI level, use the Compiler optimization level option on the Real-Time Workshop pane of the Simulink Configuration Parameters dialog box. The Compiler optimization level option provides
If you specify compiler options for your Real-Time Workshop makefile build using OPT_OPTS, MEX_OPTS (except MEX_OPTS="-v"), or MEX_OPT_FILE, the value of Compiler optimization level is ignored and a warning is issued about the ignored parameter. |
The addCompileFlags function adds specified compiler options to the model's build information. Real-Time Workshop stores the compiler options in a vector. The function adds options to the end of the vector based on the order in which you specify them.
In addition to the required buildinfo and options arguments, you can use an optional groups argument to group your options.
Add the compiler option -O3 to build information myModelBuildInfo and place the option in the group MemOpt.
myModelBuildInfo = RTW.BuildInfo; addCompileFlags(myModelBuildInfo, '-O3','MemOpt');
Add the compiler options -Zi and -Wall to build information myModelBuildInfo and place the options in the group Debug.
myModelBuildInfo = RTW.BuildInfo; addCompileFlags(myModelBuildInfo, '-Zi -Wall','Debug');
Add the compiler options -Zi, -Wall, and -O3 to build information myModelBuildInfo. Place the options -Zi and -Wall in the group Debug and option -O3 in the group MemOpt.
myModelBuildInfo = RTW.BuildInfo;
addCompileFlags(myModelBuildInfo, {'-Zi -Wall' '-O3'},
{'Debug' 'MemOpt'});addDefines, addLinkFlags
Programming a Post Code Generation Command
![]() | Functions — Alphabetical List | addDefines | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |