# matu6968/libre-gxdl architecture

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

- Interactive diagram: https://gitdiagram.com/matu6968/libre-gxdl
- Repository: https://github.com/matu6968/libre-gxdl

## Overview

libre-gxdl is a Python command-line downloader and flash-management tool for NationalChip GX devices. The principal workflow is to select a board-compatible bootloader, connect over serial, and issue commands to read or write device storage; flash transfers can also use TFTP or a USB drive attached to the device. The README documents partition, OTP, flash-management, configuration, and comparison capabilities. The sampled implementation is one large module, so feature nodes share its exact path; unsampled command-dispatch details are not inferred.

Main entry points: [`libre_gxdl.py`](https://github.com/matu6968/libre-gxdl/blob/main/libre_gxdl.py) (CLI and dispatcher), [`loaders`](https://github.com/matu6968/libre-gxdl/tree/main/loaders) (Board bootloaders)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_session["Device session"]
  node_cli["CLI and dispatcher<br/>[libre_gxdl.py]"]
  node_boot["Serial boot upload<br/>[libre_gxdl.py]"]
  node_loaders["Board bootloaders"]
end

subgraph group_transfers["Partition transfers"]
  node_serial["Serial partitions<br/>[libre_gxdl.py]"]
  node_tftp["TFTP partitions<br/>[libre_gxdl.py]"]
  node_usb["USB partitions<br/>[libre_gxdl.py]"]
end

subgraph group_memory["Memory operations"]
  node_flash["Flash management<br/>[libre_gxdl.py]"]
  node_gxotp["GX OTP<br/>[libre_gxdl.py]"]
  node_sflashotp["SPI Flash OTP<br/>[libre_gxdl.py]"]
end

subgraph group_utilities["Command utilities"]
  node_config["Config commands<br/>[libre_gxdl.py]"]
  node_compare["File comparison<br/>[libre_gxdl.py]"]
end

node_user(("Operator"))
node_device["GX device"]
node_output["Host files"]
node_tftppeer["PC TFTP peer"]
node_usbdrive[("Attached USB drive")]

node_user -->|"runs commands"| node_cli
node_cli -->|"selects boot"| node_boot
node_boot -->|"loads image"| node_loaders
node_boot -->|"boots over serial"| node_device
node_cli -->|"invokes dump/down"| node_serial
node_serial -->|"transfers serial data"| node_device
node_serial -->|"reads or writes files"| node_output
node_cli -->|"invokes netdump/netdown"| node_tftp
node_tftp -->|"transfers partitions"| node_device
node_tftp -->|"exchanges TFTP data"| node_tftppeer
node_tftp -->|"reads or writes files"| node_output
node_cli -->|"invokes usbdump/usbdown"| node_usb
node_usb -->|"transfers partitions"| node_device
node_usb -->|"reads or writes"| node_usbdrive
node_cli -->|"invokes flash commands"| node_flash
node_flash -->|"manages flash"| node_device
node_cli -->|"invokes gx_otp"| node_gxotp
node_gxotp -->|"reads or writes OTP"| node_device
node_cli -->|"invokes sflash_otp"| node_sflashotp
node_sflashotp -->|"manages flash OTP"| node_device
node_cli -->|"invokes config loading"| node_config
node_config -->|"sends configured commands"| node_device
node_cli -->|"invokes comparison"| node_compare
node_compare -->|"compares files"| node_output

click node_cli "https://github.com/matu6968/libre-gxdl/blob/main/libre_gxdl.py"
click node_boot "https://github.com/matu6968/libre-gxdl/blob/main/libre_gxdl.py"
click node_loaders "https://github.com/matu6968/libre-gxdl/tree/main/loaders"
click node_serial "https://github.com/matu6968/libre-gxdl/blob/main/libre_gxdl.py"
click node_tftp "https://github.com/matu6968/libre-gxdl/blob/main/libre_gxdl.py"
click node_usb "https://github.com/matu6968/libre-gxdl/blob/main/libre_gxdl.py"
click node_flash "https://github.com/matu6968/libre-gxdl/blob/main/libre_gxdl.py"
click node_gxotp "https://github.com/matu6968/libre-gxdl/blob/main/libre_gxdl.py"
click node_sflashotp "https://github.com/matu6968/libre-gxdl/blob/main/libre_gxdl.py"
click node_config "https://github.com/matu6968/libre-gxdl/blob/main/libre_gxdl.py"
click node_compare "https://github.com/matu6968/libre-gxdl/blob/main/libre_gxdl.py"

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_boot,node_loaders toneBlue
class node_serial,node_tftp,node_usb,node_usbdrive toneAmber
class node_flash,node_gxotp,node_sflashotp toneMint
class node_config,node_compare toneRose
class node_user,node_device,node_output,node_tftppeer toneIndigo
```

## Components

### Device session

- [CLI and dispatcher](https://github.com/matu6968/libre-gxdl/blob/main/libre_gxdl.py): `libre_gxdl.py`
- [Serial boot upload](https://github.com/matu6968/libre-gxdl/blob/main/libre_gxdl.py): `libre_gxdl.py`
- [Board bootloaders](https://github.com/matu6968/libre-gxdl/tree/main/loaders): `loaders`

### Partition transfers

- [Serial partitions](https://github.com/matu6968/libre-gxdl/blob/main/libre_gxdl.py): `libre_gxdl.py`
- [TFTP partitions](https://github.com/matu6968/libre-gxdl/blob/main/libre_gxdl.py): `libre_gxdl.py`
- [USB partitions](https://github.com/matu6968/libre-gxdl/blob/main/libre_gxdl.py): `libre_gxdl.py`

### Memory operations

- [Flash management](https://github.com/matu6968/libre-gxdl/blob/main/libre_gxdl.py): `libre_gxdl.py`
- [GX OTP](https://github.com/matu6968/libre-gxdl/blob/main/libre_gxdl.py): `libre_gxdl.py`
- [SPI Flash OTP](https://github.com/matu6968/libre-gxdl/blob/main/libre_gxdl.py): `libre_gxdl.py`

### Command utilities

- [Config commands](https://github.com/matu6968/libre-gxdl/blob/main/libre_gxdl.py): `libre_gxdl.py`
- [File comparison](https://github.com/matu6968/libre-gxdl/blob/main/libre_gxdl.py): `libre_gxdl.py`

### Other components

- **Operator**
- **GX device**
- **Host files**
- **PC TFTP peer**
- **Attached USB drive**

## Connections

- Operator → CLI and dispatcher: runs commands (evidence: `README.md`)
- CLI and dispatcher → Serial boot upload: selects boot (evidence: `README.md`)
- Serial boot upload → Board bootloaders: loads image (evidence: `README.md`)
- Serial boot upload → GX device: boots over serial (evidence: `README.md`)
- CLI and dispatcher → Serial partitions: invokes dump/down (evidence: `README.md`)
- Serial partitions → GX device: transfers serial data (evidence: `README.md`)
- Serial partitions → Host files: reads or writes files (evidence: `README.md`)
- CLI and dispatcher → TFTP partitions: invokes netdump/netdown (evidence: `README.md`)
- TFTP partitions → GX device: transfers partitions (evidence: `README.md`)
- TFTP partitions → PC TFTP peer: exchanges TFTP data (evidence: `README.md`)
- TFTP partitions → Host files: reads or writes files (evidence: `README.md`)
- CLI and dispatcher → USB partitions: invokes usbdump/usbdown (evidence: `README.md`)
- USB partitions → GX device: transfers partitions (evidence: `README.md`)
- USB partitions → Attached USB drive: reads or writes (evidence: `README.md`)
- CLI and dispatcher → Flash management: invokes flash commands (evidence: `README.md`)
- Flash management → GX device: manages flash (evidence: `README.md`)
- CLI and dispatcher → GX OTP: invokes gx_otp (evidence: `README.md`)
- GX OTP → GX device: reads or writes OTP (evidence: `README.md`)
- CLI and dispatcher → SPI Flash OTP: invokes sflash_otp (evidence: `README.md`)
- SPI Flash OTP → GX device: manages flash OTP (evidence: `README.md`)
- CLI and dispatcher → Config commands: invokes config loading (evidence: `README.md`)
- Config commands → GX device: sends configured commands (evidence: `README.md`)
- CLI and dispatcher → File comparison: invokes comparison (evidence: `README.md`)
- File comparison → Host files: compares files (evidence: `README.md`)
