Main Content

getInternalDataPackaging

Get default internal data packaging for AUTOSAR component model

Since R2021a

Description

pkgSetting = getInternalDataPackaging(slMap) returns the data packaging setting pkgSetting, which specifies the default packaging for internal data stores, signals, and states in the generated code for an AUTOSAR component model.

Packaging options differ depending on whether the component model instantiates an AUTOSAR software component once or multiple times. Multi-instance software components can generate reentrant, reusable functions. See Multi-Instance Components for more information.

Valid settings for internal data packaging are:

  • For single-instance models:

    • Default — Accept the default internal data packaging provided by the software. Use Default for submodels referenced from AUTOSAR component models.

    • PrivateGlobal — Package internal variable data without a struct object and make it private (visible only to model.c).

    • PrivateStructure — Package internal variable data in a struct object and make it private (visible only to model.c).

    • PublicGlobal — Package internal variable data without a struct object and make it public (extern declaration in model.h).

    • PublicStructure — Package internal variable data in a struct object and make it public (extern declaration in model.h).

  • For multi-instance models:

    • Default — Accept the default internal data packaging provided by the software. Use Default for submodels referenced from AUTOSAR component models.

    • CTypedPerInstanceMemory — Package internal variable data for each instance of an AUTOSAR software component to use C-typed per-instance memory in a struct object and make it public (declaration in model.h).

    • ArTypedPerInstanceMemory — Package internal variable data for each instance of an AUTOSAR software component to use AUTOSAR-typed per-instance memory in a struct object and make it public (declaration in Rte_Type.h). Setting ArTypedPerInstanceMemory is not supported for models that contain model references.

When the data packaging setting is ArTypedPerInstanceMemory, code generation does not support bitfield optimizations. If you configure ArTypedPerInstanceMemory, configuration parameters BooleansAsBitfields, StateBitsets, and DataBitsets must be disabled.

If the data packaging setting is PrivateGlobal or PrivateStructure, building the model generates the header file model_private.h, even when the model configuration parameter File packaging format (Embedded Coder) is set to Compact.

If the model configuration option Generate separate internal data per entry-point function (Embedded Coder) is set for the AUTOSAR model, task-based internal data grouping overrides the AUTOSAR internal data packaging setting. However, the AUTOSAR setting determines the public or private visibility of the generated internal data groups.

example

Examples

collapse all

Return and modify the default data packaging setting used for internal variables in the generated code for the AUTOSAR component model.

hModel = 'autosar_swc';
openExample(hModel);
slMap = autosar.api.getSimulinkMapping(hModel);
pkgSetting1 = getInternalDataPackaging(slMap)
setInternalDataPackaging(slMap,'PrivateStructure')
pkgSetting2 = getInternalDataPackaging(slMap)
pkgSetting1 =
    'Default'

pkgSetting2 =
    'PrivateStructure'

Input Arguments

collapse all

Simulink to AUTOSAR mapping information for a model, previously returned by slMap = autosar.api.getSimulinkMapping(model), where model is a handle, or character vector or string scalar representing the model name.

Output Arguments

collapse all

Default internal data packaging setting used for internal variables in the generated code for the AUTOSAR component model, returned as character vector. Values for single-instance models can be 'Default', 'PrivateGlobal', 'PrivateStructure', 'PublicGlobal', and 'PublicStructure'. Valid values for multi-instance models are 'Default', 'CTypedPerInstanceMemory', and 'ArTypedPerInstanceMemory'.

Version History

Introduced in R2021a

expand all