# openautosar/classic-platform architecture

> Architecture diagram of the GitHub repository openautosar/classic-platform, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/openautosar/classic-platform
- Repository: https://github.com/openautosar/classic-platform

## Overview

##### Project Type and Purpose
- This is an embedded AUTOSAR Basic Software (BSW) platform (a fork of Arctic Core 3.1).
- It provides a complete AUTOSAR stack: from Microcontroller Abstraction Layer (MCAL) through ECU Abstraction, Services, Communication, Diagnostics, OS and RTE to the application.

##### File‐Structure Analysis
- Top‐level layers:
- Peripherals & arch: low-level hardware abstraction (MCAL stubs & real drivers)
- drivers/: MCU peripheral drivers (CAN, Flash, Wdg, etc.)
- memory/: EEPROM/Flash abstraction (Ea, Fee, NvM, etc.)
- communication/: AUTOSAR COM stack (CanIf, PduR, Com, TcpIp, SoAd, DoIP, etc.)
- diagnostic/: DEM, DCM, DET, DLT, FiM
- system/: system services (EcuM, Os, BswM, SchM, StbM, Cpl, Cal, LinuxOs port, Rtos)
- safety_security/: safety libraries (SafeLib, WdgIf, WdgM)
- common, clib, datastructures, testCommon: utility & test scaffolding
- lwip-2.0.3: third-party TCP/IP port used by TcpIp/SoAd/DoIP
- /, integration/: RTE memory maps, common types, RTE headers
- scripts/: build, toolchain, code generation, docs

##### README Insights
- Confirms this is an open-source AUTOSAR BSW platform replacing proprietary Arctic Core.

