# freertos/freertos-kernel architecture

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

- Interactive diagram: https://gitdiagram.com/freertos/freertos-kernel
- Repository: https://github.com/freertos/freertos-kernel

## Overview

FreeRTOS-Kernel is an embeddable real-time operating-system kernel, not a complete application. Application code creates and coordinates tasks using kernel APIs; the kernel schedules them and supplies synchronization, communication, and timing facilities. The README identifies tasks, queues, and lists as core kernel files, with architecture-specific ports and optional co-routines. This map preserves the documented feature modules and representative port, heap, and MPU subsystems. Source excerpts are partial, so many runtime links are left unasserted rather than inferred from module names.

Main entry points: [`tasks.c`](https://github.com/freertos/freertos-kernel/blob/main/tasks.c) (Task scheduler), [`queue.c`](https://github.com/freertos/freertos-kernel/blob/main/queue.c) (Queues and semaphores), [`timers.c`](https://github.com/freertos/freertos-kernel/blob/main/timers.c) (Software timers), [`event_groups.c`](https://github.com/freertos/freertos-kernel/blob/main/event_groups.c) (Event groups)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_kernel["Kernel scheduling"]
  node_tasks["Task scheduler<br/>[tasks.c]"]
  node_lists["Kernel lists<br/>[list.c]"]
  node_task_api["Task API<br/>[task.h]"]
  node_timers["Software timers<br/>[timers.c]"]
  node_timer_api["Timer API<br/>[timers.h]"]
  node_coroutines["Co-routines<br/>[croutine.c]"]
end

subgraph group_communication["Communication and sync"]
  node_queue["Queues and semaphores<br/>[queue.c]"]
  node_queue_api["Queue API<br/>[queue.h]"]
  node_event_groups["Event groups<br/>[event_groups.c]"]
  node_event_api["Event group API<br/>[event_groups.h]"]
  node_stream["Stream buffers<br/>[stream_buffer.h]"]
  node_message["Message buffers<br/>[FreeRTOS.h]"]
end

subgraph group_platform["Platform and memory"]
  node_port["Architecture ports"]
  node_heap["Heap implementations"]
end

subgraph group_security["Protection and extensions"]
  node_mpu["MPU wrappers<br/>[mpu_wrappers_v2.c]"]
  node_secure_context["Secure contexts<br/>[secure_context.c]"]
  node_secure_heap["Secure heap<br/>[secure_heap.c]"]
end

node_app(("Application code"))

node_app -->|"creates tasks"| node_tasks
node_tasks -->|"uses lists"| node_lists
node_app -.->|"uses queues"| node_queue
node_app -.->|"uses events"| node_event_groups
node_app -->|"uses timers"| node_timers
node_app -.->|"uses streams"| node_stream
node_app -.->|"uses messages"| node_message
node_app -.->|"uses optionally"| node_coroutines
node_tasks -.->|"dispatches through"| node_port
node_queue -.->|"unblocks tasks"| node_tasks
node_event_groups -.->|"unblocks tasks"| node_tasks
node_timers -.->|"queues commands"| node_queue
node_tasks -.->|"allocates from"| node_heap
node_mpu -->|"wraps task calls"| node_tasks
node_secure_context -.->|"uses secure memory"| node_secure_heap

click node_tasks "https://github.com/freertos/freertos-kernel/blob/main/tasks.c"
click node_lists "https://github.com/freertos/freertos-kernel/blob/main/list.c"
click node_task_api "https://github.com/freertos/freertos-kernel/blob/main/include/task.h"
click node_queue "https://github.com/freertos/freertos-kernel/blob/main/queue.c"
click node_queue_api "https://github.com/freertos/freertos-kernel/blob/main/include/queue.h"
click node_event_groups "https://github.com/freertos/freertos-kernel/blob/main/event_groups.c"
click node_event_api "https://github.com/freertos/freertos-kernel/blob/main/include/event_groups.h"
click node_stream "https://github.com/freertos/freertos-kernel/blob/main/include/stream_buffer.h"
click node_message "https://github.com/freertos/freertos-kernel/blob/main/include/FreeRTOS.h"
click node_timers "https://github.com/freertos/freertos-kernel/blob/main/timers.c"
click node_timer_api "https://github.com/freertos/freertos-kernel/blob/main/include/timers.h"
click node_coroutines "https://github.com/freertos/freertos-kernel/blob/main/croutine.c"
click node_port "https://github.com/freertos/freertos-kernel/tree/main/portable"
click node_heap "https://github.com/freertos/freertos-kernel/tree/main/portable/MemMang"
click node_mpu "https://github.com/freertos/freertos-kernel/blob/main/portable/Common/mpu_wrappers_v2.c"
click node_secure_context "https://github.com/freertos/freertos-kernel/blob/main/portable/ARMv8M/secure/context/secure_context.c"
click node_secure_heap "https://github.com/freertos/freertos-kernel/blob/main/portable/ARMv8M/secure/heap/secure_heap.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_tasks,node_lists,node_task_api,node_timers,node_timer_api,node_coroutines toneBlue
class node_queue,node_queue_api,node_event_groups,node_event_api,node_stream,node_message toneAmber
class node_port,node_heap toneMint
class node_mpu,node_secure_context,node_secure_heap toneRose
class node_app toneIndigo
```

## Components

### Kernel scheduling

- [Task scheduler](https://github.com/freertos/freertos-kernel/blob/main/tasks.c): `tasks.c`
- [Kernel lists](https://github.com/freertos/freertos-kernel/blob/main/list.c): `list.c`
- [Task API](https://github.com/freertos/freertos-kernel/blob/main/include/task.h): `include/task.h`
- [Software timers](https://github.com/freertos/freertos-kernel/blob/main/timers.c): `timers.c`
- [Timer API](https://github.com/freertos/freertos-kernel/blob/main/include/timers.h): `include/timers.h`
- [Co-routines](https://github.com/freertos/freertos-kernel/blob/main/croutine.c): `croutine.c`

### Communication and sync

- [Queues and semaphores](https://github.com/freertos/freertos-kernel/blob/main/queue.c): `queue.c`
- [Queue API](https://github.com/freertos/freertos-kernel/blob/main/include/queue.h): `include/queue.h`
- [Event groups](https://github.com/freertos/freertos-kernel/blob/main/event_groups.c): `event_groups.c`
- [Event group API](https://github.com/freertos/freertos-kernel/blob/main/include/event_groups.h): `include/event_groups.h`
- [Stream buffers](https://github.com/freertos/freertos-kernel/blob/main/include/stream_buffer.h): `include/stream_buffer.h`
- [Message buffers](https://github.com/freertos/freertos-kernel/blob/main/include/FreeRTOS.h): `include/FreeRTOS.h`

### Platform and memory

- [Architecture ports](https://github.com/freertos/freertos-kernel/tree/main/portable): `portable`
- [Heap implementations](https://github.com/freertos/freertos-kernel/tree/main/portable/MemMang): `portable/MemMang`

### Protection and extensions

- [MPU wrappers](https://github.com/freertos/freertos-kernel/blob/main/portable/Common/mpu_wrappers_v2.c): `portable/Common/mpu_wrappers_v2.c`
- [Secure contexts](https://github.com/freertos/freertos-kernel/blob/main/portable/ARMv8M/secure/context/secure_context.c): `portable/ARMv8M/secure/context/secure_context.c`
- [Secure heap](https://github.com/freertos/freertos-kernel/blob/main/portable/ARMv8M/secure/heap/secure_heap.c): `portable/ARMv8M/secure/heap/secure_heap.c`

### Other components

- **Application code**

## Connections

- Application code → Task scheduler: creates tasks
- Task scheduler → Kernel lists: uses lists (evidence: `tasks.c`)
- Application code → Queues and semaphores: uses queues
- Application code → Event groups: uses events
- Application code → Software timers: uses timers
- Application code → Stream buffers: uses streams
- Application code → Message buffers: uses messages
- Application code → Co-routines: uses optionally
- Task scheduler → Architecture ports: dispatches through
- Queues and semaphores → Task scheduler: unblocks tasks
- Event groups → Task scheduler: unblocks tasks
- Software timers → Queues and semaphores: queues commands
- Task scheduler → Heap implementations: allocates from
- MPU wrappers → Task scheduler: wraps task calls (evidence: `portable/Common/mpu_wrappers_v2.c`)
- Secure contexts → Secure heap: uses secure memory
