# lordaftereight/armos architecture

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

- Interactive diagram: https://gitdiagram.com/lordaftereight/armos
- Repository: https://github.com/lordaftereight/armos

## Overview

ArmOS is a bare-metal STM32H745 OS, booted from MCU flash into an XIP image in NOR and using SDRAM as main memory. The principal path is bootloader handoff, OS startup, then process execution and display/log output. Its runtime also includes board/HAL support, a process scheduler and registry, heap management, and NAND storage. The README documents the boot stages and storage role; the sampled code shows selected scheduler, UI, display, and UART relationships, so unsampled internal wiring is not inferred.

Main entry points: [`src/kui/mod.rs`](https://github.com/lordaftereight/armos/blob/main/src/kui/mod.rs) (Window UI), [`src/drivers/display/mod.rs`](https://github.com/lordaftereight/armos/blob/main/src/drivers/display/mod.rs) (Framebuffer display), [`src/apps/proctracker.rs`](https://github.com/lordaftereight/armos/blob/main/src/apps/proctracker.rs) (Process tracker), [`src/hal/uart.rs`](https://github.com/lordaftereight/armos/blob/main/src/hal/uart.rs) (UART output)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_boot["Boot and startup"]
  node_bootloader["Stage-0 bootloader<br/>[bootloader.rs]"]
  node_armos["ArmOS entry<br/>[main.rs]"]
  node_startup["Reset and vectors<br/>[reset.rs]"]
end

subgraph group_core["OS core"]
  node_heap["Heap allocator<br/>[heap.rs]"]
  node_storage[("NAND storage<br/>[mod.rs]")]
  node_logging["Kernel logging<br/>[mod.rs]"]
end

subgraph group_process["Processes and apps"]
  node_scheduler["Process scheduler<br/>[csched.rs]"]
  node_registry[("Process registry<br/>[registry.rs]")]
  node_tracker["Process tracker<br/>[proctracker.rs]"]
end

subgraph group_io["Board and I/O"]
  node_board["Board configuration<br/>[mod.rs]"]
  node_hal["STM32 HAL<br/>[pac.rs]"]
  node_gpio["Board GPIO map<br/>[gpio.rs]"]
  node_uart["UART output<br/>[uart.rs]"]
end

subgraph group_display["Display UI"]
  node_draw["Framebuffer drawing<br/>[kdraw.rs]"]
  node_fonts["UI fonts<br/>[kfont.rs]"]
  node_ui["Window UI<br/>[mod.rs]"]
  node_display["Framebuffer display<br/>[mod.rs]"]
  node_ltdc["LTDC scanout<br/>[ltdc.rs]"]
  node_soft["Software scanout<br/>[soft.rs]"]
end

node_hardware(("STM32H745"))

node_hardware -->|"boots"| node_bootloader
node_bootloader -->|"jumps to"| node_armos
node_armos -->|"enters"| node_startup
node_board -->|"maps pins"| node_gpio
node_gpio -->|"uses GPIO HAL"| node_hal
node_uart -->|"accesses peripherals"| node_hal
node_uart -->|"uses pin config"| node_board
node_scheduler -->|"updates processes"| node_registry
node_tracker -->|"reads process table"| node_registry
node_tracker -->|"renders tracker"| node_ui
node_tracker -->|"logs status"| node_logging
node_ui -->|"draws chrome"| node_draw
node_ui -->|"uses fonts"| node_fonts
node_ui -->|"presents frame"| node_display
node_display -->|"installs framebuffer"| node_draw
node_display -->|"starts or updates"| node_ltdc
node_display -->|"starts or updates"| node_soft

click node_bootloader "https://github.com/lordaftereight/armos/blob/main/src/bin/bootloader.rs"
click node_armos "https://github.com/lordaftereight/armos/blob/main/src/main.rs"
click node_startup "https://github.com/lordaftereight/armos/blob/main/src/startup/reset.rs"
click node_board "https://github.com/lordaftereight/armos/blob/main/src/board/mod.rs"
click node_hal "https://github.com/lordaftereight/armos/blob/main/src/hal/pac.rs"
click node_gpio "https://github.com/lordaftereight/armos/blob/main/src/board/gpio.rs"
click node_uart "https://github.com/lordaftereight/armos/blob/main/src/hal/uart.rs"
click node_heap "https://github.com/lordaftereight/armos/blob/main/src/heap.rs"
click node_storage "https://github.com/lordaftereight/armos/blob/main/src/storage/mod.rs"
click node_scheduler "https://github.com/lordaftereight/armos/blob/main/src/proc/csched.rs"
click node_registry "https://github.com/lordaftereight/armos/blob/main/src/proc/registry.rs"
click node_tracker "https://github.com/lordaftereight/armos/blob/main/src/apps/proctracker.rs"
click node_draw "https://github.com/lordaftereight/armos/blob/main/src/kui/kdraw.rs"
click node_fonts "https://github.com/lordaftereight/armos/blob/main/src/kui/kfont.rs"
click node_ui "https://github.com/lordaftereight/armos/blob/main/src/kui/mod.rs"
click node_display "https://github.com/lordaftereight/armos/blob/main/src/drivers/display/mod.rs"
click node_ltdc "https://github.com/lordaftereight/armos/blob/main/src/drivers/display/ltdc.rs"
click node_soft "https://github.com/lordaftereight/armos/blob/main/src/drivers/display/soft.rs"
click node_logging "https://github.com/lordaftereight/armos/blob/main/src/klog/mod.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_bootloader,node_armos,node_startup toneBlue
class node_heap,node_storage,node_logging toneAmber
class node_scheduler,node_registry,node_tracker toneMint
class node_board,node_hal,node_gpio,node_uart toneRose
class node_draw,node_fonts,node_ui,node_display,node_ltdc,node_soft,node_hardware toneIndigo
```

## Components

### Boot and startup

- [Stage-0 bootloader](https://github.com/lordaftereight/armos/blob/main/src/bin/bootloader.rs): `src/bin/bootloader.rs`
- [ArmOS entry](https://github.com/lordaftereight/armos/blob/main/src/main.rs): `src/main.rs`
- [Reset and vectors](https://github.com/lordaftereight/armos/blob/main/src/startup/reset.rs): `src/startup/reset.rs`

### OS core

- [Heap allocator](https://github.com/lordaftereight/armos/blob/main/src/heap.rs): `src/heap.rs`
- [NAND storage](https://github.com/lordaftereight/armos/blob/main/src/storage/mod.rs): `src/storage/mod.rs`
- [Kernel logging](https://github.com/lordaftereight/armos/blob/main/src/klog/mod.rs): `src/klog/mod.rs`

### Processes and apps

- [Process scheduler](https://github.com/lordaftereight/armos/blob/main/src/proc/csched.rs): `src/proc/csched.rs`
- [Process registry](https://github.com/lordaftereight/armos/blob/main/src/proc/registry.rs): `src/proc/registry.rs`
- [Process tracker](https://github.com/lordaftereight/armos/blob/main/src/apps/proctracker.rs): `src/apps/proctracker.rs`

### Board and I/O

- [Board configuration](https://github.com/lordaftereight/armos/blob/main/src/board/mod.rs): `src/board/mod.rs`
- [STM32 HAL](https://github.com/lordaftereight/armos/blob/main/src/hal/pac.rs): `src/hal/pac.rs`
- [Board GPIO map](https://github.com/lordaftereight/armos/blob/main/src/board/gpio.rs): `src/board/gpio.rs`
- [UART output](https://github.com/lordaftereight/armos/blob/main/src/hal/uart.rs): `src/hal/uart.rs`

### Display UI

- [Framebuffer drawing](https://github.com/lordaftereight/armos/blob/main/src/kui/kdraw.rs): `src/kui/kdraw.rs`
- [UI fonts](https://github.com/lordaftereight/armos/blob/main/src/kui/kfont.rs): `src/kui/kfont.rs`
- [Window UI](https://github.com/lordaftereight/armos/blob/main/src/kui/mod.rs): `src/kui/mod.rs`
- [Framebuffer display](https://github.com/lordaftereight/armos/blob/main/src/drivers/display/mod.rs): `src/drivers/display/mod.rs`
- [LTDC scanout](https://github.com/lordaftereight/armos/blob/main/src/drivers/display/ltdc.rs): `src/drivers/display/ltdc.rs`
- [Software scanout](https://github.com/lordaftereight/armos/blob/main/src/drivers/display/soft.rs): `src/drivers/display/soft.rs`

### Other components

- **STM32H745**

## Connections

- STM32H745 → Stage-0 bootloader: boots (evidence: `README.md`)
- Stage-0 bootloader → ArmOS entry: jumps to (evidence: `README.md`)
- ArmOS entry → Reset and vectors: enters (evidence: `src/main.rs`)
- Board configuration → Board GPIO map: maps pins (evidence: `src/board/mod.rs`)
- Board GPIO map → STM32 HAL: uses GPIO HAL (evidence: `src/board/gpio.rs`)
- UART output → STM32 HAL: accesses peripherals (evidence: `src/hal/uart.rs`)
- UART output → Board configuration: uses pin config (evidence: `src/hal/uart.rs`)
- Process scheduler → Process registry: updates processes (evidence: `src/proc/csched.rs`)
- Process tracker → Process registry: reads process table (evidence: `src/apps/proctracker.rs`)
- Process tracker → Window UI: renders tracker (evidence: `src/apps/proctracker.rs`)
- Process tracker → Kernel logging: logs status (evidence: `src/apps/proctracker.rs`)
- Window UI → Framebuffer drawing: draws chrome (evidence: `src/kui/mod.rs`)
- Window UI → UI fonts: uses fonts (evidence: `src/kui/mod.rs`)
- Window UI → Framebuffer display: presents frame (evidence: `src/kui/mod.rs`)
- Framebuffer display → Framebuffer drawing: installs framebuffer (evidence: `src/drivers/display/mod.rs`)
- Framebuffer display → LTDC scanout: starts or updates (evidence: `src/drivers/display/mod.rs`)
- Framebuffer display → Software scanout: starts or updates (evidence: `src/drivers/display/mod.rs`)
