# stncalex/flxc1000-rpi architecture

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

- Interactive diagram: https://gitdiagram.com/stncalex/flxc1000-rpi
- Repository: https://github.com/stncalex/flxc1000-rpi

## Overview

FLXC1000-RPI is a Raspberry Pi ECU simulator that exposes UDS diagnostics over DoIP. A tester connects to the DoIP server, which forwards diagnostic requests to the active ECU variant; the app variant additionally provides diagnostic/GPIO behavior, while the boot variant supports flash-programming services. At startup, init mounts the SD-card partitions and selects the app or boot binary from persistent boot state. The graph retains the documented UDS library as a legacy branch; unsampled implementation details are omitted, and edges are limited to relationships shown in excerpts or the README.

Main entry points: [`flxc1000-app/src/main.rs`](https://github.com/stncalex/flxc1000-rpi/blob/main/flxc1000-app/src/main.rs) (App ECU), [`flxc1000-doip/src/server.rs`](https://github.com/stncalex/flxc1000-rpi/blob/main/flxc1000-doip/src/server.rs) (DoIP Server), [`flxc1000-init/src/main.rs`](https://github.com/stncalex/flxc1000-rpi/blob/main/flxc1000-init/src/main.rs) (Init Selector), [`flxc1000-doip/src/connection.rs`](https://github.com/stncalex/flxc1000-rpi/blob/main/flxc1000-doip/src/connection.rs) (TCP Connection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_startup["Startup and Boot"]
  node_kernel["Linux Kernel"]
  node_init["Init Selector<br/>[main.rs]"]
  node_bootstate[("Boot State")]
end

subgraph group_doip["DoIP Transport"]
  node_doipserver["DoIP Server<br/>[server.rs]"]
  node_connection["TCP Connection<br/>[connection.rs]"]
  node_header["DoIP Header<br/>[header.rs]"]
  node_messages["DoIP Messages<br/>[message.rs]"]
end

subgraph group_variants["ECU Variants"]
  node_app["App ECU<br/>[main.rs]"]
  node_boot["Boot ECU<br/>[main.rs]"]
  node_gpio["GPIO Outputs<br/>[main.rs]"]
end

subgraph group_uds["UDS Support"]
  node_ace["ace-server"]
  node_legacydispatcher["Legacy Dispatcher<br/>[dispatcher.rs]"]
  node_sessions["Session State<br/>[session.rs]"]
  node_security["Security Access<br/>[security.rs]"]
  node_nrc["Negative Responses<br/>[nrc.rs]"]
end

node_tester(("DoIP Tester"))

node_kernel -->|"starts"| node_init
node_init -->|"reads"| node_bootstate
node_init -->|"executes"| node_app
node_init -->|"executes"| node_boot
node_tester -->|"sends DoIP"| node_doipserver
node_doipserver -->|"dispatches TCP"| node_connection
node_doipserver -->|"parses UDP"| node_header
node_doipserver -->|"encodes announcements"| node_messages
node_connection -->|"parses frames"| node_header
node_connection -->|"handles payloads"| node_messages
node_app -->|"starts"| node_doipserver
node_connection -->|"forwards UDS"| node_app
node_app -->|"uses UDS services"| node_ace
node_boot -->|"uses UDS services"| node_ace
node_app -->|"controls"| node_gpio
node_app -->|"writes reset state"| node_bootstate
node_legacydispatcher -->|"manages"| node_sessions
node_legacydispatcher -->|"checks"| node_security
node_legacydispatcher -->|"returns errors"| node_nrc
node_security -->|"reports failures"| node_nrc

click node_init "https://github.com/stncalex/flxc1000-rpi/blob/main/flxc1000-init/src/main.rs"
click node_bootstate "https://github.com/stncalex/flxc1000-rpi/tree/main/buildroot/board/flxc1000-rpi/rootfs-overlay"
click node_doipserver "https://github.com/stncalex/flxc1000-rpi/blob/main/flxc1000-doip/src/server.rs"
click node_connection "https://github.com/stncalex/flxc1000-rpi/blob/main/flxc1000-doip/src/connection.rs"
click node_header "https://github.com/stncalex/flxc1000-rpi/blob/main/flxc1000-doip/src/header.rs"
click node_messages "https://github.com/stncalex/flxc1000-rpi/blob/main/flxc1000-doip/src/message.rs"
click node_app "https://github.com/stncalex/flxc1000-rpi/blob/main/flxc1000-app/src/main.rs"
click node_boot "https://github.com/stncalex/flxc1000-rpi/blob/main/flxc1000-boot/src/main.rs"
click node_gpio "https://github.com/stncalex/flxc1000-rpi/blob/main/flxc1000-app/src/main.rs"
click node_legacydispatcher "https://github.com/stncalex/flxc1000-rpi/blob/main/flxc1000-uds/src/dispatcher.rs"
click node_sessions "https://github.com/stncalex/flxc1000-rpi/blob/main/flxc1000-uds/src/session.rs"
click node_security "https://github.com/stncalex/flxc1000-rpi/blob/main/flxc1000-uds/src/security.rs"
click node_nrc "https://github.com/stncalex/flxc1000-rpi/blob/main/flxc1000-uds/src/nrc.rs"

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_kernel,node_init,node_bootstate toneBlue
class node_doipserver,node_connection,node_header,node_messages toneAmber
class node_app,node_boot,node_gpio toneMint
class node_ace,node_legacydispatcher,node_sessions,node_security,node_nrc toneRose
class node_tester toneIndigo
```

## Components

### Startup and Boot

- **Linux Kernel**
- [Init Selector](https://github.com/stncalex/flxc1000-rpi/blob/main/flxc1000-init/src/main.rs): `flxc1000-init/src/main.rs`
- [Boot State](https://github.com/stncalex/flxc1000-rpi/tree/main/buildroot/board/flxc1000-rpi/rootfs-overlay): `buildroot/board/flxc1000-rpi/rootfs-overlay`

### DoIP Transport

- [DoIP Server](https://github.com/stncalex/flxc1000-rpi/blob/main/flxc1000-doip/src/server.rs): `flxc1000-doip/src/server.rs`
- [TCP Connection](https://github.com/stncalex/flxc1000-rpi/blob/main/flxc1000-doip/src/connection.rs): `flxc1000-doip/src/connection.rs`
- [DoIP Header](https://github.com/stncalex/flxc1000-rpi/blob/main/flxc1000-doip/src/header.rs): `flxc1000-doip/src/header.rs`
- [DoIP Messages](https://github.com/stncalex/flxc1000-rpi/blob/main/flxc1000-doip/src/message.rs): `flxc1000-doip/src/message.rs`

### ECU Variants

- [App ECU](https://github.com/stncalex/flxc1000-rpi/blob/main/flxc1000-app/src/main.rs): `flxc1000-app/src/main.rs`
- [Boot ECU](https://github.com/stncalex/flxc1000-rpi/blob/main/flxc1000-boot/src/main.rs): `flxc1000-boot/src/main.rs`
- [GPIO Outputs](https://github.com/stncalex/flxc1000-rpi/blob/main/flxc1000-app/src/main.rs): `flxc1000-app/src/main.rs`

### UDS Support

- **ace-server**
- [Legacy Dispatcher](https://github.com/stncalex/flxc1000-rpi/blob/main/flxc1000-uds/src/dispatcher.rs): `flxc1000-uds/src/dispatcher.rs`
- [Session State](https://github.com/stncalex/flxc1000-rpi/blob/main/flxc1000-uds/src/session.rs): `flxc1000-uds/src/session.rs`
- [Security Access](https://github.com/stncalex/flxc1000-rpi/blob/main/flxc1000-uds/src/security.rs): `flxc1000-uds/src/security.rs`
- [Negative Responses](https://github.com/stncalex/flxc1000-rpi/blob/main/flxc1000-uds/src/nrc.rs): `flxc1000-uds/src/nrc.rs`

### Other components

- **DoIP Tester**

## Connections

- Linux Kernel → Init Selector: starts (evidence: `README.md`)
- Init Selector → Boot State: reads (evidence: `README.md`)
- Init Selector → App ECU: executes (evidence: `README.md`)
- Init Selector → Boot ECU: executes (evidence: `README.md`)
- DoIP Tester → DoIP Server: sends DoIP (evidence: `README.md`)
- DoIP Server → TCP Connection: dispatches TCP (evidence: `flxc1000-doip/src/server.rs`)
- DoIP Server → DoIP Header: parses UDP (evidence: `flxc1000-doip/src/server.rs`)
- DoIP Server → DoIP Messages: encodes announcements (evidence: `flxc1000-doip/src/server.rs`)
- TCP Connection → DoIP Header: parses frames (evidence: `flxc1000-doip/src/connection.rs`)
- TCP Connection → DoIP Messages: handles payloads (evidence: `flxc1000-doip/src/connection.rs`)
- App ECU → DoIP Server: starts (evidence: `flxc1000-app/src/main.rs`)
- TCP Connection → App ECU: forwards UDS (evidence: `flxc1000-doip/src/connection.rs`)
- App ECU → ace-server: uses UDS services (evidence: `README.md`)
- Boot ECU → ace-server: uses UDS services (evidence: `README.md`)
- App ECU → GPIO Outputs: controls (evidence: `flxc1000-app/src/main.rs`)
- App ECU → Boot State: writes reset state (evidence: `flxc1000-app/src/main.rs`)
- Legacy Dispatcher → Session State: manages (evidence: `flxc1000-uds/src/dispatcher.rs`)
- Legacy Dispatcher → Security Access: checks (evidence: `flxc1000-uds/src/dispatcher.rs`)
- Legacy Dispatcher → Negative Responses: returns errors (evidence: `flxc1000-uds/src/dispatcher.rs`)
- Security Access → Negative Responses: reports failures (evidence: `flxc1000-uds/src/security.rs`)
