mapFunction
Map Simulink entry-point function to AUTOSAR runnable and software address methods
Syntax
Description
mapFunction(
maps Simulink® entry-point function slMap
,slEntryPointFunction
,arRunnableName
)slEntryPointFunction
to
AUTOSAR runnable arRunnableName
.
mapFunction(
specifies additional properties for the AUTOSAR runnable by using one or more
slMap
,slEntryPointFunction
,arRunnableName
,Name,Value
)Name,Value
pair arguments. You can specify software address
methods (SwAddrMethod
s) for runnable function code and internal
data.
Examples
Set AUTOSAR Mapping Information for Simulink Entry-Point Function
Set AUTOSAR mapping information for a Simulink entry-point function in the example model
autosar_swc
. The model has an initialize entry-point
function named Runnable_Init
and periodic entry-point
functions named Runnable_1s
and
Runnable_2s
.
hModel = 'autosar_swc'; openExample(hModel); slMap=autosar.api.getSimulinkMapping(hModel); mapFunction(slMap,'Initialize','Runnable_Init'); arRunnableName=getFunction(slMap,'Initialize')
arRunnableName = 'Runnable_Init'
Set AUTOSAR SwAddrMethod
s for Simulink Entry-Point Function
Set AUTOSAR SwAddrMethod
s for a
Simulink entry-point function in the example model
autosar_swc_counter
. The model has a single-tasking
periodic entry-point step function.
hModel = 'autosar_swc_counter'; openExample(hModel); % Add SwAddrMethods myCODE and myVAR to the AUTOSAR component arProps = autosar.api.getAUTOSARProperties(hModel); addPackageableElement(arProps,'SwAddrMethod',... '/Company/Powertrain/DataTypes/SwAddrMethods','myCODE',... 'SectionType','Code') swAddrPaths = find(arProps,[],'SwAddrMethod','PathType','FullyQualified',... 'SectionType','Code') addPackageableElement(arProps,'SwAddrMethod',... '/Company/Powertrain/DataTypes/SwAddrMethods','myVAR',... 'SectionType','Var') swAddrPaths = find(arProps,[],'SwAddrMethod','PathType','FullyQualified',... 'SectionType','Var') % Set code generation parameter for runnable internal data SwAddrMethods set_param(hModel,'GroupInternalDataByFunction','on') % Map periodic function and internal data to myCODE and myVAR SwAddrMethods slMap = autosar.api.getSimulinkMapping(hModel); mapFunction(slMap,'Periodic','Runnable_Step',... 'SwAddrMethod','myCODE','SwAddrMethodForInternalData','myVAR') % Return AUTOSAR mapping information for periodic function [arRunnableName,arRunnableSwAddrMethod,arInternalDataSwAddrMethod] = ... getFunction(slMap,'Periodic')
swAddrPaths = 1×2 cell array {'/Company/Powertrain/DataTypes/SwAddrMethods/CODE'} {'/Company/Powertrain/DataTypes/SwAddrMethods/myCODE'} swAddrPaths = 1×2 cell array {'/Company/Powertrain/DataTypes/SwAddrMethods/VAR'} {'/Company/Powertrain/DataTypes/SwAddrMethods/myVAR'} arRunnableName = 'Runnable_Step' arRunnableSwAddrMethod = 'myCODE' arInternalDataSwAddrMethod = 'myVAR'
Input Arguments
slMap
— Simulink to AUTOSAR mapping information for a model
handle
Simulink to AUTOSAR mapping information for a model, previously
returned by
.
slMap
=
autosar.api.getSimulinkMapping(model
)
is a handle,
character vector, or string scalar representing the model name.model
Example: slMap
slEntryPointFunction
— Simulink entry-point function
character vector | string scalar
Simulink entry-point function for which to set AUTOSAR mapping information. The value format is based on the function type.
Function Type | Value |
---|---|
Initialize | 'Initialize' . |
Reset | 'Reset: ,
where
is the name of a reset function in the model. |
Terminate | 'Terminate' . |
Single-tasking periodic | 'Periodic' . |
Periodic (implicit task) | 'Periodic: ,
where
is the corresponding period annotation, as displayed in the
Timing Legend. For example,
'Periodic:D1' . |
Partition (explicit task) | 'Partition: ,
where
is the partition name, as displayed in the Schedule Editor.
For example, 'Partition:P1' . |
Exported |
|
Simulink function in client-server configuration | 'SimulinkFunction: ,
where
is the name of a global Simulink function in the model. For example,
'SimulinkFunction:readData' in the
example model in Configure AUTOSAR Server. |
Example: 'Periodic:D1'
arRunnableName
— Name of AUTOSAR runnable
character vector | string scalar
Name of AUTOSAR runnable to which to map the specified Simulink entry-point function object.
Example: 'Runnable_2s'
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: 'SwAddrMethod','CODE'
specifies
SwAddrMethod
CODE
for an AUTOSAR runnable function.
SwAddrMethod
— Name of function SwAddrMethod
character vector | string scalar
Specify a SwAddrMethod
name that is valid for the
AUTOSAR function. Code generation uses the
SwAddrMethod
name to group AUTOSAR runnable
functions in a memory section. For a list of valid
SwAddrMethod
values for the function, see the
Code Mappings editor, Entry-Point Functions tab.
For more information, see Configure SwAddrMethod.
Example: 'SwAddrMethod','CODE'
SwAddrMethodForInternalData
— Name of internal data SwAddrMethod
character vector | string scalar
Specify a SwAddrMethod
name that is valid for the
AUTOSAR internal data. Code generation uses the
SwAddrMethod
name to group AUTOSAR runnable
internal data in a memory section. For a list of valid
SwAddrMethod
values for the internal data, see
the Code Mappings editor, Entry-Point Functions
tab. For more information, see Configure SwAddrMethod.
Code generation for runnable internal data
SwAddrMethod
s requires setting the model
configuration option Code Generation > Interface > Generate separate internal data per entry-point
function (GroupInternalDataByFunction
) to
on
.
Example: 'SwAddrMethodForInternalData','VAR'
Version History
Introduced in R2013b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)