Configure Calls to AUTOSAR NVRAM Manager Service
For the AUTOSAR Classic Platform, the AUTOSAR standard defines important services as part of Basic Software (BSW) that runs in the AUTOSAR Runtime Environment (RTE). Examples include services provided by the Diagnostic Event Manager (Dem), the Function Inhibition Manager (FiM), and the NVRAM Manager (NvM). In the AUTOSAR RTE, AUTOSAR software components typically access BSW services using client-server or sender-receiver communication.
非盟的金宝app支持系统级建模TOSAR components and services,AUTOSAR Blocksetprovides an AUTOSAR Basic Software block library. The library contains preconfigured blocks for modeling component calls to AUTOSAR BSW services and reference implementations of the BSW services. For information about using the blocks to model client calls to AUTOSAR BSW service interfaces, seeModel AUTOSAR Basic Software Service Calls.
For a live-script example of simulating AUTOSAR BSW services, see exampleSimulate AUTOSAR Basic Software Services and Run-Time Environment.
For more information about modeling software component access to AUTOSAR nonvolatile memory, seeModel AUTOSAR Nonvolatile Memory.
Here is an example of configuring client calls to NvM service interfaces in your AUTOSAR software component.
Open a model that is configured for AUTOSAR code generation. Using the Library Browser or by typing block names in the model window, add NvM blocks to the model. This example adds the blocksNvMAdminCallerandNvMServiceCallerto a writable copy of the example model
autosar_swc
.Open each block and examine the parameters, especiallyOperation. If you select a different operation and clickApply, the software updates the block inputs and outputs to match the arguments of the selected operation.
This example changes theOperationfor theNvMServiceCallerblock from
GetDataIndex
toReadBlock
. (For an example of usingreadBlock
in a throttle position sensor implementation, see exampleSimulate AUTOSAR Basic Software Services and Run-Time Environment.) TheOperationparameter must be set to an operation supported by the schema currently specified by the model. The list of operations reflects the operations supported by the current schema.For some NvM operations, such as
ReadBlock
andWriteBlock
显示一个argu块参数对话框ment specification parameter. The parameter specifies data type and dimension information for data to be read or written by the operation, set touint8(1)
by default.To specify a multidimensional data type, you can use array syntax, such as
int8([1 1; 1 1])
.To specify a structured data type, you can create a
Simulink.Parameter
data object, type it with aSimulink.Bus
object, and reference the parameter name.
Open the Code Mappings editor. To update the Simulink®to AUTOSAR mapping of the model with changes to Simulink function callers, click theUpdatebutton
. The software creates AUTOSAR client-service interfaces, operations, and ports, and maps each Simulink function caller to an AUTOSAR client port and operation.
For example, for theNvMServiceCallerblock in this example, for which the
ReadBlock
operation is selected:The software creates C-S interface
NvMService
,在NvMService
, its supported operations. For each operation, arguments are provided with read-only properties. Here are the arguments for theNvMService
operationReadBlock
displayed in the AUTOSAR Dictionary.The software creates a client port with the default name
NvMService
. Unlike the C-S-interface, operation, and argument names, the client port name can be customized. The client port is mapped to theNvMService
interface.The Code Mappings editor,Function Callerstab, maps the
NvMService
function caller block to AUTOSAR client portNvMService
and AUTOSAR operationReadBlock
.
Optionally, build your model and examine the generated C and ARXML code.
In the block dialog step, if you selected operation
ReadBlock
for theNvMServiceCallerblock, code generation requires adding data store blocks to the model. Connect the block first outport to a Data Store Write block, and add a Data Store Memory block. For both blocks, specify data store name A. For example:The C code includes the client calls to the BSW services, for example:
/* FunctionCaller: '
/NvMServiceCaller' */ Rte_Call_NvMService_ReadBlock(&rtDW.A); ... /* FunctionCaller: ' /NvMAdminCaller' */ Rte_Call_NvMAdmin_SetBlockProtection(false); Generated RTE include files define the server operation call points, such as
Rte_Call_NvMService_ReadBlock
.The ARXML code defines the BSW service operations called by the component as server call points, for example:
... SC_NvMService_ReadBlock /Company/Powertrain/Components/ASWC/NvMService /AUTOSAR/Services/NvM/NvMService/ReadBlock 1 To simulate the component model, create a containing composition, system, or test harness model. In that containing model, insert reference implementations of the NvM
ReadBlock
andSetBlockProtection
service operations.The AUTOSAR Basic Software block library provides anNVRAM Service Componentblock, which provides reference implementations of NvM service operations. You can manually insert the block into a containing composition, system, or harness model, or automatically insert the block by creating aSimulink Test™harness model.
For more information, seeConfigure AUTOSAR Basic Software Service Implementations for SimulationandSimulate AUTOSAR Basic Software Services and Run-Time Environment.
See Also
NvMAdminCaller|NvMServiceCaller|NVRAM Service Component
Related Examples
- Configure AUTOSAR Basic Software Service Implementations for Simulation
- Simulate AUTOSAR Basic Software Services and Run-Time Environment
- Configure AUTOSAR Client-Server Communication