Main Content

Model AUTOSAR Nonvolatile Memory

The AUTOSAR standard defines implicit and explicit mechanisms by which an AUTOSAR software component can read and write nonvolatile memory in an automotive system:

  • Implicit access uses sender-receiver ports or data store memory blocks to access a copy of an AUTOSAR nonvolatile memory block in RAM.

  • Explicit access uses client-server calls to directly access an AUTOSAR nonvolatile memory block.

Implicit Access to AUTOSAR Nonvolatile Memory

Implicit access to AUTOSAR nonvolatile memory uses a startup event to begin shadowing or mirroring a nonvolatile memory block in RAM. Using a RAM copy of nonvolatile memory can support faster access.

  1. During ECU power-up, when a startup event occurs, a background task copies a memory block from nonvolatile memory space to RAM.

  2. While the system runs, software components can access the nonvolatile data at RAM speed.

  3. When a shutdown event occurs, before shutdown, a background task copies the shadowed or mirrored memory block back to nonvolatile memory space.

To model implicit read and write access to nonvolatile memory in an AUTOSAR component model, you configure either port-based nonvolatile (NV) data communication or an NVRAM mirror block.

In port-based NV data communication, an AUTOSAR software component reads and writes data to AUTOSAR nonvolatile components. To implement NV data communication, AUTOSAR software components define provide and require ports that send and receive NV data. In Simulink®, you can:

  • Import AUTOSAR NV data interfaces and ports from ARXML files.

  • Create AUTOSAR NV interfaces and ports, and map Simulink inports and outports to AUTOSAR NV ports.

    You model AUTOSAR NV ports with Simulink inports and outports, in the same manner described in Sender-Receiver Interface.

  • Generate C code and ARXML files for AUTOSAR NV data interfaces and ports.

With port-based NV data communication, you can distribute or coordinate NV data access across software components. For example, multiple components can read the same NV data from a nonvolatile software component, while one component writes to it.

For more information, see Configure AUTOSAR Nonvolatile Data Communication.

To configure an NVRAM mirror block, an AUTOSAR software component maps a data store memory block to AUTOSAR typed per-instance memory (ArTypedPerInstanceMemory) and selects the option NeedsNVRAMAccess. This option indicates that the ArTypedPerInstanceMemory is a RAM mirror block and requires service from the NVRAM Manager (NvM) manager module. In Simulink, you can:

  • Import AUTOSAR NVRAM mirror blocks from ARXML files.

  • Create model content that configures data store memory blocks as AUTOSAR NVRAM mirror blocks.

  • Generate C code and ARXML files for AUTOSAR NVRAM mirror blocks. An AUTOSAR run-time environment generator allocates the memory and provides an API through which the component accesses the memory.

For more information, see Configure AUTOSAR Per-Instance Memory.

Explicit Access to AUTOSAR Nonvolatile Memory

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 NVRAM Manager and the Diagnostic Event Manager. In the AUTOSAR RTE, AUTOSAR software components typically access BSW services using client-server communication.

Explicit access to AUTOSAR nonvolatile memory uses calls to the NVRAM Manager (NvM) service to directly access AUTOSAR nonvolatile memory space. Explicit access can be used in response to events, for example, air bag events, or at each time step, for example, for controllers that have no shutdown sequence.

To support system-level modeling of AUTOSAR components and services, AUTOSAR Blockset provides an AUTOSAR Basic Software block library. The library includes preconfigured Function Caller blocks for modeling component calls to NVM service interfaces, including NvMAdminCaller and NvMServiceCaller.

To implement client calls to AUTOSAR NVM service interfaces in your AUTOSAR software component, you drag and drop Basic Software blocks into an AUTOSAR model. Each block has prepopulated parameters, such as Client port name and Operation. If you modify the operation selection, the software updates the block inputs and outputs to correspond.

To configure the added blocks in the AUTOSAR software component, click the Update button in the Code Mappings editor view of the model. The software creates AUTOSAR client-service interfaces, operations, and ports, and maps each Simulink function caller to an AUTOSAR client port and operation.

For more information, see Configure Calls to AUTOSAR NVRAM Manager Service.

To simulate an AUTOSAR component model that calls BSW services, create a containing composition, system, or harness model. In that containing model, provide a reference implementation of the NvM service operations called by the component.

The AUTOSAR Basic Software block library includes an NVRAM Service Component block. The block provides reference implementations NvM service operations. To support simulation of component calls to the NvM service, include the blocks in the containing model. You can insert the blocks in either of two ways:

  • Automatically insert the blocks by creating a Simulink Test™ harness model.

  • Manually insert the blocks into a containing composition, system, or harness model.

For more information, see Configure AUTOSAR Basic Software Service Implementations for Simulation and Simulate AUTOSAR Basic Software Services and Run-Time Environment.

See Also

| |

Related Topics