# nasa/cs architecture

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

- Interactive diagram: https://gitdiagram.com/nasa/cs
- Repository: https://github.com/nasa/cs

## Overview

CS is a cFS application that checks the integrity of onboard memory by calculating CRCs and comparing them with baselines established at startup. Its principal workflow is to initialize checksum definitions and state, perform background checks across system and user-selected regions, and report or recompute baselines in response to commands. The graph preserves the documented coverage areas and the command, compute, table-processing, and utility layers. Evidence is limited to the README, source-index references, and sampled excerpts; unsampled module interactions are not asserted.

Main entry points: [`fsw/src/cs_dispatch.c`](https://github.com/nasa/cs/blob/dev/fsw/src/cs_dispatch.c) (Command dispatch), [`fsw/src/cs_table_processing.c`](https://github.com/nasa/cs/blob/dev/fsw/src/cs_table_processing.c) (Definition processing), [`fsw/src/cs_compute.c`](https://github.com/nasa/cs/blob/dev/fsw/src/cs_compute.c) (CRC computation), [`fsw/src/cs_app.c`](https://github.com/nasa/cs/blob/dev/fsw/src/cs_app.c) (CS application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Application runtime"]
  node_app["CS application<br/>[cs_app.c]"]
  node_dispatch["Command dispatch<br/>[cs_dispatch.c]"]
  node_eds_dispatch["EDS dispatch<br/>[cs_eds_dispatch.c]"]
  node_init["Startup initialization<br/>[cs_init.c]"]
end

subgraph group_commands["Command handling"]
  node_app_commands["Application commands<br/>[cs_app_cmds.c]"]
  node_cmds["Checksum commands<br/>[cs_cmds.c]"]
  node_eeprom["EEPROM commands<br/>[cs_eeprom_cmds.c]"]
  node_memory["Memory commands<br/>[cs_memory_cmds.c]"]
  node_table_commands["Table commands<br/>[cs_table_cmds.c]"]
end

subgraph group_checks["Checksum processing"]
  node_compute["CRC computation<br/>[cs_compute.c]"]
  node_utils["Background checks<br/>[cs_utils.c]"]
end

subgraph group_tables["Definitions and state"]
  node_table_processing["Definition processing"]
  node_app_table["Application definitions<br/>[cs_apptbl.c]"]
  node_eeprom_table["EEPROM definitions<br/>[cs_eepromtbl.c]"]
  node_memory_table["Memory definitions<br/>[cs_memorytbl.c]"]
  node_tables_table["Table definitions<br/>[cs_tablestbl.c]"]
  node_config["CS configuration"]
end

node_ground(("Ground command source"))
node_cfs["cFS services"]

node_ground -.->|"sends commands"| node_dispatch
node_dispatch -.->|"routes commands"| node_cmds
node_dispatch -.->|"routes commands"| node_app_commands
node_dispatch -.->|"routes commands"| node_eeprom
node_dispatch -.->|"routes commands"| node_memory
node_dispatch -.->|"routes commands"| node_table_commands
node_app -.->|"dispatches messages"| node_dispatch
node_app -.->|"initializes"| node_init
node_init -.->|"initializes tables"| node_table_processing
node_cmds -->|"requests recompute"| node_compute
node_cmds -->|"controls checks"| node_utils
node_compute -->|"uses check helpers"| node_utils
node_eeprom -->|"requests recompute"| node_compute
node_eeprom -->|"uses check helpers"| node_utils
node_memory -.->|"requests recompute"| node_compute
node_table_commands -.->|"manages definitions"| node_table_processing
node_app -.->|"uses services"| node_cfs
node_utils -.->|"checks CRCs"| node_compute
node_compute -.->|"reads system regions"| node_cfs
node_table_processing -.->|"processes definitions"| node_app_table
node_table_processing -.->|"processes definitions"| node_eeprom_table
node_table_processing -.->|"processes definitions"| node_memory_table
node_table_processing -.->|"processes definitions"| node_tables_table
node_config -.->|"configures"| node_app

click node_app "https://github.com/nasa/cs/blob/dev/fsw/src/cs_app.c"
click node_dispatch "https://github.com/nasa/cs/blob/dev/fsw/src/cs_dispatch.c"
click node_eds_dispatch "https://github.com/nasa/cs/blob/dev/fsw/src/cs_eds_dispatch.c"
click node_init "https://github.com/nasa/cs/blob/dev/fsw/src/cs_init.c"
click node_app_commands "https://github.com/nasa/cs/blob/dev/fsw/src/cs_app_cmds.c"
click node_cmds "https://github.com/nasa/cs/blob/dev/fsw/src/cs_cmds.c"
click node_eeprom "https://github.com/nasa/cs/blob/dev/fsw/src/cs_eeprom_cmds.c"
click node_memory "https://github.com/nasa/cs/blob/dev/fsw/src/cs_memory_cmds.c"
click node_table_commands "https://github.com/nasa/cs/blob/dev/fsw/src/cs_table_cmds.c"
click node_compute "https://github.com/nasa/cs/blob/dev/fsw/src/cs_compute.c"
click node_utils "https://github.com/nasa/cs/blob/dev/fsw/src/cs_utils.c"
click node_table_processing "https://github.com/nasa/cs/blob/dev/fsw/src/cs_table_processing.c"
click node_app_table "https://github.com/nasa/cs/blob/dev/fsw/tables/cs_apptbl.c"
click node_eeprom_table "https://github.com/nasa/cs/blob/dev/fsw/tables/cs_eepromtbl.c"
click node_memory_table "https://github.com/nasa/cs/blob/dev/fsw/tables/cs_memorytbl.c"
click node_tables_table "https://github.com/nasa/cs/blob/dev/fsw/tables/cs_tablestbl.c"
click node_config "https://github.com/nasa/cs/blob/dev/config/default_cs_msgstruct.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_app,node_dispatch,node_eds_dispatch,node_init toneBlue
class node_app_commands,node_cmds,node_eeprom,node_memory,node_table_commands toneAmber
class node_compute,node_utils toneMint
class node_table_processing,node_app_table,node_eeprom_table,node_memory_table,node_tables_table,node_config toneRose
class node_ground,node_cfs toneIndigo
```

## Components

### Application runtime

- [CS application](https://github.com/nasa/cs/blob/dev/fsw/src/cs_app.c): `fsw/src/cs_app.c`
- [Command dispatch](https://github.com/nasa/cs/blob/dev/fsw/src/cs_dispatch.c): `fsw/src/cs_dispatch.c`
- [EDS dispatch](https://github.com/nasa/cs/blob/dev/fsw/src/cs_eds_dispatch.c): `fsw/src/cs_eds_dispatch.c`
- [Startup initialization](https://github.com/nasa/cs/blob/dev/fsw/src/cs_init.c): `fsw/src/cs_init.c`

### Command handling

- [Application commands](https://github.com/nasa/cs/blob/dev/fsw/src/cs_app_cmds.c): `fsw/src/cs_app_cmds.c`
- [Checksum commands](https://github.com/nasa/cs/blob/dev/fsw/src/cs_cmds.c): `fsw/src/cs_cmds.c`
- [EEPROM commands](https://github.com/nasa/cs/blob/dev/fsw/src/cs_eeprom_cmds.c): `fsw/src/cs_eeprom_cmds.c`
- [Memory commands](https://github.com/nasa/cs/blob/dev/fsw/src/cs_memory_cmds.c): `fsw/src/cs_memory_cmds.c`
- [Table commands](https://github.com/nasa/cs/blob/dev/fsw/src/cs_table_cmds.c): `fsw/src/cs_table_cmds.c`

### Checksum processing

- [CRC computation](https://github.com/nasa/cs/blob/dev/fsw/src/cs_compute.c): `fsw/src/cs_compute.c`
- [Background checks](https://github.com/nasa/cs/blob/dev/fsw/src/cs_utils.c): `fsw/src/cs_utils.c`

### Definitions and state

- [Definition processing](https://github.com/nasa/cs/blob/dev/fsw/src/cs_table_processing.c): `fsw/src/cs_table_processing.c`
- [Application definitions](https://github.com/nasa/cs/blob/dev/fsw/tables/cs_apptbl.c): `fsw/tables/cs_apptbl.c`
- [EEPROM definitions](https://github.com/nasa/cs/blob/dev/fsw/tables/cs_eepromtbl.c): `fsw/tables/cs_eepromtbl.c`
- [Memory definitions](https://github.com/nasa/cs/blob/dev/fsw/tables/cs_memorytbl.c): `fsw/tables/cs_memorytbl.c`
- [Table definitions](https://github.com/nasa/cs/blob/dev/fsw/tables/cs_tablestbl.c): `fsw/tables/cs_tablestbl.c`
- [CS configuration](https://github.com/nasa/cs/blob/dev/config/default_cs_msgstruct.h): `config/default_cs_msgstruct.h`

### Other components

- **Ground command source**
- **cFS services**

## Connections

- Ground command source → Command dispatch: sends commands
- Command dispatch → Checksum commands: routes commands
- Command dispatch → Application commands: routes commands
- Command dispatch → EEPROM commands: routes commands
- Command dispatch → Memory commands: routes commands
- Command dispatch → Table commands: routes commands
- CS application → Command dispatch: dispatches messages
- CS application → Startup initialization: initializes
- Startup initialization → Definition processing: initializes tables
- Checksum commands → CRC computation: requests recompute (evidence: `fsw/src/cs_cmds.c`)
- Checksum commands → Background checks: controls checks (evidence: `fsw/src/cs_cmds.c`)
- CRC computation → Background checks: uses check helpers (evidence: `fsw/src/cs_compute.c`)
- EEPROM commands → CRC computation: requests recompute (evidence: `fsw/src/cs_eeprom_cmds.c`)
- EEPROM commands → Background checks: uses check helpers (evidence: `fsw/src/cs_eeprom_cmds.c`)
- Memory commands → CRC computation: requests recompute
- Table commands → Definition processing: manages definitions
- CS application → cFS services: uses services
- Background checks → CRC computation: checks CRCs
- CRC computation → cFS services: reads system regions
- Definition processing → Application definitions: processes definitions (evidence: `fsw/src/cs_table_processing.c`)
- Definition processing → EEPROM definitions: processes definitions (evidence: `fsw/src/cs_table_processing.c`)
- Definition processing → Memory definitions: processes definitions (evidence: `fsw/src/cs_table_processing.c`)
- Definition processing → Table definitions: processes definitions (evidence: `fsw/src/cs_table_processing.c`)
- CS configuration → CS application: configures
