# varigit/zephyr architecture

> Architecture diagram of the GitHub repository varigit/zephyr, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/varigit/zephyr
- Repository: https://github.com/varigit/zephyr

## Overview

Zephyr is a scalable, small-footprint real-time operating system for resource-constrained devices. Its main workflow is an application running on a supported board, with architecture-specific code providing the hardware-facing runtime. The tree also shows product subsystems for device drivers, Bluetooth, LwM2M networking, secure storage, and firmware updating. The README documents the OS, supported architectures, and boards; source excerpts show selected subsystem behavior. Several subsystem links are intentionally dashed because their callers or wiring were not shown.

Main entry points: [`boards/native/native_posix/main.c`](https://github.com/varigit/zephyr/blob/v4.0-branch_var01/boards/native/native_posix/main.c) (Native POSIX runtime), [`drivers`](https://github.com/varigit/zephyr/tree/v4.0-branch_var01/drivers) (Device drivers), [`subsys/net/lib/lwm2m/lwm2m_engine.c`](https://github.com/varigit/zephyr/blob/v4.0-branch_var01/subsys/net/lib/lwm2m/lwm2m_engine.c) (LwM2M engine), [`boards`](https://github.com/varigit/zephyr/tree/v4.0-branch_var01/boards) (Board support)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_platform["Platform runtime"]
  node_zephyr["Zephyr RTOS"]
  node_arch["Architecture support"]
  node_boards["Board support"]
  node_native["Native POSIX runtime<br/>[main.c]"]
end

subgraph group_drivers["Device drivers"]
  node_driver_api["Device drivers"]
  node_nvme["NVMe controller<br/>[nvme_controller.c]"]
  node_stepper["TMC5041 stepper"]
end

subgraph group_connectivity["Connectivity"]
  node_media["Bluetooth media control<br/>[media_controller.c]"]
  node_ots["Bluetooth object transfer<br/>[ots_obj_manager.c]"]
  node_lwm2m["LwM2M engine<br/>[lwm2m_engine.c]"]
  node_lwm_model["LwM2M object model<br/>[lwm2m_object.h]"]
  node_lwm_codec["LwM2M data formats"]
end

subgraph group_services["System services"]
  node_secure_api["PSA storage APIs"]
  node_secure_its["Trusted storage internals<br/>[its.h]"]
  node_update_storage["Update image storage"]
  node_flash_image["Flash image service"]
end

node_developer(("Application user"))

node_developer -->|"runs applications"| node_zephyr
node_zephyr -->|"supports architectures"| node_arch
node_zephyr -->|"targets boards"| node_boards
node_boards -.->|"includes runtime"| node_native
node_native -->|"boots CPU"| node_zephyr
node_native -->|"initializes hardware models"| node_boards
node_zephyr -.->|"offers drivers"| node_driver_api
node_driver_api -.->|"includes controller"| node_nvme
node_driver_api -.->|"includes controller"| node_stepper
node_zephyr -.->|"offers Bluetooth features"| node_media
node_zephyr -.->|"offers object transfer"| node_ots
node_zephyr -.->|"offers LwM2M"| node_lwm2m
node_lwm2m -.->|"uses object definitions"| node_lwm_model
node_lwm2m -.->|"uses data formats"| node_lwm_codec
node_zephyr -.->|"offers secure storage"| node_secure_api
node_secure_api -->|"delegates ITS calls"| node_secure_its
node_zephyr -.->|"offers firmware updates"| node_update_storage
node_update_storage -->|"uses image storage context"| node_flash_image

click node_arch "https://github.com/varigit/zephyr/tree/v4.0-branch_var01/arch"
click node_boards "https://github.com/varigit/zephyr/tree/v4.0-branch_var01/boards"
click node_native "https://github.com/varigit/zephyr/blob/v4.0-branch_var01/boards/native/native_posix/main.c"
click node_driver_api "https://github.com/varigit/zephyr/tree/v4.0-branch_var01/drivers"
click node_nvme "https://github.com/varigit/zephyr/blob/v4.0-branch_var01/drivers/disk/nvme/nvme_controller.c"
click node_stepper "https://github.com/varigit/zephyr/blob/v4.0-branch_var01/drivers/stepper/adi_tmc/adi_tmc5041_stepper_controller.c"
click node_media "https://github.com/varigit/zephyr/blob/v4.0-branch_var01/subsys/bluetooth/audio/shell/media_controller.c"
click node_ots "https://github.com/varigit/zephyr/blob/v4.0-branch_var01/subsys/bluetooth/services/ots/ots_obj_manager.c"
click node_lwm2m "https://github.com/varigit/zephyr/blob/v4.0-branch_var01/subsys/net/lib/lwm2m/lwm2m_engine.c"
click node_lwm_model "https://github.com/varigit/zephyr/blob/v4.0-branch_var01/subsys/net/lib/lwm2m/lwm2m_object.h"
click node_lwm_codec "https://github.com/varigit/zephyr/tree/v4.0-branch_var01/subsys/net/lib/lwm2m"
click node_secure_api "https://github.com/varigit/zephyr/blob/v4.0-branch_var01/subsys/secure_storage/include/psa/protected_storage.h"
click node_secure_its "https://github.com/varigit/zephyr/blob/v4.0-branch_var01/subsys/secure_storage/include/internal/zephyr/secure_storage/its.h"
click node_update_storage "https://github.com/varigit/zephyr/blob/v4.0-branch_var01/subsys/mgmt/updatehub/updatehub_storage.c"
click node_flash_image "https://github.com/varigit/zephyr/blob/v4.0-branch_var01/subsys/mgmt/updatehub/updatehub_storage.h"

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_zephyr,node_arch,node_boards,node_native,node_developer toneBlue
class node_driver_api,node_nvme,node_stepper toneAmber
class node_media,node_ots,node_lwm2m,node_lwm_model,node_lwm_codec toneMint
class node_secure_api,node_secure_its,node_update_storage,node_flash_image toneRose
```

## Components

### Platform runtime

- **Zephyr RTOS**
- [Architecture support](https://github.com/varigit/zephyr/tree/v4.0-branch_var01/arch): `arch`
- [Board support](https://github.com/varigit/zephyr/tree/v4.0-branch_var01/boards): `boards`
- [Native POSIX runtime](https://github.com/varigit/zephyr/blob/v4.0-branch_var01/boards/native/native_posix/main.c): `boards/native/native_posix/main.c`

### Device drivers

- [Device drivers](https://github.com/varigit/zephyr/tree/v4.0-branch_var01/drivers): `drivers`
- [NVMe controller](https://github.com/varigit/zephyr/blob/v4.0-branch_var01/drivers/disk/nvme/nvme_controller.c): `drivers/disk/nvme/nvme_controller.c`
- [TMC5041 stepper](https://github.com/varigit/zephyr/blob/v4.0-branch_var01/drivers/stepper/adi_tmc/adi_tmc5041_stepper_controller.c): `drivers/stepper/adi_tmc/adi_tmc5041_stepper_controller.c`

### Connectivity

- [Bluetooth media control](https://github.com/varigit/zephyr/blob/v4.0-branch_var01/subsys/bluetooth/audio/shell/media_controller.c): `subsys/bluetooth/audio/shell/media_controller.c`
- [Bluetooth object transfer](https://github.com/varigit/zephyr/blob/v4.0-branch_var01/subsys/bluetooth/services/ots/ots_obj_manager.c): `subsys/bluetooth/services/ots/ots_obj_manager.c`
- [LwM2M engine](https://github.com/varigit/zephyr/blob/v4.0-branch_var01/subsys/net/lib/lwm2m/lwm2m_engine.c): `subsys/net/lib/lwm2m/lwm2m_engine.c`
- [LwM2M object model](https://github.com/varigit/zephyr/blob/v4.0-branch_var01/subsys/net/lib/lwm2m/lwm2m_object.h): `subsys/net/lib/lwm2m/lwm2m_object.h`
- [LwM2M data formats](https://github.com/varigit/zephyr/tree/v4.0-branch_var01/subsys/net/lib/lwm2m): `subsys/net/lib/lwm2m`

### System services

- [PSA storage APIs](https://github.com/varigit/zephyr/blob/v4.0-branch_var01/subsys/secure_storage/include/psa/protected_storage.h): `subsys/secure_storage/include/psa/protected_storage.h`
- [Trusted storage internals](https://github.com/varigit/zephyr/blob/v4.0-branch_var01/subsys/secure_storage/include/internal/zephyr/secure_storage/its.h): `subsys/secure_storage/include/internal/zephyr/secure_storage/its.h`
- [Update image storage](https://github.com/varigit/zephyr/blob/v4.0-branch_var01/subsys/mgmt/updatehub/updatehub_storage.c): `subsys/mgmt/updatehub/updatehub_storage.c`
- [Flash image service](https://github.com/varigit/zephyr/blob/v4.0-branch_var01/subsys/mgmt/updatehub/updatehub_storage.h): `subsys/mgmt/updatehub/updatehub_storage.h`

### Other components

- **Application user**

## Connections

- Application user → Zephyr RTOS: runs applications
- Zephyr RTOS → Architecture support: supports architectures
- Zephyr RTOS → Board support: targets boards
- Board support → Native POSIX runtime: includes runtime (evidence: `boards/native/native_posix/main.c`)
- Native POSIX runtime → Zephyr RTOS: boots CPU (evidence: `boards/native/native_posix/main.c`)
- Native POSIX runtime → Board support: initializes hardware models (evidence: `boards/native/native_posix/main.c`)
- Zephyr RTOS → Device drivers: offers drivers
- Device drivers → NVMe controller: includes controller (evidence: `drivers/disk/nvme/nvme_controller.c`)
- Device drivers → TMC5041 stepper: includes controller (evidence: `drivers/stepper/adi_tmc/adi_tmc5041_stepper_controller.c`)
- Zephyr RTOS → Bluetooth media control: offers Bluetooth features
- Zephyr RTOS → Bluetooth object transfer: offers object transfer
- Zephyr RTOS → LwM2M engine: offers LwM2M
- LwM2M engine → LwM2M object model: uses object definitions (evidence: `subsys/net/lib/lwm2m/lwm2m_engine.c`)
- LwM2M engine → LwM2M data formats: uses data formats (evidence: `subsys/net/lib/lwm2m/lwm2m_engine.c`)
- Zephyr RTOS → PSA storage APIs: offers secure storage
- PSA storage APIs → Trusted storage internals: delegates ITS calls (evidence: `subsys/secure_storage/include/psa/protected_storage.h`)
- Zephyr RTOS → Update image storage: offers firmware updates
- Update image storage → Flash image service: uses image storage context (evidence: `subsys/mgmt/updatehub/updatehub_storage.c`)
