Skip to content

Commit 7ae4005

Browse files
committed
Improve and fix some inline comments.
1 parent 4857a09 commit 7ae4005

11 files changed

Lines changed: 212 additions & 179 deletions

File tree

Doxyfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ PROJECT_NAME = "SuperTinyKernel™ RTOS"
4848
# could be handy for archiving the generated documentation or if some version
4949
# control system is used.
5050

51-
PROJECT_NUMBER = 1.06.0
51+
PROJECT_NUMBER = 1.06.x
5252

5353
# Using the PROJECT_BRIEF tag one can provide an optional one line description
5454
# for a project that appears at the top of each page and should give viewer a
@@ -2351,7 +2351,8 @@ INCLUDE_FILE_PATTERNS =
23512351
# recursively expanded use the := operator instead of the = operator.
23522352
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
23532353

2354-
PREDEFINED = __cplusplus
2354+
PREDEFINED = __cplusplus \
2355+
STK_TICKLESS_IDLE=1
23552356

23562357
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
23572358
# tag can be used to specify a list of macro names that should be expanded. The

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ See [interop/freertos](https://github.com/SuperTinyKernel-RTOS/stk/tree/main/int
343343
344344
345345
> **Note:** Wrapper is missing important API your project is using? Contact with inquiry: [contact@supertinykernel.org](mailto:contact@supertinykernel.org)
346+
346347
---
347348
348349
## Synchronization API (`stk/stk_sync.h`)

interop/c/include/stk_c.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SuperTinyKernel™ (STK): Lightweight High-Performance Deterministic C++ RTOS for Embedded Systems.
2+
* SuperTinyKernel(TM) RTOS: Lightweight High-Performance Deterministic C++ RTOS for Embedded Systems.
33
*
44
* Source: https://github.com/SuperTinyKernel-RTOS
55
*
@@ -16,13 +16,13 @@
1616
#include <assert.h>
1717

1818
/*! \file stk_c.h
19-
\brief C language binding/interface for SuperTinyKernel (STK).
19+
\brief C language binding/interface for SuperTinyKernel RTOS.
2020
2121
This header provides a pure C API to create, configure and run STK kernel
2222
from C code.
2323
2424
\defgroup c_api STK C API
25-
\brief Pure C interface for C++ API of SuperTinyKernel (STK).
25+
\brief Pure C interface for C++ API of SuperTinyKernel RTOS.
2626
@{
2727
*/
2828

interop/cmsis/rtos2/include/cmsis_os2.h

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,55 @@
8585
#include <stddef.h>
8686

8787
/*! \file cmsis_os2.h
88-
\brief CMSIS RTOS2 interface for SuperTinyKernel (STK).
88+
\brief CMSIS RTOS2 interface for SuperTinyKernel RTOS.
8989
9090
\defgroup cmsis_rtos2 STK CMSIS RTOS2 API
91-
\brief CMSIS RTOS2 interface for C++ API of SuperTinyKernel (STK).
91+
\brief CMSIS RTOS2 interface for C++ API of SuperTinyKernel RTOS.
92+
93+
Maps the CMSIS RTOS2 C API (cmsis_os2.h) onto the STK C++ API.
94+
95+
Supported:
96+
- Kernel management (osKernelInitialize / Start / GetState / GetInfo /
97+
GetTickCount / GetTickFreq / GetSysTimerCount /
98+
GetSysTimerFreq / Lock / Unlock / RestoreLock)
99+
- Thread management (osThreadNew / Delete / Yield / Delay / osDelay /
100+
GetId / GetName / GetState / GetPriority /
101+
SetPriority / GetStackSize / GetStackSpace /
102+
GetCount / Terminate / Suspend / Resume, Join, Detach)
103+
- Thread flags (osThreadFlagsSet / Clear / Get / Wait)
104+
- Event flags (osEventFlagsNew / Delete / Set / Clear / Get / Wait)
105+
- Mutex (osMutexNew / Delete / Acquire / Release / GetOwner)
106+
- Semaphore (osSemaphoreNew / Delete / Acquire / Release / GetCount)
107+
- Timer (osTimerNew / Delete / Start / Stop / IsRunning)
108+
- Message Queue (osMessageQueueNew / Delete / Put / Get /
109+
GetCapacity / GetMsgSize / GetCount / GetSpace / Reset)
110+
- Memory Pool (osMemoryPoolNew / Delete / Alloc / Free /
111+
GetCapacity / GetBlockSize / GetCount / GetSpace /
112+
GetName)
113+
114+
Design notes:
115+
- All objects are heap-allocated with operator new/delete.
116+
For a fully static deployment, replace with a static object-pool allocator.
117+
- The wrapper owns one global Kernel instance (g_StkKernel).
118+
Call osKernelInitialize() before any other API, then osKernelStart().
119+
- The kernel is configured with KERNEL_DYNAMIC | KERNEL_SYNC and
120+
SwitchStrategyFP32 (32 fixed-priority levels).
121+
osThread priority values (osPriorityIdle=1 .. osPriorityISR=56) are
122+
linearly mapped to STK priority levels 0..31.
123+
- CMSIS osWaitForever (0xFFFFFFFF) is translated to STK WAIT_INFINITE.
124+
- Timeout values in CMSIS are in ticks; STK Sleep/Delay also take ticks,
125+
so no conversion is required.
126+
- Thread flags and event flags are backed by stk::sync::EventFlags,
127+
STK's native 32-bit multi-flag synchronization primitive.
128+
- Message queues are backed by stk::sync::MessageQueue, STK's native
129+
fixed-capacity, fixed-message-size ring-buffer with integrated blocking
130+
semantics (Put/Get with configurable timeouts, ISR-safe TryPut/TryGet).
131+
132+
Limitations / deviations from the specification:
133+
- Priority inheritance (osMutexPrioInherit): ignored, always supported.
134+
- Robust mutex (osMutexRobust): will assert as unsafe code.
135+
- Recursive mutex (osMutexRecursive): ignored, always recursive by default.
136+
92137
@{
93138
*/
94139

interop/cmsis/rtos2/src/cmsis_os2_stk.cpp

Lines changed: 6 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,19 @@
11
/*
2-
* CMSIS RTOS2 wrapper for SuperTinyKernel (STK) RTOS.
2+
* SuperTinyKernel(TM) RTOS: Lightweight High-Performance Deterministic C++ RTOS for Embedded Systems.
33
*
4-
* Maps the CMSIS RTOS2 C API (cmsis_os2.h) onto the STK C++ API.
4+
* Source: https://github.com/SuperTinyKernel-RTOS
55
*
6-
* Supported:
7-
* - Kernel management (osKernelInitialize / Start / GetState / GetInfo /
8-
* GetTickCount / GetTickFreq / GetSysTimerCount /
9-
* GetSysTimerFreq / Lock / Unlock / RestoreLock)
10-
* - Thread management (osThreadNew / Delete / Yield / Delay / osDelay /
11-
* GetId / GetName / GetState / GetPriority /
12-
* SetPriority / GetStackSize / GetStackSpace /
13-
* GetCount / Terminate / Suspend / Resume, Join, Detach)
14-
* - Thread flags (osThreadFlagsSet / Clear / Get / Wait)
15-
* - Event flags (osEventFlagsNew / Delete / Set / Clear / Get / Wait)
16-
* - Mutex (osMutexNew / Delete / Acquire / Release / GetOwner)
17-
* - Semaphore (osSemaphoreNew / Delete / Acquire / Release / GetCount)
18-
* - Timer (osTimerNew / Delete / Start / Stop / IsRunning)
19-
* - Message Queue (osMessageQueueNew / Delete / Put / Get /
20-
* GetCapacity / GetMsgSize / GetCount / GetSpace / Reset)
21-
* - Memory Pool (osMemoryPoolNew / Delete / Alloc / Free /
22-
* GetCapacity / GetBlockSize / GetCount / GetSpace /
23-
* GetName)
24-
*
25-
* Design notes:
26-
* - All objects are heap-allocated with operator new/delete.
27-
* For a fully static deployment, replace with a static object-pool allocator.
28-
* - The wrapper owns one global Kernel instance (g_StkKernel).
29-
* Call osKernelInitialize() before any other API, then osKernelStart().
30-
* - The kernel is configured with KERNEL_DYNAMIC | KERNEL_SYNC and
31-
* SwitchStrategyFP32 (32 fixed-priority levels).
32-
* osThread priority values (osPriorityIdle=1 .. osPriorityISR=56) are
33-
* linearly mapped to STK priority levels 0..31.
34-
* - CMSIS osWaitForever (0xFFFFFFFF) is translated to STK WAIT_INFINITE.
35-
* - Timeout values in CMSIS are in ticks; STK Sleep/Delay also take ticks,
36-
* so no conversion is required.
37-
* - Thread flags and event flags are backed by stk::sync::EventFlags,
38-
* STK's native 32-bit multi-flag synchronization primitive.
39-
* - Message queues are backed by stk::sync::MessageQueue, STK's native
40-
* fixed-capacity, fixed-message-size ring-buffer with integrated blocking
41-
* semantics (Put/Get with configurable timeouts, ISR-safe TryPut/TryGet).
42-
*
43-
* Limitations / deviations from the specification:
44-
* - Priority inheritance (osMutexPrioInherit): ignored, always supported.
45-
* - Robust mutex (osMutexRobust): will assert as unsafe code.
46-
* - Recursive mutex (osMutexRecursive): ignored, always recursive by default.
6+
* Copyright (c) 2022-2026 Neutron Code Limited <stk@neutroncode.com>. All Rights Reserved.
7+
* License: MIT License, see LICENSE for a full text.
478
*/
489

4910
#include "stk.h"
5011
#include "sync/stk_sync.h"
5112
#include "time/stk_time.h"
5213
#include "memory/stk_memory.h"
5314

15+
// See design notes, API coverage and other details in cmsis_os2.h.
16+
5417
#include "cmsis_os2.h"
5518

5619
// ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)