Main Content

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.

  1. 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 modelautosar_swc.

  2. 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 fromGetDataIndextoReadBlock. (For an example of usingreadBlockin 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 asReadBlockandWriteBlock显示一个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 asint8([1 1; 1 1]).

    • To specify a structured data type, you can create aSimulink.Parameterdata object, type it with aSimulink.Busobject, and reference the parameter name.

  3. 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 theReadBlockoperation is selected:

    • The software creates C-S interfaceNvMService,在NvMService, its supported operations. For each operation, arguments are provided with read-only properties. Here are the arguments for theNvMServiceoperationReadBlockdisplayed in the AUTOSAR Dictionary.

    • The software creates a client port with the default nameNvMService. Unlike the C-S-interface, operation, and argument names, the client port name can be customized. The client port is mapped to theNvMServiceinterface.

    • The Code Mappings editor,Function Callerstab, maps theNvMServicefunction caller block to AUTOSAR client portNvMServiceand AUTOSAR operationReadBlock.

  4. Optionally, build your model and examine the generated C and ARXML code.

    In the block dialog step, if you selected operationReadBlockfor 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 asRte_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  
  5. To simulate the component model, create a containing composition, system, or test harness model. In that containing model, insert reference implementations of the NvMReadBlockandSetBlockProtectionservice 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

||

Related Examples

More About