The Mk Kernel is a bare-metal, zero-dependency Real-Time Operating System (RTOS) core written from scratch in C and ARM Thumb-2 assembly. Designed specifically for the ARM Cortex-M7 processor (targeting the STM32F74xxx and STM32F75xxx MCU families), it sits at the Foundation layer of the Mk OS software ecosystem.
It provides a deterministic execution environment with memory protection, hardware-accelerated
-
Preemptive
$O(1)$ Scheduler: Fixed-priority scheduling with Round-Robin time-slicing for tasks of equal priority. Uses the ARMCLZ(Count Leading Zeros) instruction for instantaneous selection of the highest-priority ready task. - Hardware-Enforced Security & Isolation (TEE): Software Trusted Execution Environment leveraging the Cortex-M7 Memory Protection Unit (MPU) and privilege levels.
-
Zero Dynamic Allocation: Built entirely on fixed-size memory pools (
T_mkPool), completely eliminating heap fragmentation and non-deterministic allocation delays. -
FPU Context Management: Full support for floating-point (
K_MK_TYPE_FLOATING) and non-floating-point tasks. - Synchronization Primitives: Semaphores, Mutexes (with priority inheritance), Event Fields, and Mailboxes.
-
Zero-Latency Interrupts: High-priority hardware interrupts (7 to 0) are never masked by the kernel (
BASEPRImasking). - Asynchronous Callback Manager: Deferred execution engine handling up to 30 concurrent function callbacks via dedicated background tasks.
-
Structured Fault Handling: Built-in trap handlers for
HardFault,MemManage,BusFault,UsageFault, and stack overflow detection. - Zero External Dependencies: Pure standalone implementation written in C and Assembly.
ℹ️ For detailed technical articles and API documentation, visit La Fabrique du MCU.
- GNU Arm Embedded Toolchain 15.3 (rel1)
- CMake ≥ 3.25
- Ninja
The project uses CMake with presets defined in CMakePresets.json. Two presets are
available:
| Preset | Board | Type |
|---|---|---|
release |
STM32F746G-Eval2 | Release (-Ofast) |
debug |
STM32F746G-Eval2 | Debug (-O0 -g3) |
-
Configure the project using the desired preset:
cmake --preset debug -
Build the firmware:
cmake --build --preset debugThis produces in
build/<preset>/:Mk.elf— programming fileMk.map— linker map file
| Tool | Version |
|---|---|
arm-none-eabi-gcc |
10.3.1 20210824 (GNU Arm Embedded Toolchain 10.3-2021.10) |
arm-none-eabi-g++ |
10.3.1 20210824 (GNU Arm Embedded Toolchain 10.3-2021.10) |
| CMake | ≥ 3.25 |
| Ninja | latest |
Debug configurations for VS Code are included in the repository in .vscode/launch.json,
using the Cortex-Debug extension with J-Link:
| Configuration | Type | Binary flashed |
|---|---|---|
Debug Mk (J-Link) |
Debug | build/debug/Mk.elf |
Release Mk (J-Link) |
Release | build/release/Mk.elf |
All configurations require a J-Link probe (or a ST-Link flashed with the J-Link firmware) and the J-Link Software installed.
Copyright © 2018-2026 Mathieu Renard. All rights reserved.
This project is licensed under the BSD 3-Clause License — see the LICENSE file for details.