# adiwwww/globussatproject2 architecture

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

- Interactive diagram: https://gitdiagram.com/adiwwww/globussatproject2
- Repository: https://github.com/adiwwww/globussatproject2

## Overview

##### Project type and purpose
- This is an embedded, real-time flight software project for the TEVEL-2 CubeSat.
- Written in C, it runs on an AT91SAM9G20 microcontroller under FreeRTOS.
- It coordinates onboard subsystems (power, communications, housekeeping, storage), exposing a hardware-abstracted API to upper layers.

##### File structure
Top-level directories/modules:
- GlobusSatProject/ – the flight software “application”
– src/ – application code, organized into InitSystem, SubSystemModules (Communication, Housekeeping, Maintenance, PowerManagement), utilities, and test/demo code
- hal/ – Board Support Package & Hardware Abstraction Layer
– at91/ – low-level peripheral drivers, linker scripts, startup code
– hal/ – generic driver interfaces (ADC, I2C, SPI, UART, LED, FRAM, NORflash, timing, watchdog)
– freertos/ – real-time OS source and ports
– hcc/ – file-system (HCC FAT) library
- satellite-subsystems/ – static library of higher-level satellite subsystem drivers (EPS, AntS, TRXVU, ADCS, Gecko, etc.)
- README.md – confirms use of FreeRTOS and describes project goals

##### Extracted insights from README
- FreeRTOS is the scheduling backbone.
- Silicon Labs’ “ISIS-SDK” provides development environment and additional support.
- Application leverages HAL, FreeRTOS, HCC (FAT/FRAM), and the satellite-subsystems library to manage hardware.

##### Elements
– Clear component labels (e.g., “FreeRTOS Kernel”, “EPS Driver”, “TelemetryCollector Task”).
- HAL & BSP (green),
- Middleware (blue),
- Subsystem Library (orange),
- Application Modules (purple).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Hardware Layer
    subgraph "Hardware Layer"
        AT91["MCU: AT91SAM9G20"]:::hardware
        Peripherals["On-board Peripherals\n(EPS, TRXVU, FRAM/NORflash,\nsensors, I2C/SPI/UART buses)"]:::hardware
    end

    %% BSP & HAL Layer
    subgraph "BSP & HAL"
        halAt91["BSP & HAL: at91\n(peripheral drivers, startup,\nlinker scripts)"]:::hal
        HAL_Drivers["Generic HAL Drivers\n(ADC, I2C, SPI, UART, LED, PWM)"]:::hal
        HAL_Storage["Storage Drivers\n(FRAM, NORflash)"]:::hal
        HAL_Timing["Timing & Watchdog\n(RTC, RTT, Time, WatchDogTimer)"]:::hal
        HAL_Lib["libHAL.a"]:::hal
    end

    %% Middleware Layer
    subgraph "Middleware"
        FreeRTOS["FreeRTOS Kernel & Ports"]:::middleware
        HCC["HCC FAT File System"]:::middleware
    end

    %% Subsystem Library Layer
    subgraph "Satellite-Subsystem Library"
        SubsysLib["Satellite-Subsystems Static Lib"]:::subsys
    end

    %% Application Layer
    subgraph "Application Layer"
        InitSystem["InitSystem"]:::app
        Comm["Communication Module"]:::app
        HK["Housekeeping Module"]:::app
        PM["Power Management Module"]:::app
        Maint["Maintenance Module"]:::app
        Core["Core & Utilities"]:::app
        Testing["Testing & Demos"]:::app
    end

    %% Flow Arrows
    AT91 -->|drives| halAt91
    Peripherals -->|via buses| HAL_Drivers
    Peripherals -->|via buses| HAL_Storage
    Peripherals -->|via buses| HAL_Timing

    halAt91 --> HAL_Drivers
    halAt91 --> HAL_Storage
    halAt91 --> HAL_Timing
    HAL_Drivers --> HAL_Lib
    HAL_Storage --> HAL_Lib
    HAL_Timing --> HAL_Lib

    HAL_Lib --> FreeRTOS
    HAL_Lib --> HCC

    FreeRTOS --> SubsysLib
    HCC --> SubsysLib

    SubsysLib --> InitSystem
    SubsysLib --> Comm
    SubsysLib --> HK
    SubsysLib --> PM
    SubsysLib --> Maint

    FreeRTOS --> InitSystem
    FreeRTOS --> Comm
    FreeRTOS --> HK
    FreeRTOS --> PM
    FreeRTOS --> Maint
    FreeRTOS --> Testing

    Core -->|provides shared APIs| InitSystem
    Core -->|provides shared APIs| Comm
    Core -->|provides shared APIs| HK
    Core -->|provides shared APIs| PM
    Core -->|provides shared APIs| Maint
    Core -->|provides shared APIs| Testing

    %% Click Events
    click halAt91 "https://github.com/adiwwww/globussatproject2/tree/main/hal/at91/"
    click HAL_Drivers "https://github.com/adiwwww/globussatproject2/tree/main/hal/hal/include/hal/Drivers/"
    click HAL_Storage "https://github.com/adiwwww/globussatproject2/tree/main/hal/hal/include/hal/Storage/"
    click HAL_Timing "https://github.com/adiwwww/globussatproject2/tree/main/hal/hal/include/hal/Timing/"
    click HAL_Lib "https://github.com/adiwwww/globussatproject2/blob/main/hal/hal/lib/libHAL.a"
    click FreeRTOS "https://github.com/adiwwww/globussatproject2/blob/main/hal/freertos/lib/libFreeRTOS.a"
    click HCC "https://github.com/adiwwww/globussatproject2/blob/main/hal/hcc/lib/libHCC.a"
    click SubsysLib "https://github.com/adiwwww/globussatproject2/blob/main/satellite-subsystems/satellite-subsystems/lib/libSatelliteSubsystems.a"
    click InitSystem "https://github.com/adiwwww/globussatproject2/blob/main/GlobusSatProject/src/InitSystem.h"
    click Comm "https://github.com/adiwwww/globussatproject2/blob/main/GlobusSatProject/src/SubSystemModules/Communication/SatCommandHandler.h"
    click HK "https://github.com/adiwwww/globussatproject2/blob/main/GlobusSatProject/src/SubSystemModules/Housekepping/TelemetryCollector.h"
    click PM "https://github.com/adiwwww/globussatproject2/blob/main/GlobusSatProject/src/SubSystemModules/PowerManagment/EPS.h"
    click Maint "https://github.com/adiwwww/globussatproject2/blob/main/GlobusSatProject/src/SubSystemModules/Maintenance/Maintenance.h"
    click Core "https://github.com/adiwwww/globussatproject2/blob/main/GlobusSatProject/src/main.h"
    click Testing "https://github.com/adiwwww/globussatproject2/blob/main/GlobusSatProject/src/TestingDemos/MainTest.h"

    %% Styles
    classDef hardware fill:#DDDDDD,stroke:#333,stroke-width:1px
    classDef hal fill:#B2E699,stroke:#333,stroke-width:1px
    classDef middleware fill:#99CCFF,stroke:#333,stroke-width:1px
    classDef subsys fill:#FFCC99,stroke:#333,stroke-width:1px
    classDef app fill:#C39BD3,stroke:#333,stroke-width:1px
```
