# nasa-jpl/embedded-gcov architecture

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

- Interactive diagram: https://gitdiagram.com/nasa-jpl/embedded-gcov
- Repository: https://github.com/nasa-jpl/embedded-gcov

## Overview

Embedded gcov lets instrumented firmware collect GCC coverage counters and export them without requiring a filesystem, OS, or standard C library. The documented workflow is to initialize coverage constructors after system setup, then invoke the dump API when coverage should be extracted. Internally, the runtime tracks registered gcov data, converts it to gcda format, and emits it through configurable outputs. The excerpts show the conversion and output paths; optional output modes and constructor support are configuration-dependent. The example and post-processing scripts are not mapped because their contents were not sampled.

Main entry points: [`code/gcov_public.c`](https://github.com/nasa-jpl/embedded-gcov/blob/main/code/gcov_public.c) (Coverage registry), [`code/gcov_public.h`](https://github.com/nasa-jpl/embedded-gcov/blob/main/code/gcov_public.h) (Public coverage API), [`code/gcov_gcc.c`](https://github.com/nasa-jpl/embedded-gcov/blob/main/code/gcov_gcc.c) (gcda conversion), [`code/gcov_printf.c`](https://github.com/nasa-jpl/embedded-gcov/blob/main/code/gcov_printf.c) (Serial formatter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_firmware["Firmware integration"]
  node_app(("Instrumented firmware"))
  node_api["Public coverage API<br/>[gcov_public.h]"]
end

subgraph group_runtime["Coverage runtime"]
  node_registry["Coverage registry<br/>[gcov_public.c]"]
  node_serializer["gcda conversion<br/>[gcov_gcc.c]"]
end

subgraph group_transport["Output transport"]
  node_output["Coverage output<br/>[gcov_public.c]"]
  node_printf["Serial formatter<br/>[gcov_printf.c]"]
  node_host(("Host gcov tools"))
end

node_app -->|"calls init and dump"| node_api
node_api -->|"exposes runtime"| node_registry
node_registry -->|"converts coverage data"| node_serializer
node_registry -->|"emits gcda data"| node_output
node_output -->|"formats serial output"| node_printf
node_output -.->|"exports coverage data"| node_host

click node_api "https://github.com/nasa-jpl/embedded-gcov/blob/main/code/gcov_public.h"
click node_registry "https://github.com/nasa-jpl/embedded-gcov/blob/main/code/gcov_public.c"
click node_serializer "https://github.com/nasa-jpl/embedded-gcov/blob/main/code/gcov_gcc.c"
click node_output "https://github.com/nasa-jpl/embedded-gcov/blob/main/code/gcov_public.c"
click node_printf "https://github.com/nasa-jpl/embedded-gcov/blob/main/code/gcov_printf.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_app,node_api toneBlue
class node_registry,node_serializer toneAmber
class node_output,node_printf,node_host toneMint
```

## Components

### Firmware integration

- **Instrumented firmware**
- [Public coverage API](https://github.com/nasa-jpl/embedded-gcov/blob/main/code/gcov_public.h): `code/gcov_public.h`

### Coverage runtime

- [Coverage registry](https://github.com/nasa-jpl/embedded-gcov/blob/main/code/gcov_public.c): `code/gcov_public.c`
- [gcda conversion](https://github.com/nasa-jpl/embedded-gcov/blob/main/code/gcov_gcc.c): `code/gcov_gcc.c`

### Output transport

- [Coverage output](https://github.com/nasa-jpl/embedded-gcov/blob/main/code/gcov_public.c): `code/gcov_public.c`
- [Serial formatter](https://github.com/nasa-jpl/embedded-gcov/blob/main/code/gcov_printf.c): `code/gcov_printf.c`
- **Host gcov tools**

## Connections

- Instrumented firmware → Public coverage API: calls init and dump (evidence: `README.md`)
- Public coverage API → Coverage registry: exposes runtime (evidence: `code/gcov_public.h`)
- Coverage registry → gcda conversion: converts coverage data (evidence: `code/gcov_public.c`)
- Coverage registry → Coverage output: emits gcda data (evidence: `code/gcov_public.c`)
- Coverage output → Serial formatter: formats serial output
- Coverage output → Host gcov tools: exports coverage data (evidence: `README.md`)
