# shiivamgupta/autosar-software-demo architecture

> Architecture diagram of the GitHub repository shiivamgupta/autosar-software-demo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shiivamgupta/autosar-software-demo
- Repository: https://github.com/shiivamgupta/autosar-software-demo

## Overview

1. **Repository purpose**
   - This is a small **AUTOSAR Classic demo** that illustrates the standard ECU software layering: **Application SWC → ECU Abstraction → MCAL**.
   - It is not a complete production AUTOSAR stack; it is a teaching/demo repo showing how the layers fit together.

2. **Top-level architecture**
   - The repo is organized by AUTOSAR layer:
     - **ASW**: application software component
     - **ECUAbstraction**: hardware-facing abstraction layer
     - **MCAL**: low-level microcontroller drivers
     - **Interfaces**: shared AUTOSAR interface/type definitions
     - **Composition.arxml**: system/component assembly metadata

3. **Application layer**
   - `ASW/ApplicationSWC.c` and `ASW/ApplicationSWC.arxml` represent the **application software component**.
   - This is where feature logic lives; it should not talk directly to hardware.
   - In an AUTOSAR diagram, this box is the topmost functional block and depends on abstract interfaces rather than concrete peripherals.

4. **ECU abstraction layer**
   - `ECUAbstraction/EcuAbstraction.c` and `ECUAbstraction/EcuAbstraction_swc.arxml` sit between the application and the drivers.
   - This layer hides board/peripheral details and exposes a more stable, ECU-oriented API to the application.
   - It is the main boundary that converts application intent into hardware-related operations.

5. **MCAL drivers**
   - `MCAL/ADCDriver/Adc.c` and `Adc.h` provide ADC access.
   - `MCAL/DIODriver/Dio.c` and `Dio.h` provide digital I/O access.
   - These are the lowest software layer in the repo and represent the point where software touches microcontroller peripherals directly.

6. **Interfaces and types**
   - `Interfaces/Interfaces.arxml` defines shared AUTOSAR interfaces/ports used between components.
   - `Interfaces/PlatformTypes.arxml` provides common platform data types used across layers.
   - These files are the contract layer: they keep the application, abstraction, and driver code aligned on data types and communication signatures.

7. **Composition and wiring**
   - `Composition.arxml` describes how the SWCs are assembled into a system.
   - In an architecture diagram, this is the block that connects the application component to the abstraction component through AUTOSAR-defined ports/interfaces.
   - It represents integration/configuration more than executable logic.

8. **Primary data flow**
   - The intended flow is **ApplicationSWC → EcuAbstraction → MCAL drivers → hardware**.
   - Read/write operations on sensors or actuators would be requested by the application, translated by the ECU abstraction, and executed by ADC/DIO drivers.
   - This direction is the key abstraction boundary for the diagram.

9. **Boundary between logic and hardware**
   - The application layer should remain hardware-independent.
   - Hardware-specific details are concentrated in MCAL and partially in ECU Abstraction.
   - This separation is the main architectural point of the repo and is the most important thing to show visually.

10. **AUTOSAR configuration artifacts**
    - The `.arxml` files are central to the architecture because AUTOSAR relies heavily on model/configuration data.
    - They likely define component interfaces, ports, and composition wiring that would normally be processed by AUTOSAR tooling.
    - This repo demonstrates that AUTOSAR architecture is as much configuration/modeling as it is C code.

11. **Tooling/runtime context**
    - The README notes AUTOSAR tooling such as **DaVinci Configurator/Developer** as the typical way these components are generated and integrated.
    - That matters architecturally because the repo reflects a tool-driven AUTOSAR workflow rather than a manually wired embedded project.

12. **What to emphasize in a diagram**
    - Draw three software layers with clear arrows downward:
      - **Application SWC**
      - **ECU Abstraction**
      - **MCAL (ADC, DIO)**
    - Put **Interfaces/PlatformTypes** alongside as shared contracts.
    - Show **Composition.arxml** as the system integrator that binds components together.

