Main Content

Data definition

Placement of global variable definitions

Model Configuration Pane: Code Generation / Code Placement

Description

Specify where to place definitions of global variables.

Dependencies

This parameter enables Data definition filename.

Settings

Auto (default) | Data defined in source file | Data defined in a single separate source file

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.

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityA valid value
EfficiencyNo impact
Safety precautionNo impact

Programmatic Use

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

Version History

Introduced before R2006a