Main Content

Shared code placement

Location of generated code that is shared

Model Configuration Pane: Code Generation / Interface

Description

The Shared code placement parameter specifies the location where the code generator places code for utility functions, exported data type definitions, and declarations of exported data that is configured with a custom storage class.

Settings

Auto (default) | Shared location
Auto

For a model that contains existing shared code (see Existing Shared Code (Embedded Coder)) or at least one of these blocks, places utility code within the codeGenFolder/slprj/target/_sharedutils (or codeGenFolder/targetSpecific/_shared) folder :

  • Model blocks

  • Simulink Function blocks

  • Function Caller blocks

  • Calls to Simulink Function blocks from Stateflow or MATLAB Function blocks

  • Stateflow graphical functions when you select the Export Chart Level Functions parameter

If a model does not contain one of the preceding blocks or existing shared code, the code generator places utility code in the build folder (the folder that contains model.c or model.cpp).

Shared location

Places code for utilities in the codeGenFolder/slprj/target/_sharedutils (or codeGenFolder/targetSpecific/_shared) folder.

Recommended Settings

ApplicationSetting
DebuggingShared location (GRT)
No impact (ERT)
TraceabilityShared location (GRT)
No impact (ERT)
EfficiencyNo impact (execution, RAM)
Shared location (ROM)
Safety precautionNo impact

Programmatic Use

Parameter: UtilityFuncGeneration
Type: character vector
Value: 'Auto' | 'Shared location'
Default: 'Auto'

Version History

Introduced before R2006a