Main entry points: [`Interfaces/Interfaces.arxml`](https://github.com/shiivamgupta/autosar-software-demo/blob/main/Interfaces/Interfaces.arxml) (Interfaces), [`ASW/ApplicationSWC.arxml`](https://github.com/shiivamgupta/autosar-software-demo/blob/main/ASW/ApplicationSWC.arxml) (App ARXML), [`ECUAbstraction/EcuAbstraction_swc.arxml`](https://github.com/shiivamgupta/autosar-software-demo/blob/main/ECUAbstraction/EcuAbstraction_swc.arxml) (ECU ARXML), [`Interfaces/PlatformTypes.arxml`](https://github.com/shiivamgupta/autosar-software-demo/blob/main/Interfaces/PlatformTypes.arxml) (Platform Types)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_application["Application"]
  node_app_swc["App SWC<br/>application component<br/>[ApplicationSWC.c]"]
  node_app_arxml["App ARXML<br/>swc model"]
end

subgraph group_abstraction["ECU Abstraction"]
  node_ecu_abstraction["ECU Abstraction<br/>bridge layer<br/>[EcuAbstraction.c]"]
  node_ecu_arxml["ECU ARXML<br/>swc model"]
end

subgraph group_mcal["MCAL"]
  node_adc_driver["ADC Driver<br/>mcal peripheral<br/>[Adc.c]"]
  node_dio_driver["DIO Driver<br/>mcal peripheral<br/>[Dio.c]"]
end

subgraph group_contracts["Interfaces"]
  node_interfaces_arxml["Interfaces<br/>autsar contracts<br/>[Interfaces.arxml]"]
  node_platform_types["Platform Types<br/>type model"]
end

subgraph group_integration["Composition"]
  node_composition["Composition<br/>arxml system config<br/>[Composition.arxml]"]
end

node_hardware{{"Hardware<br/>microcontroller peripherals"}}

node_composition -->|"assembles"| node_app_arxml
node_composition -->|"assembles"| node_ecu_arxml
node_composition -.->|"uses"| node_interfaces_arxml
node_app_arxml -.->|"requires"| node_interfaces_arxml
node_app_arxml -.->|"types"| node_platform_types
node_app_swc -->|"calls"| node_ecu_abstraction
node_ecu_arxml -.->|"requires"| node_interfaces_arxml
node_ecu_arxml -.->|"types"| node_platform_types
node_ecu_abstraction -->|"reads"| node_adc_driver
node_ecu_abstraction -->|"controls"| node_dio_driver
node_adc_driver -->|"drives"| node_hardware
node_dio_driver -->|"drives"| node_hardware
node_interfaces_arxml -.->|"contracts"| node_app_arxml
node_interfaces_arxml -.->|"contracts"| node_ecu_arxml
node_platform_types -.->|"types"| node_adc_driver
node_platform_types -.->|"types"| node_dio_driver

click node_composition "https://github.com/shiivamgupta/autosar-software-demo/blob/main/Composition.arxml"
click node_app_swc "https://github.com/shiivamgupta/autosar-software-demo/blob/main/ASW/ApplicationSWC.c"
click node_app_arxml "https://github.com/shiivamgupta/autosar-software-demo/blob/main/ASW/ApplicationSWC.arxml"
click node_ecu_abstraction "https://github.com/shiivamgupta/autosar-software-demo/blob/main/ECUAbstraction/EcuAbstraction.c"
click node_ecu_arxml "https://github.com/shiivamgupta/autosar-software-demo/blob/main/ECUAbstraction/EcuAbstraction_swc.arxml"
click node_interfaces_arxml "https://github.com/shiivamgupta/autosar-software-demo/blob/main/Interfaces/Interfaces.arxml"
click node_platform_types "https://github.com/shiivamgupta/autosar-software-demo/blob/main/Interfaces/PlatformTypes.arxml"
click node_adc_driver "https://github.com/shiivamgupta/autosar-software-demo/blob/main/MCAL/ADCDriver/Adc.c"
click node_dio_driver "https://github.com/shiivamgupta/autosar-software-demo/blob/main/MCAL/DIODriver/Dio.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app_swc,node_app_arxml toneBlue
class node_ecu_abstraction,node_ecu_arxml toneAmber
class node_adc_driver,node_dio_driver toneMint
class node_interfaces_arxml,node_platform_types toneRose
class node_composition toneIndigo
class node_hardware toneNeutral
```

## Components

### Application

Top-level AUTOSAR application logic

- [App SWC](https://github.com/shiivamgupta/autosar-software-demo/blob/main/ASW/ApplicationSWC.c): application component · Feature logic, kept hardware-independent · `ASW/ApplicationSWC.c`
- [App ARXML](https://github.com/shiivamgupta/autosar-software-demo/blob/main/ASW/ApplicationSWC.arxml): swc model · Component definition and port metadata · `ASW/ApplicationSWC.arxml`

### ECU Abstraction

Hardware-oriented translation layer

- [ECU Abstraction](https://github.com/shiivamgupta/autosar-software-demo/blob/main/ECUAbstraction/EcuAbstraction.c): bridge layer · Converts application intent into ECU-oriented operations · `ECUAbstraction/EcuAbstraction.c`
- [ECU ARXML](https://github.com/shiivamgupta/autosar-software-demo/blob/main/ECUAbstraction/EcuAbstraction_swc.arxml): swc model · Abstraction component configuration and ports · `ECUAbstraction/EcuAbstraction_swc.arxml`

### MCAL

Low-level microcontroller drivers

- [ADC Driver](https://github.com/shiivamgupta/autosar-software-demo/blob/main/MCAL/ADCDriver/Adc.c): mcal peripheral · Analog-to-digital conversion driver · `MCAL/ADCDriver/Adc.c`
- [DIO Driver](https://github.com/shiivamgupta/autosar-software-demo/blob/main/MCAL/DIODriver/Dio.c): mcal peripheral · Digital input/output driver · `MCAL/DIODriver/Dio.c`

### Interfaces

Shared AUTOSAR contracts and types

- [Interfaces](https://github.com/shiivamgupta/autosar-software-demo/blob/main/Interfaces/Interfaces.arxml): autsar contracts · Shared ports and communication contracts · `Interfaces/Interfaces.arxml`
- [Platform Types](https://github.com/shiivamgupta/autosar-software-demo/blob/main/Interfaces/PlatformTypes.arxml): type model · Common platform data types used across layers · `Interfaces/PlatformTypes.arxml`

### Composition

Assembly and wiring configuration

- [Composition](https://github.com/shiivamgupta/autosar-software-demo/blob/main/Composition.arxml): arxml system config · Assembles components and their AUTOSAR ports · `Composition.arxml`

### Other components

- **Hardware**: microcontroller peripherals · Physical ADC and DIO resources behind the drivers

## Connections

- Composition → App ARXML: assembles · Composition wires the application component into the system
- Composition → ECU ARXML: assembles · Composition wires the ECU abstraction component into the system
- Composition → Interfaces: uses · Composition depends on shared AUTOSAR interfaces
- App ARXML → Interfaces: requires · Application ports are defined by shared interfaces
- App ARXML → Platform Types: types · Application configuration uses shared platform types
- App SWC → ECU Abstraction: calls · Application logic invokes the abstraction layer
- ECU ARXML → Interfaces: requires · Abstraction ports are defined by shared interfaces
- ECU ARXML → Platform Types: types · Abstraction configuration uses shared platform types
- ECU Abstraction → ADC Driver: reads · Abstraction delegates sensor access to ADC
- ECU Abstraction → DIO Driver: controls · Abstraction delegates actuator or I/O control to DIO
- ADC Driver → Hardware: drives · ADC driver talks to physical peripheral registers
- DIO Driver → Hardware: drives · DIO driver talks to physical pins and registers
- Interfaces → App ARXML: contracts · Shared interface definitions constrain the application
- Interfaces → ECU ARXML: contracts · Shared interface definitions constrain the abstraction
- Platform Types → ADC Driver: types · Driver code uses common platform data types
- Platform Types → DIO Driver: types · Driver code uses common platform data types
