# rtlabs-com/c-open architecture

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

- Interactive diagram: https://gitdiagram.com/rtlabs-com/c-open
- Repository: https://github.com/rtlabs-com/c-open

## Overview

C-Open is an embedded C CANopen stack for master and slave nodes. An application uses its public API to configure and operate a network; the stack communicates over a platform CAN channel and implements CANopen services including object-dictionary access, SDO transfers, PDO process data, NMT, synchronization, and monitoring. The source index shows the core modules and their references, but sampled excerpts do not expose the complete runtime dispatch path, so those connections are shown as unverified. The evaluation README says this version omits ports, although port implementations are present in the tree.

Main entry points: [`src/co_main.c`](https://github.com/rtlabs-com/c-open/blob/public/src/co_main.c) (Network Runtime), [`src/coal_can.h`](https://github.com/rtlabs-com/c-open/blob/public/src/coal_can.h) (CAN Abstraction), [`src/co_pdo.c`](https://github.com/rtlabs-com/c-open/blob/public/src/co_pdo.c) (PDO Process Data), [`include/co_api.h`](https://github.com/rtlabs-com/c-open/blob/public/include/co_api.h) (Public API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Application API"]
  node_api["Public API<br/>[co_api.h]"]
  node_objects["Object Descriptors<br/>[co_obj.h]"]
end

subgraph group_core["Stack Core"]
  node_runtime["Network Runtime<br/>[co_main.c]"]
  node_runtime_types["Runtime State<br/>[co_main.h]"]
  node_object_dictionary[("Object Dictionary<br/>[co_od.c]")]
  node_object_helpers["Dictionary Helpers<br/>[co_obj.c]"]
  node_bitmap["Bitmap Utility<br/>[co_bitmap.c]"]
end

subgraph group_services["CANopen Services"]
  node_sdo_client["SDO Client<br/>[co_sdo_client.c]"]
  node_sdo_server["SDO Server<br/>[co_sdo_server.c]"]
  node_pdo["PDO Process Data<br/>[co_pdo.c]"]
  node_nmt["NMT State Machine<br/>[co_nmt.c]"]
  node_sync["SYNC<br/>[co_sync.c]"]
  node_emcy["Emergency Handling<br/>[co_emcy.c]"]
  node_heartbeat["Heartbeat<br/>[co_heartbeat.c]"]
  node_node_guard["Node Guarding<br/>[co_node_guard.c]"]
  node_lss["Layer Setting Services<br/>[co_lss.c]"]
end

subgraph group_platform["CAN Platform"]
  node_can_interface["CAN Abstraction<br/>[coal_can.h]"]
  node_linux_can["Linux CAN Port<br/>[coal_can.c]"]
  node_rtk_can["RT-Kernel CAN Port<br/>[coal_can.c]"]
  node_windows_can["Windows CAN Port<br/>[coal_can.c]"]
end

node_application(("Application"))

node_application -.->|"uses"| node_api
node_api -.->|"operates"| node_runtime
node_runtime -.->|"dispatches"| node_nmt
node_runtime -.->|"dispatches"| node_sdo_client
node_runtime -.->|"dispatches"| node_sdo_server
node_runtime -.->|"dispatches"| node_pdo
node_runtime -.->|"dispatches"| node_sync
node_runtime -.->|"dispatches"| node_emcy
node_runtime -.->|"dispatches"| node_heartbeat
node_runtime -.->|"dispatches"| node_node_guard
node_runtime -.->|"dispatches"| node_lss
node_sdo_client -->|"sends frames"| node_can_interface
node_pdo -->|"maps entries"| node_object_dictionary
node_pdo -->|"reports timeout"| node_emcy
node_object_helpers -->|"uses descriptors"| node_objects
node_linux_can -->|"implements"| node_can_interface
node_rtk_can -->|"implements"| node_can_interface
node_windows_can -->|"implements"| node_can_interface

click node_api "https://github.com/rtlabs-com/c-open/blob/public/include/co_api.h"
click node_objects "https://github.com/rtlabs-com/c-open/blob/public/include/co_obj.h"
click node_runtime "https://github.com/rtlabs-com/c-open/blob/public/src/co_main.c"
click node_runtime_types "https://github.com/rtlabs-com/c-open/blob/public/src/co_main.h"
click node_object_dictionary "https://github.com/rtlabs-com/c-open/blob/public/src/co_od.c"
click node_object_helpers "https://github.com/rtlabs-com/c-open/blob/public/src/co_obj.c"
click node_sdo_client "https://github.com/rtlabs-com/c-open/blob/public/src/co_sdo_client.c"
click node_sdo_server "https://github.com/rtlabs-com/c-open/blob/public/src/co_sdo_server.c"
click node_pdo "https://github.com/rtlabs-com/c-open/blob/public/src/co_pdo.c"
click node_nmt "https://github.com/rtlabs-com/c-open/blob/public/src/co_nmt.c"
click node_sync "https://github.com/rtlabs-com/c-open/blob/public/src/co_sync.c"
click node_emcy "https://github.com/rtlabs-com/c-open/blob/public/src/co_emcy.c"
click node_heartbeat "https://github.com/rtlabs-com/c-open/blob/public/src/co_heartbeat.c"
click node_node_guard "https://github.com/rtlabs-com/c-open/blob/public/src/co_node_guard.c"
click node_lss "https://github.com/rtlabs-com/c-open/blob/public/src/co_lss.c"
click node_bitmap "https://github.com/rtlabs-com/c-open/blob/public/src/co_bitmap.c"
click node_can_interface "https://github.com/rtlabs-com/c-open/blob/public/src/coal_can.h"
click node_linux_can "https://github.com/rtlabs-com/c-open/blob/public/src/ports/linux/coal_can.c"
click node_rtk_can "https://github.com/rtlabs-com/c-open/blob/public/src/ports/rt-kernel/coal_can.c"
click node_windows_can "https://github.com/rtlabs-com/c-open/blob/public/src/ports/windows/coal_can.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_api,node_objects toneBlue
class node_runtime,node_runtime_types,node_object_dictionary,node_object_helpers,node_bitmap toneAmber
class node_sdo_client,node_sdo_server,node_pdo,node_nmt,node_sync,node_emcy,node_heartbeat,node_node_guard,node_lss toneMint
class node_can_interface,node_linux_can,node_rtk_can,node_windows_can toneRose
class node_application toneIndigo
```

## Components

### Application API

- [Public API](https://github.com/rtlabs-com/c-open/blob/public/include/co_api.h): `include/co_api.h`
- [Object Descriptors](https://github.com/rtlabs-com/c-open/blob/public/include/co_obj.h): `include/co_obj.h`

### Stack Core

- [Network Runtime](https://github.com/rtlabs-com/c-open/blob/public/src/co_main.c): `src/co_main.c`
- [Runtime State](https://github.com/rtlabs-com/c-open/blob/public/src/co_main.h): `src/co_main.h`
- [Object Dictionary](https://github.com/rtlabs-com/c-open/blob/public/src/co_od.c): `src/co_od.c`
- [Dictionary Helpers](https://github.com/rtlabs-com/c-open/blob/public/src/co_obj.c): `src/co_obj.c`
- [Bitmap Utility](https://github.com/rtlabs-com/c-open/blob/public/src/co_bitmap.c): `src/co_bitmap.c`

### CANopen Services

- [SDO Client](https://github.com/rtlabs-com/c-open/blob/public/src/co_sdo_client.c): `src/co_sdo_client.c`
- [SDO Server](https://github.com/rtlabs-com/c-open/blob/public/src/co_sdo_server.c): `src/co_sdo_server.c`
- [PDO Process Data](https://github.com/rtlabs-com/c-open/blob/public/src/co_pdo.c): `src/co_pdo.c`
- [NMT State Machine](https://github.com/rtlabs-com/c-open/blob/public/src/co_nmt.c): `src/co_nmt.c`
- [SYNC](https://github.com/rtlabs-com/c-open/blob/public/src/co_sync.c): `src/co_sync.c`
- [Emergency Handling](https://github.com/rtlabs-com/c-open/blob/public/src/co_emcy.c): `src/co_emcy.c`
- [Heartbeat](https://github.com/rtlabs-com/c-open/blob/public/src/co_heartbeat.c): `src/co_heartbeat.c`
- [Node Guarding](https://github.com/rtlabs-com/c-open/blob/public/src/co_node_guard.c): `src/co_node_guard.c`
- [Layer Setting Services](https://github.com/rtlabs-com/c-open/blob/public/src/co_lss.c): `src/co_lss.c`

### CAN Platform

- [CAN Abstraction](https://github.com/rtlabs-com/c-open/blob/public/src/coal_can.h): `src/coal_can.h`
- [Linux CAN Port](https://github.com/rtlabs-com/c-open/blob/public/src/ports/linux/coal_can.c): `src/ports/linux/coal_can.c`
- [RT-Kernel CAN Port](https://github.com/rtlabs-com/c-open/blob/public/src/ports/rt-kernel/coal_can.c): `src/ports/rt-kernel/coal_can.c`
- [Windows CAN Port](https://github.com/rtlabs-com/c-open/blob/public/src/ports/windows/coal_can.c): `src/ports/windows/coal_can.c`

### Other components

- **Application**

## Connections

- Application → Public API: uses (evidence: `include/co_api.h`)
- Public API → Network Runtime: operates (evidence: `src/co_main.c`)
- Network Runtime → NMT State Machine: dispatches (evidence: `src/co_main.c`)
- Network Runtime → SDO Client: dispatches (evidence: `src/co_main.c`)
- Network Runtime → SDO Server: dispatches (evidence: `src/co_main.c`)
- Network Runtime → PDO Process Data: dispatches (evidence: `src/co_main.c`)
- Network Runtime → SYNC: dispatches (evidence: `src/co_main.c`)
- Network Runtime → Emergency Handling: dispatches (evidence: `src/co_main.c`)
- Network Runtime → Heartbeat: dispatches (evidence: `src/co_main.c`)
- Network Runtime → Node Guarding: dispatches (evidence: `src/co_main.c`)
- Network Runtime → Layer Setting Services: dispatches (evidence: `src/co_main.c`)
- SDO Client → CAN Abstraction: sends frames (evidence: `src/co_sdo_client.c`)
- PDO Process Data → Object Dictionary: maps entries (evidence: `src/co_pdo.c`)
- PDO Process Data → Emergency Handling: reports timeout (evidence: `src/co_pdo.c`)
- Dictionary Helpers → Object Descriptors: uses descriptors (evidence: `src/co_obj.c`)
- Linux CAN Port → CAN Abstraction: implements (evidence: `src/ports/linux/coal_can.c`)
- RT-Kernel CAN Port → CAN Abstraction: implements (evidence: `src/ports/rt-kernel/coal_can.c`)
- Windows CAN Port → CAN Abstraction: implements (evidence: `src/ports/windows/coal_can.c`)
