# contiki-os/contiki architecture

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

- Interactive diagram: https://gitdiagram.com/contiki-os/contiki
- Repository: https://github.com/contiki-os/contiki

## Overview

Contiki is an operating system for small, low-power microcontrollers. Its principal workflow is board startup, cooperative process execution, and wireless/network communication for applications; the repository also supplies protocol services, storage, and dynamic loading. The graph emphasizes runtime subsystems and documented protocol capabilities. Some networking and kernel internals are represented at directory level because the sampled excerpts do not establish their detailed call paths.

Main entry points: [`apps/oma-lwm2m/lwm2m-engine.c`](https://github.com/contiki-os/contiki/blob/master/apps/oma-lwm2m/lwm2m-engine.c) (LwM2M engine), [`core/net/netstack.c`](https://github.com/contiki-os/contiki/blob/master/core/net/netstack.c) (Network stack setup), [`platform/econotag/main.c`](https://github.com/contiki-os/contiki/blob/master/platform/econotag/main.c) (Platform startup), [`apps/er-coap/er-coap-engine.c`](https://github.com/contiki-os/contiki/blob/master/apps/er-coap/er-coap-engine.c) (CoAP engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["OS runtime"]
  node_processes["Process scheduler<br/>[process.c]"]
  node_timers["Timer services<br/>[ctimer.c]"]
  node_loader["Dynamic loaders"]
end

subgraph group_network["Networking"]
  node_netstack["Network stack setup<br/>[netstack.c]"]
  node_networking["IP networking"]
  node_ipv6["IPv6 networking"]
  node_rpl["RPL routing<br/>[rpl.c]"]
  node_mac["MAC and radio links"]
  node_rime["Rime protocols"]
end

subgraph group_services["Application services"]
  node_coap["CoAP engine<br/>[er-coap-engine.c]"]
  node_rest["REST dispatch<br/>[rest-engine.c]"]
  node_lwm2m["LwM2M engine<br/>[lwm2m-engine.c]"]
  node_objects["LwM2M objects<br/>[lwm2m-object.h]"]
  node_tlv["LwM2M TLV encoding<br/>[oma-tlv.c]"]
  node_webserver["Embedded web servers"]
  node_webclient["Web client<br/>[webclient.c]"]
  node_antelope["Antelope database"]
end

subgraph group_platform["Hardware and storage"]
  node_board["Platform startup<br/>[main.c]"]
  node_storage[("CFS storage")]
  node_radio["Radio drivers"]
end

node_hardware(("Microcontroller hardware"))

node_board -->|"initializes"| node_netstack
node_board -->|"runs"| node_processes
node_netstack -.->|"configures"| node_networking
node_netstack -.->|"configures"| node_ipv6
node_hardware -.->|"provides platform"| node_board
node_radio -.->|"provides link"| node_mac
node_lwm2m -->|"uses"| node_objects
node_lwm2m -->|"uses"| node_rest
node_lwm2m -->|"uses"| node_coap
node_lwm2m -->|"uses"| node_tlv
node_coap -->|"dispatches services"| node_rest
node_antelope -->|"persists data"| node_storage
node_webclient -->|"uses network APIs"| node_networking

click node_board "https://github.com/contiki-os/contiki/blob/master/platform/econotag/main.c"
click node_netstack "https://github.com/contiki-os/contiki/blob/master/core/net/netstack.c"
click node_processes "https://github.com/contiki-os/contiki/blob/master/core/sys/process.c"
click node_timers "https://github.com/contiki-os/contiki/blob/master/core/sys/ctimer.c"
click node_networking "https://github.com/contiki-os/contiki/tree/master/core/net/ip"
click node_ipv6 "https://github.com/contiki-os/contiki/tree/master/core/net/ipv6"
click node_rpl "https://github.com/contiki-os/contiki/blob/master/core/net/rpl/rpl.c"
click node_mac "https://github.com/contiki-os/contiki/tree/master/core/net/mac"
click node_rime "https://github.com/contiki-os/contiki/tree/master/core/net/rime"
click node_coap "https://github.com/contiki-os/contiki/blob/master/apps/er-coap/er-coap-engine.c"
click node_rest "https://github.com/contiki-os/contiki/blob/master/apps/rest-engine/rest-engine.c"
click node_lwm2m "https://github.com/contiki-os/contiki/blob/master/apps/oma-lwm2m/lwm2m-engine.c"
click node_objects "https://github.com/contiki-os/contiki/blob/master/apps/oma-lwm2m/lwm2m-object.h"
click node_tlv "https://github.com/contiki-os/contiki/blob/master/apps/oma-lwm2m/oma-tlv.c"
click node_webserver "https://github.com/contiki-os/contiki/tree/master/apps/webserver"
click node_webclient "https://github.com/contiki-os/contiki/blob/master/apps/webbrowser/webclient.c"
click node_antelope "https://github.com/contiki-os/contiki/tree/master/apps/antelope"
click node_storage "https://github.com/contiki-os/contiki/tree/master/core/cfs"
click node_loader "https://github.com/contiki-os/contiki/tree/master/core/loader"
click node_radio "https://github.com/contiki-os/contiki/tree/master/dev"

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_processes,node_timers,node_loader toneBlue
class node_netstack,node_networking,node_ipv6,node_rpl,node_mac,node_rime toneAmber
class node_coap,node_rest,node_lwm2m,node_objects,node_tlv,node_webserver,node_webclient,node_antelope toneMint
class node_board,node_storage,node_radio toneRose
class node_hardware toneIndigo
```

## Components

### OS runtime

- [Process scheduler](https://github.com/contiki-os/contiki/blob/master/core/sys/process.c): `core/sys/process.c`
- [Timer services](https://github.com/contiki-os/contiki/blob/master/core/sys/ctimer.c): `core/sys/ctimer.c`
- [Dynamic loaders](https://github.com/contiki-os/contiki/tree/master/core/loader): `core/loader`

### Networking

- [Network stack setup](https://github.com/contiki-os/contiki/blob/master/core/net/netstack.c): `core/net/netstack.c`
- [IP networking](https://github.com/contiki-os/contiki/tree/master/core/net/ip): `core/net/ip`
- [IPv6 networking](https://github.com/contiki-os/contiki/tree/master/core/net/ipv6): `core/net/ipv6`
- [RPL routing](https://github.com/contiki-os/contiki/blob/master/core/net/rpl/rpl.c): `core/net/rpl/rpl.c`
- [MAC and radio links](https://github.com/contiki-os/contiki/tree/master/core/net/mac): `core/net/mac`
- [Rime protocols](https://github.com/contiki-os/contiki/tree/master/core/net/rime): `core/net/rime`

### Application services

- [CoAP engine](https://github.com/contiki-os/contiki/blob/master/apps/er-coap/er-coap-engine.c): `apps/er-coap/er-coap-engine.c`
- [REST dispatch](https://github.com/contiki-os/contiki/blob/master/apps/rest-engine/rest-engine.c): `apps/rest-engine/rest-engine.c`
- [LwM2M engine](https://github.com/contiki-os/contiki/blob/master/apps/oma-lwm2m/lwm2m-engine.c): `apps/oma-lwm2m/lwm2m-engine.c`
- [LwM2M objects](https://github.com/contiki-os/contiki/blob/master/apps/oma-lwm2m/lwm2m-object.h): `apps/oma-lwm2m/lwm2m-object.h`
- [LwM2M TLV encoding](https://github.com/contiki-os/contiki/blob/master/apps/oma-lwm2m/oma-tlv.c): `apps/oma-lwm2m/oma-tlv.c`
- [Embedded web servers](https://github.com/contiki-os/contiki/tree/master/apps/webserver): `apps/webserver`
- [Web client](https://github.com/contiki-os/contiki/blob/master/apps/webbrowser/webclient.c): `apps/webbrowser/webclient.c`
- [Antelope database](https://github.com/contiki-os/contiki/tree/master/apps/antelope): `apps/antelope`

### Hardware and storage

- [Platform startup](https://github.com/contiki-os/contiki/blob/master/platform/econotag/main.c): `platform/econotag/main.c`
- [CFS storage](https://github.com/contiki-os/contiki/tree/master/core/cfs): `core/cfs`
- [Radio drivers](https://github.com/contiki-os/contiki/tree/master/dev): `dev`

### Other components

- **Microcontroller hardware**

## Connections

- Platform startup → Network stack setup: initializes (evidence: `platform/econotag/main.c`)
- Platform startup → Process scheduler: runs (evidence: `platform/econotag/main.c`)
- Network stack setup → IP networking: configures
- Network stack setup → IPv6 networking: configures
- Microcontroller hardware → Platform startup: provides platform
- Radio drivers → MAC and radio links: provides link
- LwM2M engine → LwM2M objects: uses (evidence: `apps/oma-lwm2m/lwm2m-engine.c`)
- LwM2M engine → REST dispatch: uses (evidence: `apps/oma-lwm2m/lwm2m-engine.c`)
- LwM2M engine → CoAP engine: uses (evidence: `apps/oma-lwm2m/lwm2m-engine.c`)
- LwM2M engine → LwM2M TLV encoding: uses (evidence: `apps/oma-lwm2m/lwm2m-engine.c`)
- CoAP engine → REST dispatch: dispatches services (evidence: `apps/er-coap/er-coap-engine.c`)
- Antelope database → CFS storage: persists data (evidence: `apps/antelope/storage-cfs.c`)
- Web client → IP networking: uses network APIs (evidence: `apps/webbrowser/webclient.c`)
