# 1811htsang/uedp architecture

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

- Interactive diagram: https://gitdiagram.com/1811htsang/uedp
- Repository: https://github.com/1811htsang/uedp

## Overview

μEDP is an embedded event-driven framework, with a Python PLTF pipeline that turns Kconfig and YAML/μE-LS descriptions into application code. The runtime workflow is application tasks and signals entering the core, where messages are scheduled and handled with timers and state machines; PAL implementations provide platform services. The README also describes logging, memory reporting, fatal-error handling, and out-of-context execution. Some runtime modules were not sampled, so their links are included only where the README or source index supports them.

Main entry points: [`sources/core/src/uedp_task.c`](https://github.com/1811htsang/uedp/blob/main/sources/core/src/uedp_task.c) (Task scheduler), [`sources/core/src/uedp_msg.c`](https://github.com/1811htsang/uedp/blob/main/sources/core/src/uedp_msg.c) (Message pools), [`pltf/pycdscriptor/jnerator/pregen/fpregen.py`](https://github.com/1811htsang/uedp/blob/main/pltf/pycdscriptor/jnerator/pregen/fpregen.py) (Code generation), [`pltf/kconfigspec/usrinp.py`](https://github.com/1811htsang/uedp/blob/main/pltf/kconfigspec/usrinp.py) (Kconfig inputs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_pltf["PLTF generation"]
  node_kconfig["Kconfig inputs<br/>[usrinp.py]"]
  node_config_parse["Config parsing<br/>[dotcfg.py]"]
  node_yaml_models["YAML models<br/>[lukupmodel.py]"]
  node_validation["Logic validation<br/>[strucjec.py]"]
  node_codegen["Code generation<br/>[fpregen.py]"]
  node_postgen["Generated C<br/>[cgen.py]"]
end

subgraph group_app["Application"]
  node_app_logic["Application logic<br/>[app.c]"]
  node_app_decl["Task declarations<br/>[app_decl.h]"]
  node_app_config["Runtime configuration<br/>[app_cfg.h]"]
end

subgraph group_core["μEDP core"]
  node_scheduler["Task scheduler<br/>[uedp_task.c]"]
  node_messages["Message pools<br/>[uedp_msg.c]"]
  node_fifo["Task queues<br/>[fifo.c]"]
  node_timers["Timer service<br/>[uedp_timer.c]"]
  node_fsm["FSM control<br/>[uedp_fsm.h]"]
  node_tsm["TSM control<br/>[uedp_tsm.c]"]
  node_oce["Out-context execution<br/>[uedp_ocesvc.c]"]
  node_errors["Fatal error handling<br/>[uedp_fcr.h]"]
  node_logger["Internal logging<br/>[uedp_itnlog.c]"]
end

subgraph group_pal["Platform services"]
  node_platform["Architecture adapters<br/>[linux.c]"]
  node_log_dispatch["Log dispatcher<br/>[pal_logdp.c]"]
  node_printf["Redirectable printf<br/>[pal_rprintf.c]"]
  node_memory_report["Memory reporting<br/>[pal_memrp.c]"]
  node_xprintf["Formatted output<br/>[xprintf.c]"]
end

node_user(("Developer"))

node_user -->|"defines config"| node_kconfig
node_user -->|"describes logic"| node_yaml_models
node_kconfig -->|"reads settings"| node_config_parse
node_config_parse -->|"supplies context"| node_codegen
node_yaml_models -->|"provides models"| node_validation
node_validation -->|"validated input"| node_codegen
node_codegen -->|"generates code"| node_postgen
node_postgen -->|"produces app.c"| node_app_logic
node_app_config -->|"configures core"| node_scheduler
node_app_decl -->|"declares tasks"| node_scheduler
node_app_logic -->|"uses event API"| node_scheduler
node_scheduler -->|"posts messages"| node_messages
node_scheduler -->|"queues messages"| node_fifo
node_messages -->|"uses queue"| node_fifo
node_scheduler -->|"dispatches state logic"| node_fsm
node_scheduler -->|"manages modes"| node_tsm
node_timers -.->|"triggers work"| node_scheduler
node_scheduler -.->|"runs out-context tasks"| node_oce
node_scheduler -.->|"reports failures"| node_errors
node_scheduler -->|"records events"| node_logger
node_logger -->|"forwards logs"| node_log_dispatch
node_log_dispatch -->|"selects backend"| node_printf
node_printf -->|"formats output"| node_xprintf
node_platform -->|"provides hardware services"| node_scheduler
node_messages -->|"reports pool usage"| node_memory_report

click node_kconfig "https://github.com/1811htsang/uedp/blob/main/pltf/kconfigspec/usrinp.py"
click node_config_parse "https://github.com/1811htsang/uedp/blob/main/pltf/pycdscriptor/attribarse/dotcfg.py"
click node_yaml_models "https://github.com/1811htsang/uedp/blob/main/pltf/pycdscriptor/lstaxer/lukupmodel.py"
click node_validation "https://github.com/1811htsang/uedp/blob/main/pltf/pycdscriptor/lstaxer/strucjec.py"
click node_codegen "https://github.com/1811htsang/uedp/blob/main/pltf/pycdscriptor/jnerator/pregen/fpregen.py"
click node_postgen "https://github.com/1811htsang/uedp/blob/main/pltf/pycdscriptor/jnerator/postgen/cgen.py"
click node_app_logic "https://github.com/1811htsang/uedp/blob/main/sources/app/app.c"
click node_app_decl "https://github.com/1811htsang/uedp/blob/main/sources/app/declaration/app_decl.h"
click node_app_config "https://github.com/1811htsang/uedp/blob/main/sources/app/config/app_cfg.h"
click node_scheduler "https://github.com/1811htsang/uedp/blob/main/sources/core/src/uedp_task.c"
click node_messages "https://github.com/1811htsang/uedp/blob/main/sources/core/src/uedp_msg.c"
click node_fifo "https://github.com/1811htsang/uedp/blob/main/sources/common/container/fifo/fifo.c"
click node_timers "https://github.com/1811htsang/uedp/blob/main/sources/core/src/uedp_timer.c"
click node_fsm "https://github.com/1811htsang/uedp/blob/main/sources/core/inc/uedp_fsm.h"
click node_tsm "https://github.com/1811htsang/uedp/blob/main/sources/core/src/uedp_tsm.c"
click node_oce "https://github.com/1811htsang/uedp/blob/main/sources/core/src/uedp_ocesvc.c"
click node_errors "https://github.com/1811htsang/uedp/blob/main/sources/core/inc/uedp_fcr.h"
click node_logger "https://github.com/1811htsang/uedp/blob/main/sources/core/src/uedp_itnlog.c"
click node_platform "https://github.com/1811htsang/uedp/blob/main/sources/pal/arch/linux/linux.c"
click node_log_dispatch "https://github.com/1811htsang/uedp/blob/main/sources/pal/service/logdp/pal_logdp.c"
click node_printf "https://github.com/1811htsang/uedp/blob/main/sources/pal/service/rprintf/pal_rprintf.c"
click node_memory_report "https://github.com/1811htsang/uedp/blob/main/sources/pal/service/memrp/pal_memrp.c"
click node_xprintf "https://github.com/1811htsang/uedp/blob/main/sources/common/xprintf/xprintf.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_kconfig,node_config_parse,node_yaml_models,node_validation,node_codegen,node_postgen toneBlue
class node_app_logic,node_app_decl,node_app_config toneAmber
class node_scheduler,node_messages,node_fifo,node_timers,node_fsm,node_tsm,node_oce,node_errors,node_logger toneMint
class node_platform,node_log_dispatch,node_printf,node_memory_report,node_xprintf toneRose
class node_user toneIndigo
```

## Components

### PLTF generation

- [Kconfig inputs](https://github.com/1811htsang/uedp/blob/main/pltf/kconfigspec/usrinp.py): `pltf/kconfigspec/usrinp.py`
- [Config parsing](https://github.com/1811htsang/uedp/blob/main/pltf/pycdscriptor/attribarse/dotcfg.py): `pltf/pycdscriptor/attribarse/dotcfg.py`
- [YAML models](https://github.com/1811htsang/uedp/blob/main/pltf/pycdscriptor/lstaxer/lukupmodel.py): `pltf/pycdscriptor/lstaxer/lukupmodel.py`
- [Logic validation](https://github.com/1811htsang/uedp/blob/main/pltf/pycdscriptor/lstaxer/strucjec.py): `pltf/pycdscriptor/lstaxer/strucjec.py`
- [Code generation](https://github.com/1811htsang/uedp/blob/main/pltf/pycdscriptor/jnerator/pregen/fpregen.py): `pltf/pycdscriptor/jnerator/pregen/fpregen.py`
- [Generated C](https://github.com/1811htsang/uedp/blob/main/pltf/pycdscriptor/jnerator/postgen/cgen.py): `pltf/pycdscriptor/jnerator/postgen/cgen.py`

### Application

- [Application logic](https://github.com/1811htsang/uedp/blob/main/sources/app/app.c): `sources/app/app.c`
- [Task declarations](https://github.com/1811htsang/uedp/blob/main/sources/app/declaration/app_decl.h): `sources/app/declaration/app_decl.h`
- [Runtime configuration](https://github.com/1811htsang/uedp/blob/main/sources/app/config/app_cfg.h): `sources/app/config/app_cfg.h`

### μEDP core

- [Task scheduler](https://github.com/1811htsang/uedp/blob/main/sources/core/src/uedp_task.c): `sources/core/src/uedp_task.c`
- [Message pools](https://github.com/1811htsang/uedp/blob/main/sources/core/src/uedp_msg.c): `sources/core/src/uedp_msg.c`
- [Task queues](https://github.com/1811htsang/uedp/blob/main/sources/common/container/fifo/fifo.c): `sources/common/container/fifo/fifo.c`
- [Timer service](https://github.com/1811htsang/uedp/blob/main/sources/core/src/uedp_timer.c): `sources/core/src/uedp_timer.c`
- [FSM control](https://github.com/1811htsang/uedp/blob/main/sources/core/inc/uedp_fsm.h): `sources/core/inc/uedp_fsm.h`
- [TSM control](https://github.com/1811htsang/uedp/blob/main/sources/core/src/uedp_tsm.c): `sources/core/src/uedp_tsm.c`
- [Out-context execution](https://github.com/1811htsang/uedp/blob/main/sources/core/src/uedp_ocesvc.c): `sources/core/src/uedp_ocesvc.c`
- [Fatal error handling](https://github.com/1811htsang/uedp/blob/main/sources/core/inc/uedp_fcr.h): `sources/core/inc/uedp_fcr.h`
- [Internal logging](https://github.com/1811htsang/uedp/blob/main/sources/core/src/uedp_itnlog.c): `sources/core/src/uedp_itnlog.c`

### Platform services

- [Architecture adapters](https://github.com/1811htsang/uedp/blob/main/sources/pal/arch/linux/linux.c): `sources/pal/arch/linux/linux.c`
- [Log dispatcher](https://github.com/1811htsang/uedp/blob/main/sources/pal/service/logdp/pal_logdp.c): `sources/pal/service/logdp/pal_logdp.c`
- [Redirectable printf](https://github.com/1811htsang/uedp/blob/main/sources/pal/service/rprintf/pal_rprintf.c): `sources/pal/service/rprintf/pal_rprintf.c`
- [Memory reporting](https://github.com/1811htsang/uedp/blob/main/sources/pal/service/memrp/pal_memrp.c): `sources/pal/service/memrp/pal_memrp.c`
- [Formatted output](https://github.com/1811htsang/uedp/blob/main/sources/common/xprintf/xprintf.c): `sources/common/xprintf/xprintf.c`

### Other components

- **Developer**

## Connections

- Developer → Kconfig inputs: defines config (evidence: `README.md`)
- Developer → YAML models: describes logic (evidence: `README.md`)
- Kconfig inputs → Config parsing: reads settings (evidence: `README.md`)
- Config parsing → Code generation: supplies context (evidence: `README.md`)
- YAML models → Logic validation: provides models (evidence: `README.md`)
- Logic validation → Code generation: validated input (evidence: `README.md`)
- Code generation → Generated C: generates code (evidence: `README.md`)
- Generated C → Application logic: produces app.c (evidence: `README.md`)
- Runtime configuration → Task scheduler: configures core (evidence: `README.md`)
- Task declarations → Task scheduler: declares tasks (evidence: `sources/app/declaration/app_decl.h`)
- Application logic → Task scheduler: uses event API (evidence: `README.md`)
- Task scheduler → Message pools: posts messages (evidence: `sources/core/src/uedp_task.c`)
- Task scheduler → Task queues: queues messages (evidence: `sources/core/src/uedp_task.c`)
- Message pools → Task queues: uses queue (evidence: `sources/core/src/uedp_msg.c`)
- Task scheduler → FSM control: dispatches state logic
- Task scheduler → TSM control: manages modes
- Timer service → Task scheduler: triggers work
- Task scheduler → Out-context execution: runs out-context tasks (evidence: `README.md`)
- Task scheduler → Fatal error handling: reports failures (evidence: `README.md`)
- Task scheduler → Internal logging: records events (evidence: `README.md`)
- Internal logging → Log dispatcher: forwards logs (evidence: `README.md`)
- Log dispatcher → Redirectable printf: selects backend (evidence: `README.md`)
- Redirectable printf → Formatted output: formats output (evidence: `sources/pal/service/rprintf/pal_rprintf.c`)
- Architecture adapters → Task scheduler: provides hardware services (evidence: `README.md`)
- Message pools → Memory reporting: reports pool usage (evidence: `sources/core/src/uedp_msg.c`)