a. Main Components (Arrange vertically by abstraction level)
1. Hardware Layer
– Physical ECU: CPU, buses, transceivers, I/O ports (arch/, Peripherals/)
2. Microcontroller Abstraction Layer (MCAL)
– drivers/ (CanTrcv, Eep, Fls, Fr, Wdg, If, etc.)
3. ECU Abstraction & I/O Hardware Abstraction
– Peripherals/IoHwAb
– boards/ (board-specific configs)
4. Services Layer (BSW Services)
– memory/ (Ea, Fee, MemIf, NvM, RamTst)
– system/Cal, Cpl (crypto), StbM, SchM
– safety_security/SafeLib, WdgIf, WdgM
5. Communication & Network Management
– communication/*: CanIf, CanTp, PduR, Com, ComM, SoAd, DoIP, TcpIp, EthIf, EthSM, EthTSyn, LinIf/LinTp, FrIf/FrTp, J1939Tp, UdpNm, Xcp, SD, SecOC
– lwip-2.0.3 (stack used by TcpIp, SoAd)
6. Diagnostic & DLT
– diagnostic/Dem, Dcm, Det, Dlt, FiM
7. System Manager & ECU Manager
– system/EcuM, system/BswM
8. Operating System & RTE
– system/Os: OSAL (Linux, generic), RTOS kernel, integration, conformance to AUTOSAR OS
– include/rte, integration/MemMap.h (RTE memory mapping)
– common/tcf, shell, console (debug access)
9. Application Layer (not included here – user code sits on top of RTE)

b. Relationships & Data Flows
– Hardware ↔ MCAL drivers: control and status registers
– MCAL ↔ ECU Abstraction: uniform APIs for higher layers
– Services modules consume ECU Abstraction for memory, timing, watchdog
– Communication modules: data flow from Com → PduR → lower-If → driver → bus
– Diagnostic modules hook into Communication and Services (Dem reports faults, Dcm processes requests over DoIP or CAN)
– OS schedules all modules; SchM enforces statistics and locking protocols
– RTE dispatches calls from application to BSW modules

c. Architectural Patterns & Principles
– Layered architecture (MCAL, ECU Abstraction, Services, Communication, Diagnostics, OS, RTE)
– Memory and timing determinism (static configs under boards/, scripts/)
– Separation of concerns: safety/security libs separate from functional COM stack
– Hardware independence: board-specific configs under boards/, generic code under arch/ and drivers/

d. Key Technologies & Frameworks
– GNU Make & custom makefile modules (mod.mk)
– Third-party lwIP TCP/IP stack
– Python, shell scripts for code generation & MemMap injection
– Trace32, PLS UDE integration for debugging
– AUTOSAR OS, RTE, MemMap, BswM, EcuM services

##### Essential Elements to Capture
– Board-to-MCAL boundary (real vs. stubbed drivers)
– MCAL → ECU Abstraction → Service APIs
– PduR central router between upper (Com, Dcm, SoAd) and lower (CanIf, EthIf, LinIf, FrIf) layers
– Dcm ↔ DoIP/CanTp for network diagnostic
– EcuM for system initialization & shutdown
– Os for task scheduling, alarms, resources
– RTE as the glue for application components (shown as a layer above OS)
– Third-party code in lwIP used by TCP/IP-based modules

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Hardware Layer
    subgraph "Hardware Layer"
        Arch["arch/"]:::blue
    end

    %% MCAL Drivers
    subgraph "MCAL Drivers"
        Drivers["drivers/"]:::blue
    end

    %% ECU Abstraction & I/O Hardware Abstraction
    subgraph "ECU Abstraction & I/O"
        IoHwAb["Peripherals/IoHwAb/"]:::blue
    end

    %% BSW Services & System
    subgraph "BSW Services & System"
        Memory["memory/"]:::green
        Cal["system/Cal/"]:::green
        Cpl["system/Cpl/"]:::green
        SafeLib["safety_security/SafeLib/"]:::green
        WdgIf["safety_security/WdgIf/"]:::green
        WdgM["safety_security/WdgM/"]:::green
        EcuM["system/EcuM/"]:::green
        BswM["system/BswM/"]:::green
        SchM["system/SchM/"]:::green
        StbM["system/StbM/"]:::green
    end

    %% Communication & Network Management
    subgraph "Communication & Network"
        ComStack["communication/"]:::orange
        lwIP["lwip-2.0.3"]:::gray
    end

    %% Diagnostics
    subgraph "Diagnostics & DLT"
        Dem["diagnostic/Dem/"]:::orange
        Dcm["diagnostic/Dcm/"]:::orange
        Det["diagnostic/Det/"]:::orange
        Dlt["diagnostic/Dlt/"]:::orange
        FiM["diagnostic/FiM/"]:::orange
    end

    %% OS & RTE
    subgraph "Operating System & RTE"
        OS["system/Os/"]:::yellow
        LinuxOs["system/LinuxOs/"]:::yellow
        RTE["include/rte/"]:::yellow
        MemMap["integration/MemMap.h"]:::yellow
    end

    %% Tools & Scripts
    subgraph "Tools & Scripts"
        Scripts["scripts/"]:::gray
        PLS["tools/pls/"]:::gray
        T32["tools/t32/"]:::gray
        TCF["common/tcf/"]:::gray
        Shell["common/shell.c"]:::gray
    end

    %% Relationships
    Arch -->|hardware abstraction| Drivers
    Drivers -->|MCAL API| IoHwAb
    IoHwAb -->|HW Abstraction| Memory
    Memory -->|service usage| Cal
    Cal -->|cryptographic services| Cpl
    Cpl -->|safety functions| SafeLib
    SafeLib -->|watchdog interface| WdgIf
    WdgIf -->|watchdog manager| WdgM
    WdgM -->|system init| EcuM
    EcuM -->|mode control| BswM
    BswM -->|scheduling| SchM
    SchM -->|stability| StbM
    StbM -->|network mgmt| ComStack
    ComStack -->|uses lwIP| lwIP
    ComStack -->|fault reporting| Dem
    Dem -->|diagnostic requests| Dcm
    Dcm -->|error detection| Det
    Dcm -->|logging| Dlt
    Dlt -->|status monitoring| FiM
    OS -->|schedules tasks| Drivers
    OS -->|scheduling| ComStack
    RTE -->|dispatches| Cal
    RTE -->|memory maps| MemMap
    Scripts -->|build system| Drivers
    Scripts -->|code generation| RTE
    PLS -->|debug integration| LinuxOs
    T32 -->|trace support| LinuxOs
    TCF -->|console| Shell

    %% Click Events
    click Arch "https://github.com/openautosar/classic-platform/tree/master/arch/"
    click Drivers "https://github.com/openautosar/classic-platform/tree/master/drivers/"
    click IoHwAb "https://github.com/openautosar/classic-platform/tree/master/Peripherals/IoHwAb/"
    click Memory "https://github.com/openautosar/classic-platform/tree/master/memory/"
    click Cal "https://github.com/openautosar/classic-platform/tree/master/system/Cal/"
    click Cpl "https://github.com/openautosar/classic-platform/tree/master/system/Cpl/"
    click SafeLib "https://github.com/openautosar/classic-platform/tree/master/safety_security/SafeLib/"
    click WdgIf "https://github.com/openautosar/classic-platform/tree/master/safety_security/WdgIf/"
    click WdgM "https://github.com/openautosar/classic-platform/tree/master/safety_security/WdgM/"
    click ComStack "https://github.com/openautosar/classic-platform/tree/master/communication/"
    click lwIP "https://github.com/openautosar/classic-platform/tree/master/communication/lwip-2.0.3/"
    click Dem "https://github.com/openautosar/classic-platform/tree/master/diagnostic/Dem/"
    click Dcm "https://github.com/openautosar/classic-platform/tree/master/diagnostic/Dcm/"
    click Det "https://github.com/openautosar/classic-platform/tree/master/diagnostic/Det/"
    click Dlt "https://github.com/openautosar/classic-platform/tree/master/diagnostic/Dlt/"
    click FiM "https://github.com/openautosar/classic-platform/tree/master/diagnostic/FiM/"
    click EcuM "https://github.com/openautosar/classic-platform/tree/master/system/EcuM/"
    click BswM "https://github.com/openautosar/classic-platform/tree/master/system/BswM/"
    click SchM "https://github.com/openautosar/classic-platform/tree/master/system/SchM/"
    click StbM "https://github.com/openautosar/classic-platform/tree/master/system/StbM/"
    click OS "https://github.com/openautosar/classic-platform/tree/master/system/Os/"
    click LinuxOs "https://github.com/openautosar/classic-platform/tree/master/system/LinuxOs/"
    click RTE "https://github.com/openautosar/classic-platform/tree/master/include/rte/"
    click MemMap "https://github.com/openautosar/classic-platform/blob/master/integration/MemMap.h"
    click Scripts "https://github.com/openautosar/classic-platform/tree/master/scripts/"
    click PLS "https://github.com/openautosar/classic-platform/tree/master/tools/pls/"
    click T32 "https://github.com/openautosar/classic-platform/tree/master/tools/t32/"
    click TCF "https://github.com/openautosar/classic-platform/tree/master/common/tcf/"
    click Shell "https://github.com/openautosar/classic-platform/blob/master/common/shell.c"

    %% Styles
    classDef blue fill:#e0f7fa,stroke:#006064,color:#006064;
    classDef green fill:#e8f5e9,stroke:#2e7d32,color:#2e7d32;
    classDef orange fill:#fff3e0,stroke:#ef6c00,color:#ef6c00;
    classDef yellow fill:#fffde7,stroke:#f9a825,color:#f9a825;
    classDef gray fill:#eceff1,stroke:#607d8b,color:#607d8b;
```
