# robotis-git/opencr architecture

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

- Interactive diagram: https://gitdiagram.com/robotis-git/opencr
- Repository: https://github.com/robotis-git/opencr

## Overview

OpenCR is a microcontroller control-module platform: Arduino-compatible firmware runs on the board, with libraries for robotics, communications, graphics, and real-time tasks; separate development tools and bootloader support firmware writing and updates. The README identifies these repository roles, while sampled sources show bootloader command dispatch, loader command handling, and selected library behavior. Many library-to-library and hardware-level connections are not evidenced by the excerpts, so they are not drawn.

Main entry points: [`arduino/opencr_arduino/opencr/cores/arduino/wiring.c`](https://github.com/robotis-git/opencr/blob/master/arduino/opencr_arduino/opencr/cores/arduino/wiring.c) (Arduino Core), [`arduino/opencr_develop/opencr_ld_shell/main.c`](https://github.com/robotis-git/opencr/blob/master/arduino/opencr_develop/opencr_ld_shell/main.c) (Loader CLI), [`arduino/opencr_develop/opencr_bootloader/main.c`](https://github.com/robotis-git/opencr/blob/master/arduino/opencr_develop/opencr_bootloader/main.c) (Bootloader Loop), [`arduino/opencr_develop/opencr_ld/opencr_ld.c`](https://github.com/robotis-git/opencr/blob/master/arduino/opencr_develop/opencr_ld/opencr_ld.c) (Loader Engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_arduino["Arduino Runtime"]
  node_arduino_core["Arduino Core<br/>[wiring.c]"]
  node_board_main["Board Startup<br/>[main.cpp]"]
  node_serial["Serial I/O<br/>[UARTClass.cpp]"]
end

subgraph group_robotics["Robotics Libraries"]
  node_dynamixel_sdk["Dynamixel SDK"]
  node_workbench["Dynamixel Workbench"]
  node_manipulator["Manipulator Manager"]
  node_tb3_controller["TurtleBot3 Control"]
  node_tb3_ros2["TurtleBot3 ROS 2"]
  node_rosserial["ROS Serial<br/>[node_handle.h]"]
end

subgraph group_platform["System Libraries"]
  node_rtos["FreeRTOS Tasks<br/>[tasks.c]"]
  node_can["CAN Interface<br/>[CAN.cpp]"]
  node_graphics["Graphics<br/>[Adafruit_GFX.cpp]"]
  node_eigen["Eigen Math<br/>[Eigen.h]"]
end

subgraph group_firmware["Firmware Tools"]
  node_loader_shell["Loader CLI<br/>[main.c]"]
  node_loader_engine["Loader Engine<br/>[opencr_ld.c]"]
  node_firmware_image["Firmware Image"]
end

subgraph group_boot["Bootloader"]
  node_boot_main["Bootloader Loop<br/>[main.c]"]
  node_boot_commands["Flash Commands<br/>[cmd.c]"]
end

node_developer(("Firmware Developer"))
node_opencr_board["OpenCR Board"]

node_developer -->|"develops firmware"| node_arduino_core
node_arduino_core -->|"runs on"| node_board_main
node_arduino_core -.->|"provides APIs"| node_serial
node_developer -->|"runs loader"| node_loader_shell
node_loader_shell -->|"calls"| node_loader_engine
node_loader_shell -->|"writes image"| node_firmware_image
node_loader_engine -->|"updates firmware"| node_opencr_board
node_opencr_board -->|"starts bootloader"| node_boot_main
node_boot_main -->|"dispatches commands"| node_boot_commands
node_boot_main -.->|"initializes board"| node_opencr_board

click node_arduino_core "https://github.com/robotis-git/opencr/blob/master/arduino/opencr_arduino/opencr/cores/arduino/wiring.c"
click node_board_main "https://github.com/robotis-git/opencr/blob/master/arduino/opencr_arduino/opencr/variants/OpenCR/main.cpp"
click node_serial "https://github.com/robotis-git/opencr/blob/master/arduino/opencr_arduino/opencr/cores/arduino/UARTClass.cpp"
click node_rtos "https://github.com/robotis-git/opencr/blob/master/arduino/opencr_arduino/opencr/libraries/RTOS/src/tasks.c"
click node_can "https://github.com/robotis-git/opencr/blob/master/arduino/opencr_arduino/opencr/libraries/CAN/CAN.cpp"
click node_graphics "https://github.com/robotis-git/opencr/blob/master/arduino/opencr_arduino/opencr/libraries/Adafruit_GFX_Library/Adafruit_GFX.cpp"
click node_eigen "https://github.com/robotis-git/opencr/blob/master/arduino/opencr_arduino/opencr/libraries/Eigen331/src/Eigen.h"
click node_dynamixel_sdk "https://github.com/robotis-git/opencr/blob/master/arduino/opencr_arduino/opencr/libraries/DynamixelSDK/src/dynamixel_sdk/protocol2_packet_handler.cpp"
click node_workbench "https://github.com/robotis-git/opencr/blob/master/arduino/opencr_arduino/opencr/libraries/DynamixelWorkbench/src/dynamixel_workbench_toolbox/dynamixel_workbench.cpp"
click node_manipulator "https://github.com/robotis-git/opencr/blob/master/arduino/opencr_arduino/opencr/libraries/RobotisManipulator/src/robotis_manipulator/robotis_manipulator_manager.cpp"
click node_tb3_controller "https://github.com/robotis-git/opencr/blob/master/arduino/opencr_arduino/opencr/libraries/turtlebot3/src/turtlebot3/turtlebot3_controller.cpp"
click node_tb3_ros2 "https://github.com/robotis-git/opencr/blob/master/arduino/opencr_arduino/opencr/libraries/turtlebot3_ros2/src/turtlebot3/turtlebot3_controller.cpp"
click node_rosserial "https://github.com/robotis-git/opencr/blob/master/arduino/opencr_arduino/opencr/libraries/turtlebot3_ros_lib/ros/node_handle.h"
click node_loader_shell "https://github.com/robotis-git/opencr/blob/master/arduino/opencr_develop/opencr_ld_shell/main.c"
click node_loader_engine "https://github.com/robotis-git/opencr/blob/master/arduino/opencr_develop/opencr_ld/opencr_ld.c"
click node_boot_main "https://github.com/robotis-git/opencr/blob/master/arduino/opencr_develop/opencr_bootloader/main.c"
click node_boot_commands "https://github.com/robotis-git/opencr/blob/master/arduino/opencr_develop/opencr_bootloader/src/cmd.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_arduino_core,node_board_main,node_serial toneBlue
class node_dynamixel_sdk,node_workbench,node_manipulator,node_tb3_controller,node_tb3_ros2,node_rosserial toneAmber
class node_rtos,node_can,node_graphics,node_eigen toneMint
class node_loader_shell,node_loader_engine,node_firmware_image toneRose
class node_boot_main,node_boot_commands,node_developer,node_opencr_board toneIndigo
```

## Components

### Arduino Runtime

- [Arduino Core](https://github.com/robotis-git/opencr/blob/master/arduino/opencr_arduino/opencr/cores/arduino/wiring.c): `arduino/opencr_arduino/opencr/cores/arduino/wiring.c`
- [Board Startup](https://github.com/robotis-git/opencr/blob/master/arduino/opencr_arduino/opencr/variants/OpenCR/main.cpp): `arduino/opencr_arduino/opencr/variants/OpenCR/main.cpp`
- [Serial I/O](https://github.com/robotis-git/opencr/blob/master/arduino/opencr_arduino/opencr/cores/arduino/UARTClass.cpp): `arduino/opencr_arduino/opencr/cores/arduino/UARTClass.cpp`

### Robotics Libraries

- [Dynamixel SDK](https://github.com/robotis-git/opencr/blob/master/arduino/opencr_arduino/opencr/libraries/DynamixelSDK/src/dynamixel_sdk/protocol2_packet_handler.cpp): `arduino/opencr_arduino/opencr/libraries/DynamixelSDK/src/dynamixel_sdk/protocol2_packet_handler.cpp`
- [Dynamixel Workbench](https://github.com/robotis-git/opencr/blob/master/arduino/opencr_arduino/opencr/libraries/DynamixelWorkbench/src/dynamixel_workbench_toolbox/dynamixel_workbench.cpp): `arduino/opencr_arduino/opencr/libraries/DynamixelWorkbench/src/dynamixel_workbench_toolbox/dynamixel_workbench.cpp`
- [Manipulator Manager](https://github.com/robotis-git/opencr/blob/master/arduino/opencr_arduino/opencr/libraries/RobotisManipulator/src/robotis_manipulator/robotis_manipulator_manager.cpp): `arduino/opencr_arduino/opencr/libraries/RobotisManipulator/src/robotis_manipulator/robotis_manipulator_manager.cpp`
- [TurtleBot3 Control](https://github.com/robotis-git/opencr/blob/master/arduino/opencr_arduino/opencr/libraries/turtlebot3/src/turtlebot3/turtlebot3_controller.cpp): `arduino/opencr_arduino/opencr/libraries/turtlebot3/src/turtlebot3/turtlebot3_controller.cpp`
- [TurtleBot3 ROS 2](https://github.com/robotis-git/opencr/blob/master/arduino/opencr_arduino/opencr/libraries/turtlebot3_ros2/src/turtlebot3/turtlebot3_controller.cpp): `arduino/opencr_arduino/opencr/libraries/turtlebot3_ros2/src/turtlebot3/turtlebot3_controller.cpp`
- [ROS Serial](https://github.com/robotis-git/opencr/blob/master/arduino/opencr_arduino/opencr/libraries/turtlebot3_ros_lib/ros/node_handle.h): `arduino/opencr_arduino/opencr/libraries/turtlebot3_ros_lib/ros/node_handle.h`

### System Libraries

- [FreeRTOS Tasks](https://github.com/robotis-git/opencr/blob/master/arduino/opencr_arduino/opencr/libraries/RTOS/src/tasks.c): `arduino/opencr_arduino/opencr/libraries/RTOS/src/tasks.c`
- [CAN Interface](https://github.com/robotis-git/opencr/blob/master/arduino/opencr_arduino/opencr/libraries/CAN/CAN.cpp): `arduino/opencr_arduino/opencr/libraries/CAN/CAN.cpp`
- [Graphics](https://github.com/robotis-git/opencr/blob/master/arduino/opencr_arduino/opencr/libraries/Adafruit_GFX_Library/Adafruit_GFX.cpp): `arduino/opencr_arduino/opencr/libraries/Adafruit_GFX_Library/Adafruit_GFX.cpp`
- [Eigen Math](https://github.com/robotis-git/opencr/blob/master/arduino/opencr_arduino/opencr/libraries/Eigen331/src/Eigen.h): `arduino/opencr_arduino/opencr/libraries/Eigen331/src/Eigen.h`

### Firmware Tools

- [Loader CLI](https://github.com/robotis-git/opencr/blob/master/arduino/opencr_develop/opencr_ld_shell/main.c): `arduino/opencr_develop/opencr_ld_shell/main.c`
- [Loader Engine](https://github.com/robotis-git/opencr/blob/master/arduino/opencr_develop/opencr_ld/opencr_ld.c): `arduino/opencr_develop/opencr_ld/opencr_ld.c`
- **Firmware Image**

### Bootloader

- [Bootloader Loop](https://github.com/robotis-git/opencr/blob/master/arduino/opencr_develop/opencr_bootloader/main.c): `arduino/opencr_develop/opencr_bootloader/main.c`
- [Flash Commands](https://github.com/robotis-git/opencr/blob/master/arduino/opencr_develop/opencr_bootloader/src/cmd.c): `arduino/opencr_develop/opencr_bootloader/src/cmd.c`

### Other components

- **Firmware Developer**
- **OpenCR Board**

## Connections

- Firmware Developer → Arduino Core: develops firmware
- Arduino Core → Board Startup: runs on
- Arduino Core → Serial I/O: provides APIs
- Firmware Developer → Loader CLI: runs loader
- Loader CLI → Loader Engine: calls (evidence: `arduino/opencr_develop/opencr_ld_shell/main.c`)
- Loader CLI → Firmware Image: writes image
- Loader Engine → OpenCR Board: updates firmware
- OpenCR Board → Bootloader Loop: starts bootloader
- Bootloader Loop → Flash Commands: dispatches commands (evidence: `arduino/opencr_develop/opencr_bootloader/main.c`)
- Bootloader Loop → OpenCR Board: initializes board
