# zephyrproject-rtos/example-application architecture

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

- Interactive diagram: https://gitdiagram.com/zephyrproject-rtos/example-application
- Repository: https://github.com/zephyrproject-rtos/example-application

## Overview

##### Main Components

a) Application Layer
- Main application code (/app)
- Board-specific configurations
- Custom configurations (prj.conf, debug.conf)

b) Driver Layer
- Custom LED driver (drivers/blink)
- Custom sensor driver (drivers/sensor/example_sensor)
- Device Tree bindings (dts/bindings)

c) Library Layer
- Custom library implementation (lib/custom)
- Headers (include/app)

d) Testing Framework
- Test cases (tests/lib)
- Integration tests

e) Build & Tools Layer
- West extension (scripts/example_west_command.py)
- Custom runner (scripts/example_runner.py)
- CMake build system
- Documentation generation

**┌─────────────────────────────────────────────────────┐**
- Application Layer                   │
- ┌─────────────┐ ┌────────────┐ ┌───────────────┐  │
- App Core  │ │   Boards   │ │ Configuration │  │
- ┘ └────────────┘ └───────────────┘  │
- ┤
- Driver Layer                       │
- ┌─────────────┐ ┌────────────┐ ┌───────────────┐  │
- LED Driver  │ │   Sensor   │ │  DTS Bindings │  │
- ┘ └────────────┘ └───────────────┘  │
- ┤
- Library Layer                      │
- ┌─────────────────────┐ ┌───────────────────────┐  │
- Custom Library   │ │     Include Headers    │  │
- ┘ └───────────────────────┘  │
- ┤
- Zephyr RTOS Core                    │
- ┘

##### Additional Elements

- Version information (from app/VERSION)
- Documentation generation flow
- CI/CD integration points

##### Relationships to Emphasize

- How custom drivers interact with the Zephyr RTOS
- How the application uses custom libraries
- How board configurations affect the system
- How West extensions integrate with the build system

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and classes
    classDef app fill:#b3d1ff,stroke:#333
    classDef driver fill:#90EE90,stroke:#333
    classDef lib fill:#FFE5B4,stroke:#333
    classDef build fill:#D3D3D3,stroke:#333
    classDef core fill:#E6E6FA,stroke:#333
    classDef test fill:#FFC0CB,stroke:#333

    %% Application Layer
    subgraph AppLayer["Application Layer"]
        AppCore["Application Core"]:::app
        BoardConfig["Board Configuration"]:::app
        AppConfig["Application Configuration"]:::app
    end

    %% Driver Layer
    subgraph DriverLayer["Driver Layer"]
        LEDDriver["LED Driver"]:::driver
        SensorDriver["Sensor Driver"]:::driver
        DTSBindings["Device Tree Bindings"]:::driver
    end

    %% Library Layer
    subgraph LibLayer["Library Layer"]
        CustomLib["Custom Library"]:::lib
        IncludeHeaders["Include Headers"]:::lib
    end

    %% Testing Layer
    subgraph TestLayer["Testing Framework"]
        TestFramework["Test Framework"]:::test
        IntegrationTests["Integration Tests"]:::test
    end

    %% Build & Tools Layer
    subgraph BuildLayer["Build & Tools Layer"]
        WestExt["West Extension"]:::build
        CustomRunner["Custom Runner"]:::build
        CMakeBuild["CMake Build System"]:::build
        DocGen["Documentation"]:::build
        CICD["CI/CD Pipeline"]:::build
    end

    %% Core Layer
    ZephyrRTOS["Zephyr RTOS Core"]:::core

    %% Relationships
    AppCore --> LEDDriver
    AppCore --> SensorDriver
    AppCore --> CustomLib
    BoardConfig --> DTSBindings
    AppConfig --> CMakeBuild
    LEDDriver --> DTSBindings
    SensorDriver --> DTSBindings
    CustomLib --> IncludeHeaders
    TestFramework --> CustomLib
    WestExt --> CMakeBuild
    CustomRunner --> CMakeBuild
    CMakeBuild --> ZephyrRTOS
    DTSBindings --> ZephyrRTOS
    CICD --> CMakeBuild

    %% Click events
    click AppCore "https://github.com/zephyrproject-rtos/example-application/blob/main/app/src/main.c"
    click BoardConfig "https://github.com/zephyrproject-rtos/example-application/blob/main/app/boards/nucleo_f302r8.overlay"
    click AppConfig "https://github.com/zephyrproject-rtos/example-application/blob/main/app/prj.conf"
    click LEDDriver "https://github.com/zephyrproject-rtos/example-application/blob/main/drivers/blink/gpio_led.c"
    click SensorDriver "https://github.com/zephyrproject-rtos/example-application/blob/main/drivers/sensor/example_sensor/example_sensor.c"
    click DTSBindings "https://github.com/zephyrproject-rtos/example-application/tree/main/dts/bindings"
    click CustomLib "https://github.com/zephyrproject-rtos/example-application/blob/main/lib/custom/custom.c"
    click IncludeHeaders "https://github.com/zephyrproject-rtos/example-application/tree/main/include/app"
    click TestFramework "https://github.com/zephyrproject-rtos/example-application/tree/main/tests/lib/custom"
    click WestExt "https://github.com/zephyrproject-rtos/example-application/blob/main/scripts/example_west_command.py"
    click CustomRunner "https://github.com/zephyrproject-rtos/example-application/blob/main/scripts/example_runner.py"
    click DocGen "https://github.com/zephyrproject-rtos/example-application/tree/main/doc"
    click CMakeBuild "https://github.com/zephyrproject-rtos/example-application/blob/main/CMakeLists.txt"
    click CICD "https://github.com/zephyrproject-rtos/example-application/blob/main/.github/workflows/build.yml"
```
