Main Content

mapDataStore

Map Simulink data store to AUTOSAR variable

Description

example

mapDataStore(slMap,slBlockHandle,arVarType) maps Simulink® data store memory block slBlockHandle to an AUTOSAR variable of type arVarType for AUTOSAR run-time calibration. AUTOSAR variable types include ArTypedPerInstanceMemory and StaticMemory for classic models and Persistency for adaptive models.

mapDataStore(slMap,slBlockHandle,arVarType,Name,Value) specifies additional properties for an AUTOSAR ArTypedPerInstanceMemory, StaticMemory, or Persistency variable by using one or more Name,Value pair arguments.

Examples

collapse all

Set AUTOSAR mapping and property information for the Simulink data store memory block Data Store Memory in example model autosar_bsw_sensor1.

hModel = 'autosar_bsw_sensor1';
addpath(fullfile(matlabroot,'/examples/autosarblockset/main'));
hBlock = 'autosar_bsw_sensor1/Data Store Memory';

open_system(hModel);
slMap = autosar.api.getSimulinkMapping(hModel);
mapDataStore(slMap,hBlock,'ArTypedPerInstanceMemory','NeedsNVRAMAccess','true');
arMappedTo = getDataStore(slMap,hBlock)
arNvram = getDataStore(slMap,hBlock,'NeedsNVRAMAccess')
arMappedTo =
    'ArTypedPerInstanceMemory'

arNvram =
    'true'

Input Arguments

collapse all

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

Example: slMap

Name or handle of Simulink data store memory block that you set AUTOSAR mapping information for.

Example: 'autosar_bsw_sensor1/Data Store Memory'

Type of AUTOSAR variable that you want to map the specified Simulink data store to. Valid AUTOSAR variable types include ArTypedPerInstanceMemory, StaticMemory, and Auto for classic models. Valid AUTOSAR variable types include Persistency and Auto for adaptive models. To accept software mapping defaults, specify Auto.

Example: 'StaticMemory'

Name-Value Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'SwCalibrationAccess','ReadWrite' specifies read-write access to the variable for run-time calibration.

Specify the data element of the persistency port associated with the AUTOSAR adaptive variable. DataElement can be set with Port only.

Example: 'Port','Perport','DataElement','Delement1'

Specify display format for the AUTOSAR variable. AUTOSAR display format specifications control the width and precision display for measurement and calibration data. For more information, see Configure DisplayFormat.

Example: 'DisplayFormat','%2.6f'

Specify whether to include C type qualifier volatile in generated code for the AUTOSAR variable.

Example: 'IsVolatile','true'

Specify whether the AUTOSAR variable requires access to nonvolatile RAM on a processor. Specify true to configure the per-instance memory to be a mirror block for a specific NVRAM block.

Example: 'NeedsNVRAMAccess','true'

Specify the persistency port to associate with the AUTOSAR adaptive variable. Port can be set with DataElement only.

Example: 'Port','Perport','DataElement','Delement1'

Optionally specify an AUTOSAR additional native type qualifier to include in generated code for the AUTOSAR variable.

Example: 'Qualifier','test_qualifier'

Specify short name for the AUTOSAR variable. If unspecified, ARXML export automatically generates a short name, which can differ from the data store name.

Example: 'ShortName','LowSetPoint'

Specify a SwAddrMethod name that is valid for the AUTOSAR variable. Code generation uses the SwAddrMethod name to group AUTOSAR variables in a memory section for access by measurement and calibration tools. For a list of valid SwAddrMethod values for the variable, see the Code Mappings editor, Data Stores tab. For more information, see Configure SwAddrMethod.

Example: 'SwAddrMethod','VAR'

Specify how measurement and calibration tools can access the AUTOSAR variable. Valid access values include ReadOnly, ReadWrite, and NotAccessible. For more information, see Configure SwCalibrationAccess.

Example: 'SwCalibrationAccess','ReadWrite'

Introduced in R2019a