# elecskku/stm32v3 architecture

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

- Interactive diagram: https://gitdiagram.com/elecskku/stm32v3
- Repository: https://github.com/elecskku/stm32v3

## Overview

This repository contains a Windows host utility and STM32 firmware for managing files in SPI flash over UART. The host CLI offers device identification, erase, write, read, verification, and a demo flow; the firmware receives commands, handles packet transfers, and accesses flash. Firmware excerpts also show BMP validation and timing for grayscale work, but the omitted code limits certainty about that processing path. The README provides no additional capability details, so unsampled relationships are not inferred.

Main entry points: [`main.c`](https://github.com/elecskku/stm32v3/blob/main/main.c) (Command dispatch), [`main_clean.cpp`](https://github.com/elecskku/stm32v3/blob/main/main_clean.cpp) (Host commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_host["Windows host"]
  node_cli["CLI and demo<br/>[main_clean.cpp]"]
  node_hostcommands["Host commands<br/>[main_clean.cpp]"]
  node_packetbuilder["Packet builder<br/>[main_clean.cpp]"]
end

subgraph group_firmware["STM32 firmware"]
  node_dispatch["Command dispatch<br/>[main.c]"]
  node_transfer["Packet transfer<br/>[main.c]"]
  node_crc["CRC checks<br/>[main.c]"]
  node_imagework["Image processing<br/>[main.c]"]
end

subgraph group_storage["Flash and image"]
  node_flashdriver["SPI flash access<br/>[main.c]"]
  node_flash[("SPI flash")]
  node_bmp["BMP validation<br/>[main.c]"]
end

node_operator(("Operator"))
node_serial["UART link"]

node_operator -->|"runs"| node_cli
node_cli -->|"dispatches"| node_hostcommands
node_hostcommands -->|"builds packets"| node_packetbuilder
node_hostcommands -->|"sends commands"| node_serial
node_serial -->|"carries commands"| node_dispatch
node_dispatch -->|"handles writes"| node_transfer
node_dispatch -->|"erases and reads"| node_flashdriver
node_transfer -->|"programs packets"| node_flashdriver
node_flashdriver -->|"reads and writes"| node_flash
node_dispatch -->|"checks transfers"| node_crc
node_dispatch -->|"validates image"| node_bmp
node_dispatch -->|"reports timing"| node_imagework

click node_cli "https://github.com/elecskku/stm32v3/blob/main/main_clean.cpp"
click node_hostcommands "https://github.com/elecskku/stm32v3/blob/main/main_clean.cpp"
click node_packetbuilder "https://github.com/elecskku/stm32v3/blob/main/main_clean.cpp"
click node_dispatch "https://github.com/elecskku/stm32v3/blob/main/main.c"
click node_transfer "https://github.com/elecskku/stm32v3/blob/main/main.c"
click node_flashdriver "https://github.com/elecskku/stm32v3/blob/main/main.c"
click node_bmp "https://github.com/elecskku/stm32v3/blob/main/main.c"
click node_crc "https://github.com/elecskku/stm32v3/blob/main/main.c"
click node_imagework "https://github.com/elecskku/stm32v3/blob/main/main.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_cli,node_hostcommands,node_packetbuilder toneBlue
class node_dispatch,node_transfer,node_crc,node_imagework toneAmber
class node_flashdriver,node_flash,node_bmp toneMint
class node_operator,node_serial toneIndigo
```

## Components

### Windows host

- [CLI and demo](https://github.com/elecskku/stm32v3/blob/main/main_clean.cpp): `main_clean.cpp`
- [Host commands](https://github.com/elecskku/stm32v3/blob/main/main_clean.cpp): `main_clean.cpp`
- [Packet builder](https://github.com/elecskku/stm32v3/blob/main/main_clean.cpp): `main_clean.cpp`

### STM32 firmware

- [Command dispatch](https://github.com/elecskku/stm32v3/blob/main/main.c): `main.c`
- [Packet transfer](https://github.com/elecskku/stm32v3/blob/main/main.c): `main.c`
- [CRC checks](https://github.com/elecskku/stm32v3/blob/main/main.c): `main.c`
- [Image processing](https://github.com/elecskku/stm32v3/blob/main/main.c): `main.c`

### Flash and image

- [SPI flash access](https://github.com/elecskku/stm32v3/blob/main/main.c): `main.c`
- **SPI flash**
- [BMP validation](https://github.com/elecskku/stm32v3/blob/main/main.c): `main.c`

### Other components

- **Operator**
- **UART link**

## Connections

- Operator → CLI and demo: runs (evidence: `main_clean.cpp`)
- CLI and demo → Host commands: dispatches (evidence: `main_clean.cpp`)
- Host commands → Packet builder: builds packets (evidence: `main_clean.cpp`)
- Host commands → UART link: sends commands (evidence: `main_clean.cpp`)
- UART link → Command dispatch: carries commands (evidence: `main.c`)
- Command dispatch → Packet transfer: handles writes (evidence: `main.c`)
- Command dispatch → SPI flash access: erases and reads (evidence: `main.c`)
- Packet transfer → SPI flash access: programs packets (evidence: `main.c`)
- SPI flash access → SPI flash: reads and writes (evidence: `main.c`)
- Command dispatch → CRC checks: checks transfers (evidence: `main.c`)
- Command dispatch → BMP validation: validates image (evidence: `main.c`)
- Command dispatch → Image processing: reports timing (evidence: `main.c`)
