Software architecture and design
The defined architecture is based on a modular, layered approach that emphasizes the separation of concerns, clear interfaces, and independence of components. AUTOSAR provides guidelines and best practices for software architecture and design, which enable software engineers to develop high-quality, standardized SWCs that can be easily integrated into different automotive systems and devices.
Layers
A layer in software architecture refers to a logical grouping of SWCs that share a common set of responsibilities and are designed to work together to perform a specific set of tasks.
It can be seen as a horizontal slice through the software architecture, with each layer providing a specific set of services to the layer above it, as shown in Figure 1.9. The layers are typically designed to be modular and loosely coupled so that changes made to one layer do not affect the functionality of the other layers.
The AUTOSAR layered architecture provides the necessary mechanisms for achieving software and hardware independence by dividing the software into three main layers that run on a microcontroller, as shown in the following figure:
Figure 1.9 – AUTOSAR layered architecture
Let’s discuss these layers in further detail:
- Application layer: This is where the SWCs that contain the algorithms and functionality of the system are located. This layer is responsible for implementing the high-level behavior of the system and uses the interface of the lower layers to access the hardware resources. Some examples of functions are monitoring the battery charge for a battery charger ECU and setting and viewing the temperature through the human-machine interface (HMI).
- AUTOSAR RTE: The RTE serves as both a binding and isolating layer between the ASW and BSW layers. All communication and service usage between these two layers must occur within the RTE. We will dive into the specifics of this topic in greater detail in Chapter 4.
- Basic software: The BSW layer is divided into three different layers, each providing specific functionality required for the proper functioning of an ECU. These layers are as follows:
- Services layer: This layer offers a variety of services for applications to utilize. It comprises services such as System Services, Memory Services, Crypto Services, and Diagnostic and Communication Services.
- ECU abstraction layer: This layer delivers ECU-related abstractions, including I/O Hardware Abstraction, Onboard Device Abstraction as an external watchdog, Memory Hardware Abstraction, and Crypto Hardware Abstraction, to enable hardware independence for applications.
- Microcontroller abstraction layer (MCAL): This layer provides a driver implementation for the MCU in use, enabling communication between the BSW layers above and the microcontroller hardware peripherals.
Further exploration of the layers will be conducted in Chapter 2.
Stacks
A stack refers to a collection of software layers or components that work together to provide a specific functionality or service. Each layer in the stack represents a distinct set of functions and services and is responsible for performing a specific set of tasks. The layers communicate with each other through well-defined interfaces, and the data is passed between the layers in a hierarchical manner, with each layer providing services to the layer above it. The architecture is shown in the following figure:
Figure 1.10 – AUTOSAR stacks
Some of the main AUTOSAR stacks that we will dive into in our journey are the following:
- Memory Stack
- Communication (CAN, Ethernet, LIN, and FlexRay)
- Diagnostic
- IO Hardware Abstraction
- Security