# niekiran/cortexmxprogramming architecture

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

- Interactive diagram: https://gitdiagram.com/niekiran/cortexmxprogramming
- Repository: https://github.com/niekiran/cortexmxprogramming

## Overview

This repository is a set of Cortex-M embedded-programming course examples, not one integrated firmware product. The learner-facing progression runs from basic output and processor modes through interrupts, exceptions, and SVC, then to cooperative task scheduling and a CMSIS-based variant. The scheduler examples show task setup, tick-based blocking, and PendSV context switching; the CMSIS variant uses the STM32 device header and Cortex-M4 core definitions. Several older KEIL examples demonstrate related interrupt and access-control topics. Unsampled lesson internals are represented only where the file tree supports them; edges are limited to indexed references or shown calls.

Main entry points: [`Source_code/016_cmsis_task_scheduler/driver/Device/ST/ST/stm32f4xx/Include/stm32f4xx.h`](https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/016_cmsis_task_scheduler/driver/Device/ST/ST/stm32f4xx/Include/stm32f4xx.h) (STM32F4 device layer), [`Source_code/015_task_scheduler/Src/main.c`](https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/015_task_scheduler/Src/main.c) (Task scheduler), [`Source_code/016_cmsis_task_scheduler/Src/main.c`](https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/016_cmsis_task_scheduler/Src/main.c) (CMSIS scheduler), [`Source_code/001_HelloWorld/Src/main.c`](https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/001_HelloWorld/Src/main.c) (Hello world)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_basics["Core Basics"]
  node_hello["Hello world<br/>[main.c]"]
  node_semihost["Semihosting<br/>[main.c]"]
  node_operation["Processor modes<br/>[main.c]"]
  node_inline["Inline assembly<br/>[main.c]"]
  node_access["Access levels<br/>[main.c]"]
  node_bitops["Core bit operations<br/>[main.c]"]
end

subgraph group_exceptions["Exceptions"]
  node_interrupts["Interrupt examples<br/>[main.c]"]
  node_priority["Interrupt priority<br/>[main.c]"]
  node_faults["Fault handling<br/>[main.c]"]
  node_svc["SVC examples<br/>[main.c]"]
  node_legacyaccess["Legacy access demo<br/>[main.c]"]
  node_legacyinterrupt["Legacy interrupt demos<br/>[main.c]"]
  node_legacybutton["Button interrupts<br/>[main.c]"]
  node_legacy_pendsv["PendSV demo<br/>[main.c]"]
end

subgraph group_scheduling["Task Scheduling"]
  node_scheduler["Task scheduler<br/>[main.c]"]
  node_schedconfig["Scheduler configuration<br/>[main.h]"]
  node_ledapi["LED interface<br/>[led.h]"]
  node_cmsisscheduler["CMSIS scheduler<br/>[main.c]"]
end

subgraph group_platform["Platform Support"]
  node_deviceheader["STM32F4 device layer<br/>[stm32f4xx.h]"]
  node_coreheader["Cortex-M4 core layer<br/>[core_cm4.h]"]
  node_systemheader["STM32 system interface<br/>[system_stm32f4xx.h]"]
end

node_learner(("Course learner"))

node_learner -->|"studies"| node_hello
node_learner -->|"studies"| node_semihost
node_learner -->|"studies"| node_operation
node_learner -->|"studies"| node_inline
node_learner -->|"studies"| node_access
node_learner -->|"studies"| node_bitops
node_learner -->|"studies"| node_interrupts
node_learner -->|"studies"| node_priority
node_learner -->|"studies"| node_faults
node_learner -->|"studies"| node_svc
node_learner -->|"studies"| node_legacyaccess
node_learner -->|"studies"| node_legacyinterrupt
node_learner -->|"studies"| node_legacybutton
node_learner -->|"studies"| node_legacy_pendsv
node_learner -->|"studies"| node_scheduler
node_learner -->|"studies"| node_cmsisscheduler
node_scheduler -->|"imports"| node_ledapi
node_cmsisscheduler -->|"imports"| node_deviceheader
node_deviceheader -->|"includes"| node_coreheader
node_deviceheader -->|"includes"| node_systemheader

