# openchirp/ccbootutil architecture

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

- Interactive diagram: https://gitdiagram.com/openchirp/ccbootutil
- Repository: https://github.com/openchirp/ccbootutil

## Overview

ccbootutil is a command-line and scriptable interface for programming and inspecting TI CC2538/CC26xx bootloaders over a serial connection. The user supplies a port, command, and—when flashing or verifying—an ELF file. The CLI opens the port and dispatches bootloader operations; programming uses ELF regions to erase and write flash, verification compares CRCs, and the combined command resets after success. The graph reflects the sampled main.go and flash.go; bootloader protocol internals are provided by an external library and were not inspected.

Main entry points: [`main.go`](https://github.com/openchirp/ccbootutil/blob/master/main.go) (Command CLI), [`flash.go`](https://github.com/openchirp/ccbootutil/blob/master/flash.go) (Flash image)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI orchestration"]
  node_cli["Command CLI<br/>[main.go]"]
  node_serial["Serial port<br/>[main.go]"]
  node_console["Serial console<br/>[main.go]"]
end

subgraph group_operations["Device operations"]
  node_bootops["Bootloader commands<br/>[main.go]"]
  node_memory["Memory inspection<br/>[main.go]"]
  node_ccfg["CCFG updates<br/>[main.go]"]
end

subgraph group_programming["Image programming"]
  node_flash["Flash image<br/>[flash.go]"]
  node_verify["Verify image<br/>[flash.go]"]
end

node_user(("User"))
node_terminal["Terminal I/O"]
node_bootlib["ccboot library"]
node_elf["ELF image"]
node_device["TI bootloader"]

node_user -->|"invokes"| node_cli
node_cli -->|"opens port"| node_serial
node_cli -->|"creates device"| node_bootlib
node_cli -->|"dispatches commands"| node_bootops
node_cli -->|"dispatches read"| node_memory
node_cli -->|"dispatches updates"| node_ccfg
node_cli -->|"calls flash"| node_flash
node_cli -->|"calls verify"| node_verify
node_cli -->|"starts console"| node_console
node_console -->|"copies streams"| node_terminal
node_console -->|"reads and writes"| node_serial
node_bootops -->|"calls operations"| node_bootlib
node_memory -->|"reads memory"| node_bootlib
node_ccfg -->|"sets fields"| node_bootlib
node_flash -->|"parses regions"| node_elf
node_verify -->|"reads regions"| node_elf
node_flash -->|"erases and writes"| node_bootlib
node_verify -->|"requests CRC"| node_bootlib
node_bootlib -.->|"communicates with"| node_device
node_user -->|"provides image"| node_elf

click node_cli "https://github.com/openchirp/ccbootutil/blob/master/main.go"
click node_serial "https://github.com/openchirp/ccbootutil/blob/master/main.go"
click node_console "https://github.com/openchirp/ccbootutil/blob/master/main.go"
click node_bootops "https://github.com/openchirp/ccbootutil/blob/master/main.go"
click node_memory "https://github.com/openchirp/ccbootutil/blob/master/main.go"
click node_ccfg "https://github.com/openchirp/ccbootutil/blob/master/main.go"
click node_flash "https://github.com/openchirp/ccbootutil/blob/master/flash.go"
click node_verify "https://github.com/openchirp/ccbootutil/blob/master/flash.go"

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_cli,node_serial,node_console,node_user toneBlue
class node_bootops,node_memory,node_ccfg toneAmber
class node_flash,node_verify toneMint
class node_terminal,node_bootlib,node_elf,node_device toneIndigo
```

## Components

### CLI orchestration

- [Command CLI](https://github.com/openchirp/ccbootutil/blob/master/main.go): `main.go`
- [Serial port](https://github.com/openchirp/ccbootutil/blob/master/main.go): `main.go`
- [Serial console](https://github.com/openchirp/ccbootutil/blob/master/main.go): `main.go`

### Device operations

- [Bootloader commands](https://github.com/openchirp/ccbootutil/blob/master/main.go): `main.go`
- [Memory inspection](https://github.com/openchirp/ccbootutil/blob/master/main.go): `main.go`
- [CCFG updates](https://github.com/openchirp/ccbootutil/blob/master/main.go): `main.go`

### Image programming

- [Flash image](https://github.com/openchirp/ccbootutil/blob/master/flash.go): `flash.go`
- [Verify image](https://github.com/openchirp/ccbootutil/blob/master/flash.go): `flash.go`

### Other components

- **User**
- **Terminal I/O**
- **ccboot library**
- **ELF image**
- **TI bootloader**

## Connections

- User → Command CLI: invokes (evidence: `README.md`)
- Command CLI → Serial port: opens port (evidence: `main.go`)
- Command CLI → ccboot library: creates device (evidence: `main.go`)
- Command CLI → Bootloader commands: dispatches commands (evidence: `main.go`)
- Command CLI → Memory inspection: dispatches read (evidence: `main.go`)
- Command CLI → CCFG updates: dispatches updates (evidence: `main.go`)
- Command CLI → Flash image: calls flash (evidence: `main.go`)
- Command CLI → Verify image: calls verify (evidence: `main.go`)
- Command CLI → Serial console: starts console (evidence: `main.go`)
- Serial console → Terminal I/O: copies streams (evidence: `main.go`)
- Serial console → Serial port: reads and writes (evidence: `main.go`)
- Bootloader commands → ccboot library: calls operations (evidence: `main.go`)
- Memory inspection → ccboot library: reads memory (evidence: `main.go`)
- CCFG updates → ccboot library: sets fields (evidence: `main.go`)
- Flash image → ELF image: parses regions (evidence: `flash.go`)
- Verify image → ELF image: reads regions (evidence: `flash.go`)
- Flash image → ccboot library: erases and writes (evidence: `flash.go`)
- Verify image → ccboot library: requests CRC (evidence: `flash.go`)
- ccboot library → TI bootloader: communicates with
- User → ELF image: provides image (evidence: `README.md`)
