# nasa/fprime architecture

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

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

## Overview

##### High-level domains and modules
- Framework Core – This is the heart of F´. It includes the flight software run-time with core services such as message queues, task management, scheduling, logging, telemetry, command handling, and the state machine framework.
- Autocoders & Code Generation – F´ features a rich set of tools (found in directories like “Autocoders”, “Fpp”, and “cmake/autocoder”) that parse models (typically XML or FPP descriptions) and auto-generate C++ (and sometimes Python) code. This module translates design specifications into concrete component implementations.
- Operating System Abstraction – Represent the “Os” directory and its subdirectories (Linux, Darwin, Posix, Stub, etc.) which hide platform-specific details behind a uniform interface. This layer ensures the framework is multi-platform and “flight proven.”
- External Interfaces – You may include external resources such as ground interfaces (mentioned in user documentation) or integration points like the F´ community contributions and bootstrap tools.

##### Relationships and data flow
- How the OS abstraction layer underpins the core by providing device drivers (found in “Drv” and “Os”) to support hardware interfaces (e.g., SPI, I2C, UART, Ethernet).
- Build System and CMake configuration (look in the “cmake” folder) to illustrate how the multiple components are brought together and how settings/configurations propagate to the final executable.
- Testing and simulation modules (e.g., “FppTest”, “STest”, “TestUtils”, “googletest” directories) that support unit and integration testing across components.
- Modular “Svc” components offering specialized functionalities (for telemetry channeling, command sequencers, event logging, etc.) interacting via well-defined interfaces (e.g., FPP files, message queues).

##### Architectural patterns and design principles
- Abstraction and Separation of Concerns – Clearly indicate separation between the platform-independent core (Fw, Autocoders) and the OS-specific implementations (“Os” subdirectories). Also, note the distinct responsibility boundaries (e.g., logging vs. command dispatching vs. telecommand processing).
- Extensibility – Highlight the plug-in-like nature of F´ where additional components (from the “Svc” or “Ref” directories) may be added with custom interfaces if needed.

##### Final assembly
- Testing and utility tools on the periphery to indicate support for integration, deployment, and CI/CD.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Autocoders & Code Generation"
        AC["Autocoder (FPP Parser & Code Generator)"]:::autocoder
    end

    subgraph "Framework Core"
        FC["Flight Software Run-Time & Core Services (message queues, scheduling, logging, telemetry, command handling, state machine)"]:::core
    end

    subgraph "Flight Software Components"
        SVC["Svc Components (ActiveLogger, BufferManager, CmdDispatcher, PolyDb, etc.)"]:::component
        DRV["Drv Components (Device Drivers: SPI, I2C, UART, Ethernet)"]:::component
        REF["Ref Components (Reference implementations)"]:::component
    end

    subgraph "Operating System Abstraction"
        OS["Os Abstraction (Linux, Darwin, Posix, Stub, etc.)"]:::os
    end

    subgraph "Utility and Support Layers"
        UTILS["Utils & CMake Build System (build, deploy, configuration)"]:::utility
        TEST["TestUtils & Testing Tools (FppTest, STest, googletest)"]:::utility
    end

    %% Relationships and Data Flow
    AC -->|"generates models"| FC
    FC -->|"integrates with"| SVC
    FC -->|"integrates with"| DRV
    FC -->|"integrates with"| REF
    OS -->|"supports"| FC
    UTILS -->|"configures/builds"| FC
    TEST -->|"validates"| FC

    %% Click Events
    click FC "https://github.com/nasa/fprime/tree/devel/Fw/"
    click AC "https://github.com/nasa/fprime/tree/devel/Autocoders/"
    click SVC "https://github.com/nasa/fprime/tree/devel/Svc/"
    click DRV "https://github.com/nasa/fprime/tree/devel/Drv/"
    click REF "https://github.com/nasa/fprime/tree/devel/Ref/"
    click OS "https://github.com/nasa/fprime/tree/devel/Os/"
    click UTILS "https://github.com/nasa/fprime/tree/devel/Utils/"
    click TEST "https://github.com/nasa/fprime/tree/devel/TestUtils/"

    %% Styles
    classDef autocoder fill:#f9d5e5,stroke:#d6336c,stroke-width:2px;
    classDef core fill:#d5e5f9,stroke:#4382bf,stroke-width:2px;
    classDef component fill:#d5f9e5,stroke:#279978,stroke-width:2px;
    classDef os fill:#f9f3d5,stroke:#bf942d,stroke-width:2px;
    classDef utility fill:#ead5f9,stroke:#8432bf,stroke-width:2px;
```