click node_hello "https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/001_HelloWorld/Src/main.c"
click node_semihost "https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/002_HelloWorld_semihosting/Src/main.c"
click node_operation "https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/003_operation_modes/Src/main.c"
click node_inline "https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/004_inline_1/Src/main.c"
click node_access "https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/005_access_levels/Src/main.c"
click node_bitops "https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/007_bit_banding/Src/main.c"
click node_interrupts "https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/009_USART3_int_pend/Src/main.c"
click node_priority "https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/010_interrupt_priority/Src/main.c"
click node_faults "https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/012_fault_gen/Src/main.c"
click node_svc "https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/014_svc_operation/Src/main.c"
click node_legacyaccess "https://github.com/niekiran/cortexmxprogramming/blob/master/old/Source_codes/KEIL-MDK-5/Section%207_%20Access%20levels/main.c"
click node_legacyinterrupt "https://github.com/niekiran/cortexmxprogramming/blob/master/old/Source_codes/KEIL-MDK-5/Section%2013_%20(76)%20Exception%20masking%20%26%20unmasking/main.c"
click node_legacybutton "https://github.com/niekiran/cortexmxprogramming/blob/master/old/Source_codes/KEIL-MDK-5/Section%2015_%20External%20Interrupts-Buttons/main.c"
click node_legacy_pendsv "https://github.com/niekiran/cortexmxprogramming/blob/master/old/Source_codes/KEIL-MDK-5/Section%2017_%20(90)%20PendSV%20exception/main.c"
click node_scheduler "https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/015_task_scheduler/Src/main.c"
click node_schedconfig "https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/015_task_scheduler/Inc/main.h"
click node_ledapi "https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/015_task_scheduler/Inc/led.h"
click node_cmsisscheduler "https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/016_cmsis_task_scheduler/Src/main.c"
click node_deviceheader "https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/016_cmsis_task_scheduler/driver/Device/ST/ST/stm32f4xx/Include/stm32f4xx.h"
click node_coreheader "https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/016_cmsis_task_scheduler/driver/CMSIS/Core/Include/core_cm4.h"
click node_systemheader "https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/016_cmsis_task_scheduler/driver/Device/ST/ST/stm32f4xx/Include/system_stm32f4xx.h"

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_hello,node_semihost,node_operation,node_inline,node_access,node_bitops toneBlue
class node_interrupts,node_priority,node_faults,node_svc,node_legacyaccess,node_legacyinterrupt,node_legacybutton,node_legacy_pendsv toneAmber
class node_scheduler,node_schedconfig,node_ledapi,node_cmsisscheduler toneMint
class node_deviceheader,node_coreheader,node_systemheader toneRose
class node_learner toneIndigo
```

## Components

### Core Basics

- [Hello world](https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/001_HelloWorld/Src/main.c): `Source_code/001_HelloWorld/Src/main.c`
- [Semihosting](https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/002_HelloWorld_semihosting/Src/main.c): `Source_code/002_HelloWorld_semihosting/Src/main.c`
- [Processor modes](https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/003_operation_modes/Src/main.c): `Source_code/003_operation_modes/Src/main.c`
- [Inline assembly](https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/004_inline_1/Src/main.c): `Source_code/004_inline_1/Src/main.c`
- [Access levels](https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/005_access_levels/Src/main.c): `Source_code/005_access_levels/Src/main.c`
- [Core bit operations](https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/007_bit_banding/Src/main.c): `Source_code/007_bit_banding/Src/main.c`

### Exceptions

- [Interrupt examples](https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/009_USART3_int_pend/Src/main.c): `Source_code/009_USART3_int_pend/Src/main.c`
- [Interrupt priority](https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/010_interrupt_priority/Src/main.c): `Source_code/010_interrupt_priority/Src/main.c`
- [Fault handling](https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/012_fault_gen/Src/main.c): `Source_code/012_fault_gen/Src/main.c`
- [SVC examples](https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/014_svc_operation/Src/main.c): `Source_code/014_svc_operation/Src/main.c`
- [Legacy access demo](https://github.com/niekiran/cortexmxprogramming/blob/master/old/Source_codes/KEIL-MDK-5/Section%207_%20Access%20levels/main.c): `old/Source_codes/KEIL-MDK-5/Section 7_ Access levels/main.c`
- [Legacy interrupt demos](https://github.com/niekiran/cortexmxprogramming/blob/master/old/Source_codes/KEIL-MDK-5/Section%2013_%20(76)%20Exception%20masking%20%26%20unmasking/main.c): `old/Source_codes/KEIL-MDK-5/Section 13_ (76) Exception masking & unmasking/main.c`
- [Button interrupts](https://github.com/niekiran/cortexmxprogramming/blob/master/old/Source_codes/KEIL-MDK-5/Section%2015_%20External%20Interrupts-Buttons/main.c): `old/Source_codes/KEIL-MDK-5/Section 15_ External Interrupts-Buttons/main.c`
- [PendSV demo](https://github.com/niekiran/cortexmxprogramming/blob/master/old/Source_codes/KEIL-MDK-5/Section%2017_%20(90)%20PendSV%20exception/main.c): `old/Source_codes/KEIL-MDK-5/Section 17_ (90) PendSV exception/main.c`

### Task Scheduling

- [Task scheduler](https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/015_task_scheduler/Src/main.c): `Source_code/015_task_scheduler/Src/main.c`
- [Scheduler configuration](https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/015_task_scheduler/Inc/main.h): `Source_code/015_task_scheduler/Inc/main.h`
- [LED interface](https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/015_task_scheduler/Inc/led.h): `Source_code/015_task_scheduler/Inc/led.h`
- [CMSIS scheduler](https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/016_cmsis_task_scheduler/Src/main.c): `Source_code/016_cmsis_task_scheduler/Src/main.c`

### Platform Support

- [STM32F4 device layer](https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/016_cmsis_task_scheduler/driver/Device/ST/ST/stm32f4xx/Include/stm32f4xx.h): `Source_code/016_cmsis_task_scheduler/driver/Device/ST/ST/stm32f4xx/Include/stm32f4xx.h`
- [Cortex-M4 core layer](https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/016_cmsis_task_scheduler/driver/CMSIS/Core/Include/core_cm4.h): `Source_code/016_cmsis_task_scheduler/driver/CMSIS/Core/Include/core_cm4.h`
- [STM32 system interface](https://github.com/niekiran/cortexmxprogramming/blob/master/Source_code/016_cmsis_task_scheduler/driver/Device/ST/ST/stm32f4xx/Include/system_stm32f4xx.h): `Source_code/016_cmsis_task_scheduler/driver/Device/ST/ST/stm32f4xx/Include/system_stm32f4xx.h`

### Other components

- **Course learner**

## Connections

- Course learner → Hello world: studies
- Course learner → Semihosting: studies
- Course learner → Processor modes: studies
- Course learner → Inline assembly: studies
- Course learner → Access levels: studies
- Course learner → Core bit operations: studies
- Course learner → Interrupt examples: studies
- Course learner → Interrupt priority: studies
- Course learner → Fault handling: studies
- Course learner → SVC examples: studies
- Course learner → Legacy access demo: studies
- Course learner → Legacy interrupt demos: studies
- Course learner → Button interrupts: studies
- Course learner → PendSV demo: studies
- Course learner → Task scheduler: studies
- Course learner → CMSIS scheduler: studies
- Task scheduler → LED interface: imports (evidence: `Source_code/015_task_scheduler/Src/main.c`)
- CMSIS scheduler → STM32F4 device layer: imports (evidence: `Source_code/016_cmsis_task_scheduler/Src/main.c`)
- STM32F4 device layer → Cortex-M4 core layer: includes (evidence: `Source_code/016_cmsis_task_scheduler/driver/Device/ST/ST/stm32f4xx/Include/stm32f4xx.h`)
- STM32F4 device layer → STM32 system interface: includes (evidence: `Source_code/016_cmsis_task_scheduler/driver/Device/ST/ST/stm32f4xx/Include/stm32f4xx.h`)
