# avrdudes/avrdude architecture

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

- Interactive diagram: https://gitdiagram.com/avrdudes/avrdude
- Repository: https://github.com/avrdudes/avrdude

## Overview

AVRDUDE is a command-line AVR programmer and also provides a demonstrator GUI built on libavrdude. The main workflow is selecting a programmer and AVR part, supplying memory data or an instruction, and transferring it to the device; documented targets include flash, EEPROM, fuse and lock bits. The tree also shows broad protocol and programmer implementations, including JTAG, PICkit 5 and STK500v2. Links from the CLI and GUI to the library and programmer layer follow README descriptions; detailed runtime dispatch is not established by the sampled excerpts.

Main entry points: [`src/main.c`](https://github.com/avrdudes/avrdude/blob/main/src/main.c) (CLI), [`src/python/adgui.py`](https://github.com/avrdudes/avrdude/blob/main/src/python/adgui.py) (GUI demonstrator), [`src/libavrdude.h`](https://github.com/avrdudes/avrdude/blob/main/src/libavrdude.h) (libavrdude API), [`src/pgm.c`](https://github.com/avrdudes/avrdude/blob/main/src/pgm.c) (Programmer implementations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interfaces"]
  node_cli["CLI<br/>[main.c]"]
  node_gui["GUI demonstrator<br/>[adgui.py]"]
  node_terminal["Direct instructions<br/>[term.c]"]
end

subgraph group_core["Programming core"]
  node_api["libavrdude API<br/>[libavrdude.h]"]
  node_updates["Memory operations<br/>[update.c]"]
  node_crc["CRC support<br/>[crc16.h]"]
end

subgraph group_protocols["Programmer protocols"]
  node_programmer["Programmer implementations<br/>[pgm.c]"]
  node_jtag3["JTAG3 protocol<br/>[jtag3.c]"]
  node_jtagmkii["JTAG MkII protocol<br/>[jtagmkII.c]"]
  node_pickit5["PICkit 5 protocol<br/>[pickit5.c]"]
  node_pickit_lut["PICkit script tables<br/>[pickit5_lut_dw.c]"]
  node_stk500v2["STK500v2 protocol<br/>[stk500v2.c]"]
  node_urclock["Urclock protocol<br/>[urclock.c]"]
end

subgraph group_data["Device and data"]
  node_avrintel["AVR device metadata"]
  node_parts["Part definitions<br/>[avrpart.c]"]
  node_config["Configuration<br/>[config.c]"]
  node_fileio["Memory file formats<br/>[fileio.c]"]
end

node_user(("Operator"))
node_target(("AVR microcontroller"))

node_user -->|"runs command"| node_cli
node_cli -->|"selects programmer"| node_programmer
node_programmer -->|"programs memories"| node_target
node_gui -->|"uses library"| node_api
node_user -->|"starts demonstrator"| node_gui
node_cli -->|"offers instruction mode"| node_terminal
node_api -->|"supports AVR programming"| node_target
node_jtag3 -.->|"communicates with"| node_target
node_jtagmkii -.->|"communicates with"| node_target
node_pickit5 -.->|"communicates with"| node_target
node_stk500v2 -.->|"communicates with"| node_target
node_urclock -.->|"communicates with"| node_target

click node_cli "https://github.com/avrdudes/avrdude/blob/main/src/main.c"
click node_gui "https://github.com/avrdudes/avrdude/blob/main/src/python/adgui.py"
click node_api "https://github.com/avrdudes/avrdude/blob/main/src/libavrdude.h"
click node_avrintel "https://github.com/avrdudes/avrdude/blob/main/src/libavrdude-avrintel.h"
click node_parts "https://github.com/avrdudes/avrdude/blob/main/src/avrpart.c"
click node_config "https://github.com/avrdudes/avrdude/blob/main/src/config.c"
click node_fileio "https://github.com/avrdudes/avrdude/blob/main/src/fileio.c"
click node_updates "https://github.com/avrdudes/avrdude/blob/main/src/update.c"
click node_terminal "https://github.com/avrdudes/avrdude/blob/main/src/term.c"
click node_programmer "https://github.com/avrdudes/avrdude/blob/main/src/pgm.c"
click node_jtag3 "https://github.com/avrdudes/avrdude/blob/main/src/jtag3.c"
click node_jtagmkii "https://github.com/avrdudes/avrdude/blob/main/src/jtagmkII.c"
click node_pickit5 "https://github.com/avrdudes/avrdude/blob/main/src/pickit5.c"
click node_pickit_lut "https://github.com/avrdudes/avrdude/blob/main/src/pickit5_lut_dw.c"
click node_stk500v2 "https://github.com/avrdudes/avrdude/blob/main/src/stk500v2.c"
click node_urclock "https://github.com/avrdudes/avrdude/blob/main/src/urclock.c"
click node_crc "https://github.com/avrdudes/avrdude/blob/main/src/crc16.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_cli,node_gui,node_terminal toneBlue
class node_api,node_updates,node_crc toneAmber
class node_programmer,node_jtag3,node_jtagmkii,node_pickit5,node_pickit_lut,node_stk500v2,node_urclock toneMint
class node_avrintel,node_parts,node_config,node_fileio toneRose
class node_user,node_target toneIndigo
```

## Components

### User interfaces

- [CLI](https://github.com/avrdudes/avrdude/blob/main/src/main.c): `src/main.c`
- [GUI demonstrator](https://github.com/avrdudes/avrdude/blob/main/src/python/adgui.py): `src/python/adgui.py`
- [Direct instructions](https://github.com/avrdudes/avrdude/blob/main/src/term.c): `src/term.c`

### Programming core

- [libavrdude API](https://github.com/avrdudes/avrdude/blob/main/src/libavrdude.h): `src/libavrdude.h`
- [Memory operations](https://github.com/avrdudes/avrdude/blob/main/src/update.c): `src/update.c`
- [CRC support](https://github.com/avrdudes/avrdude/blob/main/src/crc16.h): `src/crc16.h`

### Programmer protocols

- [Programmer implementations](https://github.com/avrdudes/avrdude/blob/main/src/pgm.c): `src/pgm.c`
- [JTAG3 protocol](https://github.com/avrdudes/avrdude/blob/main/src/jtag3.c): `src/jtag3.c`
- [JTAG MkII protocol](https://github.com/avrdudes/avrdude/blob/main/src/jtagmkII.c): `src/jtagmkII.c`
- [PICkit 5 protocol](https://github.com/avrdudes/avrdude/blob/main/src/pickit5.c): `src/pickit5.c`
- [PICkit script tables](https://github.com/avrdudes/avrdude/blob/main/src/pickit5_lut_dw.c): `src/pickit5_lut_dw.c`
- [STK500v2 protocol](https://github.com/avrdudes/avrdude/blob/main/src/stk500v2.c): `src/stk500v2.c`
- [Urclock protocol](https://github.com/avrdudes/avrdude/blob/main/src/urclock.c): `src/urclock.c`

### Device and data

- [AVR device metadata](https://github.com/avrdudes/avrdude/blob/main/src/libavrdude-avrintel.h): `src/libavrdude-avrintel.h`
- [Part definitions](https://github.com/avrdudes/avrdude/blob/main/src/avrpart.c): `src/avrpart.c`
- [Configuration](https://github.com/avrdudes/avrdude/blob/main/src/config.c): `src/config.c`
- [Memory file formats](https://github.com/avrdudes/avrdude/blob/main/src/fileio.c): `src/fileio.c`

### Other components

- **Operator**
- **AVR microcontroller**

## Connections

- Operator → CLI: runs command
- CLI → Programmer implementations: selects programmer
- Programmer implementations → AVR microcontroller: programs memories
- GUI demonstrator → libavrdude API: uses library
- Operator → GUI demonstrator: starts demonstrator
- CLI → Direct instructions: offers instruction mode
- libavrdude API → AVR microcontroller: supports AVR programming
- JTAG3 protocol → AVR microcontroller: communicates with
- JTAG MkII protocol → AVR microcontroller: communicates with
- PICkit 5 protocol → AVR microcontroller: communicates with
- STK500v2 protocol → AVR microcontroller: communicates with
- Urclock protocol → AVR microcontroller: communicates with
