Main Content

Data definition

Description

Specify where to place definitions of global variables.

Category: Code Generation > Code Placement

Settings

Default: Auto

Auto

Lets the code generator determine where the definitions should be located.

Data defined in source file

Places definitions in .c source files where functions are located. The code generator places the definitions in one or more function .c files, depending on the number of function source files and the file partitioning previously selected in the Simulink® model.

Data defined in a single separate source file

Places definitions in the source file specified in the Data definition filename field. The code generator organizes and formats the definitions based on the data source template specified by the Source file (*.c) template parameter in the data section of the Templates pane.

Limitation

This parameter applies to data with storage classes except these:

  • ExportedGlobal

  • ImportedExtern

  • ImportedExternPointer

  • BitField

  • FileScope

  • Localizable

  • Struct

  • CompilerFlag

In the Embedded Coder® Dictionary, the Header File value for unsupported storage classes is empty. You cannot specify default file placement for unsupported storage classes.

Dependency

This parameter enables Data definition filename.

Command-Line Information

Parameter: GlobalDataDefinition
Type: character vector
Value: 'Auto' | 'InSourceFile' | 'InSeparateSourceFile'
Default: 'Auto'

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityA valid value
EfficiencyNo impact
Safety precautionNo impact

See Also

Related Topics