Hello I'm

Sandeep Tiwari

Automotive Software Engineer with more than a decade of experience.

More About Me

Memory Services (MemStack) In AUTOSAR – Part 1

Memory Stack in AUTOSAR layered architecture is a set of modules like Non-Volatile Memory Manager – NvM(Services Layer), Memory Interface – MemIf(ECU Abstraction Layer), Flash EEPROM Emulation – Fee(ECU Abstraction Layer), EEPROM Abstraction – Ea(ECU Abstraction Layer), Flash Driver – Fls(MCAL Layer) and EEPROM Driver – Eep(MCAL Layer) providing basic memory management services to the upper application layer and to the basic software.

image

Memory Stack in AUTOSAR

The NvM module provides basic synchronous and asynchronous read/write/compare services to the application or the basic software.

Synchronous Services : Synchronous service is a blocking service call wherein the program polls for the completion of the service and the execution returns only when the service has been completed.

Asynchronous Services : Asynchronous service is a non-blocking service call wherein a request for the service is placed in a queue and the upper is notified of the completion of the service by a callback routine configured during the block configuration.

There are different types of NvM blocks which can be configured as,

1. Native Blocks 2. Redundant Blocks 3. Dataset Blocks

based on the number of mandatory or optional memory objects like NV blocks, RAM blocks, ROM blocks and Administrative blocks.

NV Block is a basic object which contains a block header, mandatory place holder for data and an optional CRC field. RAM and ROM blocks are copies of the configured NV block. RAM block(optional) is used to read/write data to the non-volatile memory. ROM block(optional) is used to restore the default values of the NV block in case of failures. Administrative block at least contains the status and length of the NV block. It can contain more fields. Status field in the admin block specifies whether the NV block contains a valid data or not and length field specifies the length of data in the NV block.

Native Blocks : Native Block is a type of NvM storage object which has following type of mandatory and optional blocks, NV Blocks(mandatory) – 1 RAM Blocks(mandatory) – 1 ROM Blocks(optional) – 1 Administrative Blocks(mandatory) – 1

Redundant Blocks : Redundant Blocks is a type of NvM storage object which has following type of mandatory and optional blocks, NV Blocks(mandatory) – 2 RAM Blocks(mandatory) – 1 ROM Blocks(optional) – 1 Administrative Blocks(mandatory) – 1

Dataset Blocks : Dataset Blocks is a type of NvM storage object which has following type of mandatory and optional blocks, NV Blocks(mandatory) – 1 to 255 RAM Blocks(mandatory) – 1 ROM Blocks(optional) – 1 to n (where ‘n’ can vary based on configuration ) Administrative Blocks(mandatory) – 1

Basic flow of modules triggered when a single/multi block request is issued from application :

Single block request is one in which only one NvM block has to be written to or read from the NvM memory. Basic single block requests are NvM_ReadBlock and NvM_WriteBlock. Single block calls are the most frequently used services during normal system operation.

Multi Block request is the one in which multiple NvM blocks are requested to be written or read to or from NvM memory. The block can be configured to be considered for a multi block service during NvM block configuration. Basic multi block calls are NvM_ReadAll and NvM_WriteAll. Multi block calls are mostly used during system startup and system shutdown. Multi block call is used during startup to restore all the last written data to RAM from NvM and also during shutdown to store the data to NvM from RAM memory.

Single Block Call : When a single block service request is raised an application software component or a basic software module, the request is received by NvM. The NvM module forwards this request to MemIf with the data reference and the block id of the hardware where the data has to be written in case of a write request. In case of a read request the NvM passes the block reference where the data has to be read back and the block id. The MemIf forwards this request to the layer, which can either be Fee(Flash EEPROM Emulation) or Ea(EEPROM Abstraction) based on the device identifier passed by the NvM. If the request is passed to the Fee module, the Fee module forwards this to the Fls driver to service the request or if the request is passed to the Ea module, the Ea module forwards this request to the Eep driver.

Multi Block Call : Multi block call is placed by EcuM(ECU State Manager) module during system startup(NvM_ReadAll) or system shutdown(NvM_WriteAll) to restore the last stored system state or to save the current system state. There are two asynchronous multi block calls NvM_ReadAll and NvM_WriteAll. All the blocks which are configured to be included during a multi block call are read or written and the blocks like MemIf, Fee, Ea, Fls and Eep are triggered depending on the memory in which the blocks are placed.

sandeeptiwari.com | Copyright © All rights reserved | This template is made with by Colorlib