# polarfire-soc/zephyr-applications architecture

> Architecture diagram of the GitHub repository polarfire-soc/zephyr-applications, 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/polarfire-soc/zephyr-applications
- Repository: https://github.com/polarfire-soc/zephyr-applications

## Overview

This repository provides PolarFire SoC Zephyr examples plus West commands for preparing and flashing eMMC payloads, and SoftConsole debug configurations. The main user workflow is to build an example in Zephyr, generate a payload from the ELF and YAML configuration, then use the interactive flash command to write it to eMMC through HSS. The examples are separate demonstrations, not stages in that workflow. Relationships for unsampled configuration and debug subsystems are included only where the README documents them; source-level evidence is limited to the excerpts shown.

Main entry points: [`scripts/flash_payload.py`](https://github.com/polarfire-soc/zephyr-applications/blob/main/scripts/flash_payload.py) (Flash command), [`scripts/generate_payload.py`](https://github.com/polarfire-soc/zephyr-applications/blob/main/scripts/generate_payload.py) (Payload generator command), [`scripts/write_to_emmc.py`](https://github.com/polarfire-soc/zephyr-applications/blob/main/scripts/write_to_emmc.py) (eMMC writer), [`payload-configs`](https://github.com/polarfire-soc/zephyr-applications/tree/main/payload-configs) (Payload YAML configs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_examples["Zephyr examples"]
  node_blinky["LED blink<br/>[main.c]"]
  node_button["Button input<br/>[main.c]"]
  node_smp["Pi SMP demo<br/>[main.c]"]
  node_sync["Thread sync demo<br/>[main.c]"]
end

subgraph group_payload["Payload generation"]
  node_elf["Built Zephyr ELF"]
  node_configs["Payload YAML configs"]
  node_generator["Payload generator command"]
  node_generator_binary["HSS payload generator"]
end

subgraph group_flashing["Payload flashing"]
  node_payload_bin["Generated payload"]
  node_flash["Flash command<br/>[flash_payload.py]"]
  node_hss["Board HSS"]
  node_emmc[("Host eMMC device")]
  node_writer["eMMC writer<br/>[write_to_emmc.py]"]
end

subgraph group_debug["Debug support"]
  node_debug_configs["SoftConsole launch configs"]
end

node_developer(("Developer"))

node_developer -->|"runs example"| node_blinky
node_developer -->|"runs example"| node_button
node_developer -->|"runs example"| node_smp
node_developer -->|"runs example"| node_sync
node_developer -->|"invokes command"| node_generator
node_elf -->|"provides input"| node_generator
node_configs -->|"configures"| node_generator
node_generator -->|"invokes"| node_generator_binary
node_generator -->|"generates"| node_payload_bin
node_developer -->|"invokes command"| node_flash
node_payload_bin -->|"provides input"| node_flash
node_flash -->|"controls over serial"| node_hss
node_flash -->|"selects device"| node_emmc
node_flash -->|"runs subprocess"| node_writer
node_writer -->|"writes payload"| node_emmc
node_developer -->|"uses for debugging"| node_debug_configs

click node_blinky "https://github.com/polarfire-soc/zephyr-applications/blob/main/apps/blinky/src/main.c"
click node_button "https://github.com/polarfire-soc/zephyr-applications/blob/main/apps/button/src/main.c"
click node_smp "https://github.com/polarfire-soc/zephyr-applications/blob/main/apps/smp/src/main.c"
click node_sync "https://github.com/polarfire-soc/zephyr-applications/blob/main/apps/synchronization/src/main.c"
click node_configs "https://github.com/polarfire-soc/zephyr-applications/tree/main/payload-configs"
click node_generator "https://github.com/polarfire-soc/zephyr-applications/blob/main/scripts/generate_payload.py"
click node_flash "https://github.com/polarfire-soc/zephyr-applications/blob/main/scripts/flash_payload.py"
click node_writer "https://github.com/polarfire-soc/zephyr-applications/blob/main/scripts/write_to_emmc.py"
click node_debug_configs "https://github.com/polarfire-soc/zephyr-applications/tree/main/softconsole-launch-configs"

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_blinky,node_button,node_smp,node_sync toneBlue
class node_elf,node_configs,node_generator,node_generator_binary toneAmber
class node_payload_bin,node_flash,node_hss,node_emmc,node_writer toneMint
class node_debug_configs toneRose
class node_developer toneIndigo
```

## Components

### Zephyr examples

- [LED blink](https://github.com/polarfire-soc/zephyr-applications/blob/main/apps/blinky/src/main.c): `apps/blinky/src/main.c`
- [Button input](https://github.com/polarfire-soc/zephyr-applications/blob/main/apps/button/src/main.c): `apps/button/src/main.c`
- [Pi SMP demo](https://github.com/polarfire-soc/zephyr-applications/blob/main/apps/smp/src/main.c): `apps/smp/src/main.c`
- [Thread sync demo](https://github.com/polarfire-soc/zephyr-applications/blob/main/apps/synchronization/src/main.c): `apps/synchronization/src/main.c`

### Payload generation

- **Built Zephyr ELF**
- [Payload YAML configs](https://github.com/polarfire-soc/zephyr-applications/tree/main/payload-configs): `payload-configs`
- [Payload generator command](https://github.com/polarfire-soc/zephyr-applications/blob/main/scripts/generate_payload.py): `scripts/generate_payload.py`
- **HSS payload generator**

### Payload flashing

- **Generated payload**
- [Flash command](https://github.com/polarfire-soc/zephyr-applications/blob/main/scripts/flash_payload.py): `scripts/flash_payload.py`
- **Board HSS**
- **Host eMMC device**
- [eMMC writer](https://github.com/polarfire-soc/zephyr-applications/blob/main/scripts/write_to_emmc.py): `scripts/write_to_emmc.py`

### Debug support

- [SoftConsole launch configs](https://github.com/polarfire-soc/zephyr-applications/tree/main/softconsole-launch-configs): `softconsole-launch-configs`

### Other components

- **Developer**

## Connections

- Developer → LED blink: runs example (evidence: `README.md`)
- Developer → Button input: runs example (evidence: `README.md`)
- Developer → Pi SMP demo: runs example (evidence: `README.md`)
- Developer → Thread sync demo: runs example (evidence: `README.md`)
- Developer → Payload generator command: invokes command (evidence: `README.md`)
- Built Zephyr ELF → Payload generator command: provides input (evidence: `README.md`)
- Payload YAML configs → Payload generator command: configures (evidence: `README.md`)
- Payload generator command → HSS payload generator: invokes (evidence: `scripts/generate_payload.py`)
- Payload generator command → Generated payload: generates (evidence: `scripts/generate_payload.py`)
- Developer → Flash command: invokes command (evidence: `README.md`)
- Generated payload → Flash command: provides input (evidence: `README.md`)
- Flash command → Board HSS: controls over serial (evidence: `scripts/flash_payload.py`)
- Flash command → Host eMMC device: selects device (evidence: `scripts/flash_payload.py`)
- Flash command → eMMC writer: runs subprocess (evidence: `scripts/flash_payload.py`)
- eMMC writer → Host eMMC device: writes payload (evidence: `scripts/write_to_emmc.py`)
- Developer → SoftConsole launch configs: uses for debugging (evidence: `README.md`)
