Hauptinhalt

Konfigurieren der Codegenerierung

Konfigurieren der Einstellungen für die Codegenerierung, z. B. Name, Speicherort, Typ und Sprache der Ausgabedatei

Zum Steuern und Konfigurieren des Codegenerierungsprozesses stehen zahlreiche Parameter und Einstellungen zur Verfügung. Diese Einstellungen steuern Attribute wie den Ausgabe-Build-Typ (MEX, lib, dll oder exe) und Verwendung der Sprache C oder C++. Mit anderen Konfigurationseinstellungen können Sie den generierten Code an bestimmte Anforderungen wie Lesbarkeit, Leistung und Integration von externem Code anpassen. Sie können die Konfigurationseinstellungen im Konfigurationsobjekt für die Codegenerierung über die App oder über die Befehlszeile ändern. Das Konfigurationsobjekt erstellen Sie mithilfe von coder.config. Öffnen Sie das Objekt in der Bearbeitungs-App mit open.

Funktionen

coder.configCreate code generation configuration objects

Einstellungen für die Code-Konfiguration

alle erweitern

BuildtypeOutput to build from generated C/C++ code
LanguageLanguage to use in generated code
LanguagestandardLanguage standard to use for the generated code
Custom outputfileName of code generation output file
Generate codeonlyGeneration of only source code
VerificationmodeCode verification mode
BuildfolderFolder type for files generated during build process
Build folderpathFolder path for files generated during build process
WorkingfolderCurrent working folder type for build process
Working folderpathCurrent working folder path for build process
Enable responsivenessto CTRL+C and graphics refreshingResponsiveness checks
Keep extrinsiccallsExtrinsic function call support
Check memoryintegrityMemory integrity checking
Saturate on integeroverflowInteger overflow support
Support onlypurely-integer numbersDetection of floating-point code
Support nonfinitenumbersSupport for nonfinite values
Loop unrollingthresholdThreshold on the number of iterations that determines whether to automatically unroll a for-loop and a parfor-loop
Preserve input datafor entry-point functionsWhether to protect entry-point input data from modification
Qualify C restrictfunction argumentsAnnotate function declarations with the restrict keyword
Enable OpenMP libraryif possibleParallelization of parfor-loops
Enable automaticparallelizationAutomatic parallelization of for loops
Maximum number of CPUthreadsMaximale Anzahl von CPU-Threads zur Ausführung paralleler For-Schleifen
Leverage targethardware instruction set extensionsSIMD instruction set for target hardware
FMAWhether to use SIMD instructions for fused multiply add operations
Inline strategy foruser written MATLAB functionsControl inlining between user-written functions
Inline strategy forMathWorks written MATLAB functionsControl inlining between MathWorks functions
Inline strategy forcalls between MathWorks functions and user functionsControl inlining between user-written functions and MathWorks functions
OptimizereductionsGenerate SIMD code for reduction operations | Parallelize for-loops performing reduction operations
Hardware SIMDaccelerationLevel of SIMD intrinsics
Global datasynchronization modeGlobal data synchronization mode
Enablevariable-sizingVariable-size array support
Enable dynamic memoryallocationEnable dynamic memory allocation for fixed- and variable-size arrays
Dynamic memoryallocation thresholdSize threshold for dynamic memory allocation of variable-size arrays
Enable dynamic memoryallocation for fixed-sized arraysDynamic memory allocation for fixed-size arrays
Dynamic memoryallocation interfaceDynamically allocated array at generated function interface
ArraylayoutRow-major array layout
Preserve arraydimensionsN-dimensional indexing
Stack usagemaxMaximum stack usage per application
Generate re-entrantcodeMulti-instance, reentrant code
Preserve unusedfields and propertiesPreserve unused class properties or structure fields in the generated C/C++ code
Generated filepartitioning methodFile partitioning mode
Large constantgenerationWhether to write large deep learning constants to binary data files
Large constantthresholdThreshold above which the code generator writes DNN constants to binary data files
IncludecommentsComments in generated code
CommentstyleComment style in the generated code
MATLAB source code ascommentsInclusion of MATLAB source code as comments in generated code
MATLAB source codecomment line numbersInclude line numbers of MATLAB source code as comments in the generated code
MATLAB function helptext MATLAB function help text in function banner
Requirement summariesas commentsInclude requirements links as comments
Convertif-elseif-else patterns to switch-case statementsConversion of if-elseif-else patterns to switch-case statements
Preserve externkeyword in function declarationsPreservation of the extern keyword in function declarations
Use signed shift leftfor fixed-point operations and multiplication by powers of 2Replacement of multiplications by powers of two with signed left bitwise shifts
Allow right shifts onsigned integersSigned right bitwise shifts in generated code
ParenthesesParenthesization level in the generated code
Maximum identifierlengthMaximum number of characters in generated identifiers
Header guardstyleStyle of preprocessor directive in generated code
IndentstyleStyle for placement of braces in the generated code
IndentsizeNumber of characters per indentation level
ColumnlimitMaximum number of columns before a line break in the generated code
Data typereplacementData type replacement in generated code
Enable custom datatype replacementCustom names for data types in generated code
Import custom typesfrom external header filesWhether to import type definition from external header files
HeaderfilesExternal header files that contain custom type definitions
GlobalvariablesCustom identifier format for global variable identifiers
GlobaltypesCustom identifier format for global type identifiers
Field name of globaltypesCustom identifier format for field names in global type identifiers
LocalfunctionsCustom identifier format for local function identifiers
Local temporaryvariablesCustom identifier format for local temporary variable identifiers
ConstantmacrosCustom identifier format for constant macro identifiers
EMX arraytypesCustom identifier format for EMX array types
EMX array utilityfunctionsCustom identifier format for EMX array utility functions
Generated source andheader file name formatFile name customization macro
Code generationtemplate fileCode generation template for file and function banners
Select code formattool to useFormatting tool for generated code
Control use of clangformat configurationControl generation of clang-format file
Enable C/C++ compilerdebug modeDebugging-Modus des C Compilers
Generate run-timeerror checksRun-time error detection and reporting in generated code
Show verbose compileroutputAnzeige des Fortschritts bei der Codegenerierung
Always create areportCode generation report
Report differencesfrom MATLABPotential differences reporting
Highlight potentialdata type issuesHighlighting of potential data type issues in the code generation report
Highlight potentialrow-major issuesPotential row-major layout issues
Highlight potentialissues resulting from implicit expansionHighlight potential implicit expansion issues
Highlight potentialissues in use of coder.loop functionsHighlight potential loop control issues
Generate static codemetrics reportStatic code metrics report
Generate codereplacements reportCode replacement report
Automatically launcha report if one is generatedAutomatic open of code generation report
Export reportinformation to variableName of variable containing code generation report information
Enable source-leveldebugging for SIL or PILDebugging of generated code during a SIL or PIL execution
Check constantinputsConstant input checking mode for a SIL or PIL execution
Synchronize globaldataGlobal data synchronization mode for a SIL or PIL execution
Enable entry pointexecution profilingExecution time profiling during a SIL or PIL execution
Enable functionexecution profilingExecution time profiling of functions called within entry-point functions during a SIL or PIL execution
Specify profilingsave optionsCollection and storage of execution-time measurements
Enable entry pointstack profilingStack usage profiling during a SIL or PIL execution
Enable C/C++ codecoverageAnalysis of C/C++ code coverage
Enable executionprofilingInstrumentation for profiling
Code replacementlibraryCode replacement library for generated code
Use built-in FFTWlibraryGenerate code that uses the FFTW library shipped with MATLAB
Custom FFT librarycallbackCallback class for FFTW library calls
Custom BLAS librarycallbackBLAS callback class
Custom LAPACK librarycallbackLAPACK callback class
Use precompiledlibrariesWhether to use precompiled libraries in generated code
SourcefileCode to appear near the top of generated .c or .cpp files
HeaderfileCustom code that appears at top of generated C/C++ header files
InitializefunctionCustom code to include in the generated initialize function
TerminatefunctionCode that appears in the generated terminate function
Additional includedirectoriesInclude folders to add to include path for compiling generated code
Additional sourcefilesSource files to compile and link with the generated code
AdditionallibrariesStatic library files to link with the generated code
Post-code-generationcommandBefehl zur Anpassung der Build-Verarbeitung
ReservednamesNames that code generator must not use for functions or variables
HardwareboardName of hardware board
Production DeviceDetails: Device vendorManufacturer of production hardware
Production DeviceDetails: Device typeType of production hardware
Production DeviceDetails: charLength in bits of the C char data type
Production DeviceDetails: shortLength in bits of the C short data type
Production DeviceDetails: intLength in bits of the C int data type
Production DeviceDetails: longLength in bits of the C long data type
Production DeviceDetails: long longLength in bits of the C long long data type
Production DeviceDetails: floatLength in bits of the C floating-point data type
Production DeviceDetails: doubleLength in bits of the C double data type
Production DeviceDetails: machine wordMicroprocessor native word size
Production DeviceDetails: pointerLength in bits of pointer data
Production DeviceDetails: size_tLength in bits of size_t data
Production DeviceDetails: ptrdiff_tLength in bits of ptrdiff_t data
Production DeviceDetails: Byte orderingSignificance of the first byte of a data word
Production DeviceDetails: Shift right on a signed integer as an arithmetic shiftImplementation of signed integer right shift as arithmetic right shift
Production DeviceDetails: Enable long longLong long data type support
Production DeviceDetails: Largest atomic integer sizeLargest atomic integer size for production hardware
Production DeviceDetails: Largest atomic floating-point sizeLargest atomic floating-point size for production hardware
Production DeviceDetails: Signed integer division rounds toRounding for division of two signed integers
Target DeviceDetails: Device vendorManufacturer of test hardware
Target DeviceDetails: Device typeType of test hardware
Test Device Details:charLength in bits of the C char data type
Test Device Details:shortLength in bits of the C short data type
Test Device Details:intLength in bits of the C int data type
Test Device Details:longLength in bits of the C long data type
Test Device Details:long longLength in bits of the C long long data type
Test Device Details:floatLength in bits of the C floating-point data type
Test Device Details:doubleLength in bits of the C double data type
Test Device Details:machine wordMicroprocessor native word size
Test Device Details:pointerLength in bits of pointer data
Test Device Details:size_tLength in bits of size_t data
Test Device Details:ptrdiff_tLength in bits of ptrdiff_t data
Test Device Details:Byte orderingSignificance of the first byte of a data word
Test Device Details:Shift right on a signed integer as an arithmetic shiftImplementierung der Rechtsverschiebung vorzeichenbehafteter Ganzzahlen als arithmetische Rechtsverschiebung
Test Device Details:Enable long longLong long data type support
Test Device Details:Largest atomic integer sizeLargest atomic integer size for test hardware
Test Device Details:Largest atomic floating-point sizeLargest atomic floating-point size for test hardware
Test Device Details:Signed integer division rounds toRounding for division of two signed integers
ToolchainToolchain to use for building a C/C++ library or executable program
Custom ToolchainOptionsCustom settings for tools in selected toolchain
Buildconfiguration Compiler optimization or debug settings for toolchain
Test Hardware is thesame as production hardwareEquivalence of production and target hardware characteristics
C++namespaceNamespace name for generated C++ code
InterfacestyleInterface style for generated C++ code
C++ interface classnameInterface class name for generated C++ code
Generate C++namespaces from MATLAB namespacesGenerate C++ namespaces for MATLAB namespaces
Namespace forMathWorks codePlace C++ code generated for MathWorks code in a separate namespace
Generate C++ classesfrom MATLAB classesGenerate C++ classes for MATLAB classes
Generate C++ enumclass from MATLAB enumerationWhether to generate C++ enumeration classes for MATLAB enumerations
CastingmodeData type casting level
Constant foldingtimeoutMaximum number of instructions to be executed by the constant folder
Compile-timerecursion limitMaximum number of function specializations for compile-time recursion
Automatically run theinitialize functionAutomatically run the initialize function
Initialize functionrequiredInitialize function generation
Terminate functionrequiredTerminate function generation
Generatejustification comments for known MISRA violationsAdd annotations to suppress known MISRA/AUTOSAR violations
Generate examplemainExample C/C++ main file generation
Preserve variablenamesVariable names to preserve in the generated code
Echo expressionswithout terminating semicolonsExpression echoing
GeneratemakefileMakefile generation
Automaticallyintroduce extrinsic callsAutomatic extrinsic function calls
Simplify arrayindexingStrength reduction optimization
Use memcpy for vectorassignment Whether to enable memcpy optimization
Memcpy threshold(bytes)Minimum size for memcpy or memset optimization
Use memset toinitialize floats and doubles to 0.0Assignment of float and double zero with memset
ConstantinputsConstant input checking mode
Use JIT compilationfor build type of MEXJust-in-time (JIT) compilation mode
Generate nonfinitesupport files if usedGenerate support files for nonfinite data only if nonfinite data is used
Pass structures byreference to entry-point functionsPass structures by reference
Always generate adefault case for switchDefault case for all switch statements
Enable codetraceabilityTraceability in code generation report
Use Embedded CoderfeaturesWhether to use Embedded Coder features
Enable implicitexpansionImplicit expansion capabilities in generated code
Enable automaticparallelization reportingReporting for automatic parallelization of for loops
Enable run-timerecursionRun-time recursion support
Cache dynamic arraydataDynamic array optimization
SIL/PILVerbosityDisplay communication I/O information during SIL or PIL execution
SIL/PIL profilingmetricsPMU metric

Objekte

coder.MexCodeConfigConfiguration parameters for MEX function generation from MATLAB code
coder.CodeConfigConfiguration parameters for C/C++ code generation from MATLAB code
coder.EmbeddedCodeConfigConfiguration parameters for C/C++ code generation from MATLAB code with Embedded Coder
coder.HardwareImplementationHardware-specific configuration parameters for C/C++ code generation from MATLAB code
coder.hardwareCreate hardware board configuration object for C/C++ code generation from MATLAB code
coder.ReplacementTypesConfiguration parameter to specify custom names for MATLAB built-in data types in C/C++ code generation

Themen

Grundlagen der Build-Konfiguration

Spezifische Build-Optionen