Main Content

Model Configuration

Configure models for simulation and code generation

The model configuration parameters for code generation define how the code generator produces code and builds an executable from your model. The Model Advisor checks that your model meets standards and guidelines and is ready to generate code. The Code Generation Advisor reviews your model based on objectives that you specify.

Model Settings

expand all

Target selection

System target fileFile that controls code generation stage of build process
LanguageProgramming language of generated code
Language standardLanguage standard supported by compiler

Build process

Generate code onlyGenerate code versus an executable program
Package code and artifactsPackage generated code and artifacts in ZIP file
Compiler optimization levelControl application of compiler optimizations
Custom compiler optimization flagsCompiler optimization flags
ToolchainToolchain to use when building executable program or library
Build configurationBuild configuration defined by toolchain
Toolchain detailsBaseline toolchain settings
Generate makefileEnable generation of makefile to use for compiling generated code
Make commandMake command and options for initiating build process
Template makefileTemplate makefile to use to generate makefile for specified system target file

Code generation objectives

Select objectiveCode generation objective
Check model before generating codeChoose whether to run Code Generation Advisor checks

Advanced parameters

Custom FFT library callbackCallback for custom FFT library usage
Custom BLAS library callbackCallback for custom BLAS library usage
Custom LAPACK library callbackCallback for custom LAPACK library usage
Verbose buildEnable display of build process stages and compiler output
Retain .rtw file in current build folderRetain generated model.rtw file
Profile TLCProfile execution of TLC files used to generate code for model
Enable TLC assertionProduce TLC stack trace
Start TLC coverage when generating codeLog coverage of TLC code during code generation
Start TLC debugger when generating codeDuring code generation, start TLC debugger
Zip file nameName of ZIP file
Show Custom Hardware App in Simulink ToolstripShow Custom Hardware App in Simulink Toolstrip
Show Embedded Hardware App in Simulink ToolstripShow Embedded Hardware App in Simulink Toolstrip
Default parameter behaviorRepresent numeric block parameters in generated code
Leverage target hardware instruction set extensionsInstruction sets to generate single instruction, multiple data (SIMD) code
Optimize reductionsSingle instruction, multiple data (SIMD) code for reduction operation loops
Use memcpy for vector assignmentOptimize code generated for vector assignments
Memcpy threshold (bytes)Specify minimum array size for which memcpy and memset function calls replace for loops for vector assignments
Enable local block outputsDeclare block signals locally or globally
Reuse local block outputsReuse local output variables
Eliminate superfluous local variables (Expression folding)Specify to fold expressions into single expression
Use bitsets for storing state configurationBitsets for storing state configuration variables
Use bitsets for storing Boolean dataBitsets to store Boolean data
Maximum stack size (bytes)Specify maximum stack size for model
Loop unrolling threshold Specify minimum array size width for generating for loops
Inline invariant signalsTransform symbolic names of Invariant signals in generated code
Remove code from floating-point to integer conversions with saturation that maps NaN to zeroControl generation of protective code that handles floating-point to integer conversion for NaN values
Use memset to initialize floats and doubles to 0.0Control generation of code that explicitly initializes floating-point data to 0.0
Remove code from floating-point to integer conversions that wraps out-of-range valuesControl generation of wrapping code that handles out-of-range floating-point to integer conversion values
Buffer for reusable subsystemsBuffers to enhance reuse of subsystems
Base storage type for automatically created enumerationsSpecify storage type and size of enumerations for state outputs
Signal storage reuseReuse signal memory
Create code generation reportDocument generated code in an HTML report
Open report automaticallyDisplay code generation reports automatically
Include commentsInclude comments in generated code
Simulink block commentsInclude Simulink block comments
Stateflow object commentsInclude Stateflow object comments
MATLAB source code as commentsInclude MATLAB source code as comments
Show eliminated blocksInclude eliminated blocks' comments
Verbose comments for Simulink Global storage classReduce code size or improve code traceability
Maximum identifier lengthSpecify maximum number of characters in identifiers
Use the same reserved names as Simulation TargetSpecify whether to use reserved names from the Simulation Target pane
Reserved namesAvoid name conflicts with custom code
Duplicate enumeration member namesSpecify the action to take if the code generator detects two enumeration types with same member names
Use the same custom code settings as Simulation TargetUse custom code settings from the Simulation Target > Custom Code pane
Source fileInclude custom code in the generated model source file
Header fileInclude custom code in the generated model header file
Initialize functionInclude custom code in the generated model initialize function
Terminate functionInclude custom code in the generated model terminate function
Include directoriesAdd folders to the include path
Source filesCompile and link additional source files with the generated code
LibrariesLink additional libraries with the generated code
DefinesAdd preprocessor macro definitions to the compiler command line

Topics

Getting Started

  • Code Generation Configuration
    Modify the model configuration parameters specific to code generation from the Configuration Parameters Dialog box.

Code Generation Configuration

Model Advisor

Code Generation Advisor

Model Configuration Parameters