SuperTinyKernel™ RTOS 1.06.x
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
Loading...
Searching...
No Matches
stk_defs.h File Reference

Compiler and platform low-level definitions for STK. More...

#include <cstddef>
#include <cstdint>
#include <algorithm>
#include "stk_config.h"
Include dependency graph for stk_defs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  STK_ALLOCATE_COUNT< MODE, FLAG, ONTRUE, ONFALSE >
 Selects a static array element count at compile time based on a mode flag. More...

Namespaces

namespace  stk
 Namespace of STK package.
namespace  stk::util
 Internal utility namespace containing data structure helpers (linked lists, etc.) used by the kernel implementation. Not part of the public user API.

Macros

#define STK_STRICT_COMPLIANCY   (0)
 Allow the use of workarounds to make binary smaller and faster.
#define STK_TICKLESS_USE_ARM_DWT   (1)
 Use DWT timer of ARM Cortex-M for a precise tick calculation.
#define STK_TICKLESS_TICKS_MAX   (1000)
 Maximum number of kernel ticks the hardware timer may be suppressed in one tickless idle interval when STK_TICKLESS_IDLE=1. Default: 1000.
#define STK_TLS   (0)
 Enable per-task thread-local storage (TLS).
#define STK_TLS_PREFER_REGISTER   (0)
 Store the per-task TLS pointer in a dedicated CPU register instead of the stk::Stack::tls member, enabling single-instruction TLS access.
#define STK_SYNC_DEBUG_NAMES   (0)
 Enable debug names for synchronization primitives (mutexes, events, etc.) for debugging and tracing purposes.
#define STK_VIRT_DTOR
 Makes destructors virtual and compliant to strict rules if STK_STRICT_COMPLIANCY=0.
#define __stk_forceinline   inline
 Forces compiler to always inline the decorated function, regardless of optimisation level.
#define __stk_aligned(x)
 Specifies minimum alignment in bytes for the decorated variable or struct member (data instance prefix).
#define __stk_weak
 Marks a function or variable as weak, allowing it to be overridden by the user.
#define __stk_attr_naked
 Suppresses compiler-generated function prologue and epilogue (function prefix).
#define __stk_attr_noreturn
 Declares that function never returns to its caller (function prefix).
#define __stk_attr_unused
 Suppresses compiler warnings about an unused type, variable, or function (declaration prefix).
#define __stk_attr_used
 Marks a symbol as used, preventing the linker from discarding it even if no references are visible (declaration prefix).
#define __stk_attr_noinline
 Prevents compiler from inlining the decorated function (function prefix).
#define __stk_attr_deprecated
 Marks a function, class, variable, or typedef as deprecated (declaration prefix).
#define __stk_constexpr_cpp17
 constexpr definition for C++17 and above.
#define STK_ASSERT(e)
 Runtime assertion. Halts execution if the expression e evaluates to false.
#define STK_STATIC_ASSERT_DESC_N(NAME, X, DESC)
 Compile-time assertion with a user-defined name suffix and a custom error description.
#define STK_STATIC_ASSERT_DESC(X, DESC)
 Compile-time assertion with a custom error description. Produces a compilation error if X is false.
#define STK_STATIC_ASSERT_N(NAME, X)
 Compile-time assertion with a user-defined name suffix.
#define STK_STATIC_ASSERT(X)
 Compile-time assertion. Produces a compilation error if X is false.
#define STK_STACK_MEMORY_FILLER   (static_cast<stk::Word>((sizeof(stk::Word) <= 4U) ? 0xDEADBEEFU : 0xDEADBEEFDEADBEEFULL))
 Sentinel value written to the entire stack region at initialization (stack watermark pattern).
#define STK_STACK_MEMORY_ALIGN   (4U)
 Stack memory alignment.
#define STK_CRITICAL_SECTION_NESTINGS_MAX   (16U)
 Maximum allowable recursion depth for critical section entry (default: 16).
#define STK_ARCH_CPU_COUNT   (1U)
 Number of physical CPU cores available to the scheduler (default: 1).
#define STK_STACK_SIZE_MIN   (32U)
 Minimum stack size in elements of Word, shared by all stack allocation lower-bound checks.
#define STK_SLEEP_TRAP_STACK_SIZE   (STK_STACK_SIZE_MIN)
 Stack size for the sleep trap in elements of Word (default: STK_STACK_SIZE_MIN).
#define STK_ENDIAN_IDX_HI   (1U)
 Array index of the high 32-bit word when a 64-bit value is viewed as uint32_t[2].
#define STK_ENDIAN_IDX_LO   (0U)
 Array index of the low 32-bit word when a 64-bit value is viewed as uint32_t[2].
#define STK_NONCOPYABLE_CLASS(TYPE)
 Disables copy construction and assignment for a class.
#define STK_UNUSED(X)
 Explicitly marks a variable as unused to suppress compiler warnings.

Functions

static void __stk_debug_break ()
template<typename T>
static constexpr T stk::Min (T a, T b)
 Compile-time minimum of two values.
template<typename T>
static constexpr T stk::Max (T a, T b)
 Compile-time maximum of two values.

Detailed Description

Compiler and platform low-level definitions for STK.

Note
Includes stk_config.h first so user-level configuration macros (e.g. STK_TICKLESS_IDLE, STK_SEGGER_SYSVIEW) are visible to all definitions below. Refer to stk_config.h and project examples for configuration details.

Definition in file stk_defs.h.

Macro Definition Documentation

◆ __stk_aligned

#define __stk_aligned ( x)

Specifies minimum alignment in bytes for the decorated variable or struct member (data instance prefix).

Parameters
[in]xRequired alignment in bytes. Must be a power of two.
Note
On compilers not listed below the attribute expands to nothing and alignment is not enforced. Verify alignment-sensitive data on new toolchains.

Definition at line 187 of file stk_defs.h.

◆ __stk_attr_deprecated

#define __stk_attr_deprecated

Marks a function, class, variable, or typedef as deprecated (declaration prefix).

Note
The compiler will emit a warning at every call site or use of the decorated symbol, prompting callers to migrate to the replacement API.

Definition at line 268 of file stk_defs.h.

◆ __stk_attr_naked

#define __stk_attr_naked

Suppresses compiler-generated function prologue and epilogue (function prefix).

Note
The decorated function must consist of inline assembly only. C statements that rely on a stack frame (local variables, non-trivial expressions, function calls) produce undefined behaviour. Used for context-switch stubs and ISR entry points where the register save/restore sequence must be precisely hand-written.

Definition at line 211 of file stk_defs.h.

◆ __stk_attr_noinline

#define __stk_attr_noinline

Prevents compiler from inlining the decorated function (function prefix).

Note
Used where inlining would obscure stack-depth analysis, produce unpredictable code size, or make profiling and tracing results misleading.

Definition at line 255 of file stk_defs.h.

Referenced by stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::AddTask(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::AddTask(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::FindTaskBySP(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::FindTaskByUserTask(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::Initialize(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::InitTraps(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::OnStart(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::OnStop(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::RemoveTask(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::RequestAddTask(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::ScheduleTaskRemoval(), and stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::Start().

◆ __stk_attr_noreturn

#define __stk_attr_noreturn

Declares that function never returns to its caller (function prefix).

Note
Enables compiler to omit return-path code and dead-store warnings after the call site.
Warning
Applying this attribute to a function that does return produces undefined behaviour.

Definition at line 222 of file stk_defs.h.

◆ __stk_attr_unused

#define __stk_attr_unused

Suppresses compiler warnings about an unused type, variable, or function (declaration prefix).

Note
Does not prevent the linker from discarding the symbol. Use __stk_attr_used when the symbol must be retained regardless of whether it appears to be referenced.

Definition at line 233 of file stk_defs.h.

◆ __stk_attr_used

#define __stk_attr_used

Marks a symbol as used, preventing the linker from discarding it even if no references are visible (declaration prefix).

Note
Commonly applied to ISR vector table entries, trap stubs, and objects placed in special linker sections that are referenced only from assembly or linker scripts.

Definition at line 244 of file stk_defs.h.

◆ __stk_constexpr_cpp17

#define __stk_constexpr_cpp17

constexpr definition for C++17 and above.

Note
Can be used as 'if __stk_constexpr_cpp17 (x) {}' with C++11 without a warning.

Definition at line 382 of file stk_defs.h.

Referenced by stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::AddTask(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::AddTask(), stk::memory::MemoryAllocator::AllocateArrayT(), stk::memory::MemoryAllocator::AllocateOneT(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::Bind(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::FetchNextEvent(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::FindTaskBySP(), stk::memory::MemoryAllocator::FreeArrayT(), stk::memory::MemoryAllocator::FreeOneT(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::GetCurrentWeight(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::GetHrtDeadline(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::GetHrtPeriodicity(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::GetHrtRelativeDeadline(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::GetSleepTicks(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::GetWeight(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelService::InheritWeight(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::Initialize(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::InitTraps(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::KernelTask(), stk::util::DListHead< T, TClosedLoop >::Link(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::OnStart(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::OnStop(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::OnTaskExit(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::OnTaskSleep(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::OnTaskWait(), stk::hw::ReadVolatile64(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::RemoveTask(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelService::RestoreWeight(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelService::Resume(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::ScheduleRemoval(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::ScheduleSleep(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::ScheduleTaskRemoval(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::SetCurrentWeight(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelService::Sleep(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelService::SleepCancel(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelService::SleepUntil(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::StateExit(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::StateSleep(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::StateSwitch(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::StateWake(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelService::Suspend(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::Unbind(), stk::util::DListHead< T, TClosedLoop >::UpdateEnds(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::UpdateTaskRequest(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::UpdateTasks(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::UpdateTaskState(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelService::Wait(), and stk::hw::WriteVolatile64().

◆ __stk_forceinline

#define __stk_forceinline   inline

Forces compiler to always inline the decorated function, regardless of optimisation level.

Note
Used on latency-critical paths (ISR handlers, scheduler hot paths) where a function call overhead would be unacceptable or would unpredictably affect real-time timing.
On compilers not listed below the attribute expands to nothing (inlining becomes a hint only).

Definition at line 175 of file stk_defs.h.

Referenced by __stk_debug_break(), __stk_dmb(), __stk_dmb(), CastCppKernelInterfaceToC(), CastCppTaskInterfaceToC(), CastCppTimerWrapperToC(), CastCToKernelInterface(), CastCToKernelInterfaceConst(), CmsisFlagsOptionsToStk(), CmsisPrioToStk(), CmsisTimeoutToStk(), stk::ConvertTimeUsToClockCycles(), stk::Delay(), stk::DelayMs(), stk::SwitchStrategyFixedPriority< 32 >::GetHighestReadyPriority(), stk::GetMsFromTicks(), stk::GetSysTimerCount(), stk::GetSysTimerFrequency(), stk::SwitchStrategyFixedPriority< 32 >::GetTaskPriority(), stk::SwitchStrategyFixedPriority< 32 >::GetTaskPriorityFromWeight(), stk::GetTickResolution(), stk::GetTicks(), stk::GetTicksFromMs(), stk::GetTicksFromMs(), stk::GetTicksFromMsClampedToTimeout(), stk::GetTid(), stk::GetTimeNowMs(), stk::hw::HiResClock::GetTimeUs(), stk::GetTls(), stk::hw::IsInsideISR(), IsIrqContext(), stk::IsIsrTid(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::IsValidFsmState(), stk::util::DListCast::ListEntryToParent(), stk::hw::ReadVolatile64(), stk::SetTls(), stk::Sleep(), stk::SleepCancel(), stk::SleepMs(), stk::SleepUntil(), stk::STK_KERNEL_PANIC(), STK_MEMCPY(), StkFlagsResultToCmsis(), StkPrioToCmsis(), stk::hw::WriteVolatile64(), and stk::Yield().

◆ __stk_weak

#define __stk_weak

Marks a function or variable as weak, allowing it to be overridden by the user.

Note
On compilers not listed below the attribute expands to nothing. If not supported, multiple definition errors may occur during linking.

Definition at line 198 of file stk_defs.h.

Referenced by pvPortMalloc(), and vPortFree().

◆ STK_ARCH_CPU_COUNT

#define STK_ARCH_CPU_COUNT   (1U)

Number of physical CPU cores available to the scheduler (default: 1).

Note
Controls the number of per-CPU kernel service instances and per-CPU data structures allocated by the kernel. Set to the actual core count for SMP (symmetric multi-processing) targets. Can be defined in the architecture header or stk_config.h.

Definition at line 493 of file stk_defs.h.

◆ STK_ASSERT

#define STK_ASSERT ( e)

Runtime assertion. Halts execution if the expression e evaluates to false.

Note
Behaviour depends on build configuration:
  • If _STK_ASSERT_REDIRECT is defined: always redirects to the custom handler STK_ASSERT_HANDLER (regardless of debug/release build type). Signature:
    void STK_ASSERT_HANDLER(const char *expr, const char *file, int32_t line);
    Use this on embedded targets where the standard assert handler is unavailable, or where a custom fault logger or LED indicator is preferred.
  • Else if DEBUG or _DEBUG is defined (debug build): maps to the standard assert() macro from <assert.h>, which halts execution on failure.
  • Else (release build): expands to nothing. The expression e is completely elided, including any side effects. Do not rely on side effects inside STK_ASSERT.
Warning
In release builds without _STK_ASSERT_REDIRECT, all assertions are silently removed. Safety-critical applications (ISO 26262, IEC 61508) should define _STK_ASSERT_REDIRECT to retain fault detection in all build configurations.

Definition at line 409 of file stk_defs.h.

Referenced by stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::AddTask(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::AddTask(), stk::SwitchStrategyEDF::AddTask(), stk::SwitchStrategyFixedPriority< 32 >::AddTask(), stk::SwitchStrategyMonotonic< MSS_TYPE_RATE >::AddTask(), stk::SwitchStrategyRoundRobin::AddTask(), stk::SwitchStrategySmoothWeightedRoundRobin::AddTask(), stk::ISyncObject::AddWaitObject(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::AllocateAndAddNewTask(), stk::memory::MemoryAllocator::AllocateArrayT(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::AllocateNewTask(), stk::memory::MemoryAllocator::AllocateOneT(), AllocateTask(), StkMessageQueue::AllocBuffer(), stk::memory::BlockMemoryPool::BlockMemoryPool(), stk::memory::BlockMemoryPool::BlockMemoryPool(), stk::memory::BlockMemoryPool::BuildFreeList(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelService::Delay(), stk::sync::EventFlags::EventFlags(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::FetchNextEvent(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::FindTaskBySP(), stk::memory::BlockMemoryPool::Free(), stk::memory::MemoryAllocator::FreeArrayT(), stk::memory::MemoryAllocator::FreeOneT(), FreeTask(), stk::sync::MessageQueue::Get(), stk::SwitchStrategyEDF::GetFirst(), stk::SwitchStrategyFixedPriority< 32 >::GetFirst(), stk::SwitchStrategyMonotonic< MSS_TYPE_RATE >::GetFirst(), stk::SwitchStrategyRoundRobin::GetFirst(), stk::SwitchStrategySmoothWeightedRoundRobin::GetFirst(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::GetHrtDeadline(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::GetHrtPeriodicity(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::GetHrtRelativeDeadline(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::GetNewFsmState(), stk::SwitchStrategySmoothWeightedRoundRobin::GetNext(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::HrtAllocateAndAddNewTask(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::HrtHardFailDeadline(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::HrtInit(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::HrtOnSwitchedOut(), CTimerWrapper::Initialize(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::Initialize(), stk::PlatformContext::InitStackMemory(), stk::SchedulabilityCheck::IsSchedulableWCRT(), stk::util::DListHead< T, TClosedLoop >::Link(), stk::sync::SpinLock::LockRecursively(), stk::sync::MessageQueue::MessageQueue(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::OnGetTid(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::OnInheritWeight(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::OnRestoreWeight(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::OnStart(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::OnTaskExit(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::OnTaskSleep(), stk::SwitchStrategyEDF::OnTaskSleep(), stk::SwitchStrategyFixedPriority< 32 >::OnTaskSleep(), stk::SwitchStrategyMonotonic< MSS_TYPE_RATE >::OnTaskSleep(), stk::SwitchStrategyRoundRobin::OnTaskSleep(), stk::SwitchStrategySmoothWeightedRoundRobin::OnTaskSleep(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::OnTaskSleepUntil(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::OnTaskWait(), stk::SwitchStrategyEDF::OnTaskWake(), stk::SwitchStrategyFixedPriority< 32 >::OnTaskWake(), stk::SwitchStrategyMonotonic< MSS_TYPE_RATE >::OnTaskWake(), stk::SwitchStrategyRoundRobin::OnTaskWake(), stk::SwitchStrategySmoothWeightedRoundRobin::OnTaskWake(), stk::SwitchStrategyFixedPriority< 32 >::OnTaskWeightChange(), stk::ArrayView< T >::operator[](), osMutexNew(), osThreadNew(), stk::sync::MessageQueue::Peek(), stk::sync::MessageQueue::PeekFront(), stk::sync::Pipe::Pipe(), PlacementNewOrHeap(), stk::time::PeriodicTrigger::Poll(), stk::memory::BlockMemoryPool::PopFreeList(), stk::time::TimerHost::ProcessCommands(), stk::time::TimerHost::PushCommand(), stk::sync::MessageQueue::Put(), stk::sync::MessageQueue::PutFront(), stk::sync::Pipe::Read(), stk::sync::RWMutex::ReadUnlock(), stk::memory::MemoryAllocator::Stats::RecordFree(), RegisterKernel(), stk::util::DListHead< T, TClosedLoop >::RelinkTo(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::RemoveTask(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::RemoveTask(), stk::SwitchStrategyEDF::RemoveTask(), stk::SwitchStrategyFixedPriority< 32 >::RemoveTask(), stk::SwitchStrategyMonotonic< MSS_TYPE_RATE >::RemoveTask(), stk::SwitchStrategyRoundRobin::RemoveTask(), stk::SwitchStrategySmoothWeightedRoundRobin::RemoveTask(), stk::ISyncObject::RemoveWaitObject(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::RequestAddTask(), ResolveNotifyTarget(), stk::time::TimerHost::Restart(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelService::Resume(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::ResumeTask(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::ScheduleSleep(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::ScheduleTaskRemoval(), stk::sync::Semaphore::Semaphore(), SetEventOverrider(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::WaitObject::SetupWait(), stk::sync::Semaphore::Signal(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelService::Sleep(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelService::SleepUntil(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::Start(), stk::time::TimerHost::Start(), stk::time::TimerHost::StartOrReset(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::StateExit(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::StateSleep(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::StateSwitch(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::StateWake(), stk_blockpool_alloc(), stk_blockpool_create(), stk_blockpool_create_static(), stk_blockpool_destroy(), stk_blockpool_free(), stk_blockpool_get_block_size(), stk_blockpool_get_capacity(), stk_blockpool_get_free_count(), stk_blockpool_get_used_count(), stk_blockpool_is_empty(), stk_blockpool_is_full(), stk_blockpool_is_storage_valid(), stk_blockpool_timed_alloc(), stk_blockpool_try_alloc(), stk_cv_create(), stk_cv_notify_all(), stk_cv_notify_one(), stk_cv_wait(), stk_ef_clear(), stk_ef_create(), stk_ef_get(), stk_ef_set(), stk_ef_trywait(), stk_ef_wait(), stk_event_create(), stk_event_pulse(), stk_event_reset(), stk_event_set(), stk_event_trywait(), stk_event_wait(), stk_kernel_add_task(), stk_kernel_add_task_hrt(), stk_kernel_create(), stk_kernel_destroy(), stk_kernel_enumerate_tasks(), stk_kernel_get_state(), stk_kernel_init(), stk_kernel_is_schedulable(), stk_kernel_is_started(), stk_kernel_process_hard_fault(), stk_kernel_process_tick(), stk_kernel_remove_task(), stk_kernel_resume(), stk_kernel_resume_task(), stk_kernel_schedule_task_removal(), stk_kernel_set_event_overrider(), stk_kernel_start(), stk_kernel_suspend(), stk_kernel_suspend_task(), stk_msgq_create(), stk_msgq_get(), stk_msgq_get_buffer(), stk_msgq_get_capacity(), stk_msgq_get_count(), stk_msgq_get_msg_size(), stk_msgq_get_space(), stk_msgq_is_empty(), stk_msgq_is_full(), stk_msgq_is_storage_valid(), stk_msgq_peek(), stk_msgq_peekfront(), stk_msgq_put(), stk_msgq_putfront(), stk_msgq_reset(), stk_msgq_tryget(), stk_msgq_trypeek(), stk_msgq_trypeekfront(), stk_msgq_tryput(), stk_msgq_tryputfront(), stk_mutex_create(), stk_mutex_lock(), stk_mutex_timed_lock(), stk_mutex_trylock(), stk_mutex_unlock(), stk_periodic_trigger_create(), stk_periodic_trigger_get_period(), stk_periodic_trigger_poll(), stk_periodic_trigger_restart(), stk_periodic_trigger_set_period(), stk_pipe_create(), stk_pipe_get_capacity(), stk_pipe_get_count(), stk_pipe_get_element_size(), stk_pipe_get_space(), stk_pipe_is_empty(), stk_pipe_is_full(), stk_pipe_is_storage_valid(), stk_pipe_read(), stk_pipe_read_bulk(), stk_pipe_read_bulk_triggered(), stk_pipe_reset(), stk_pipe_tryread(), stk_pipe_tryread_bulk(), stk_pipe_tryread_bulk_triggered(), stk_pipe_trywrite(), stk_pipe_trywrite_bulk(), stk_pipe_write(), stk_pipe_write_bulk(), stk_rwmutex_create(), stk_rwmutex_lock(), stk_rwmutex_read_lock(), stk_rwmutex_read_unlock(), stk_rwmutex_timed_lock(), stk_rwmutex_timed_read_lock(), stk_rwmutex_try_read_lock(), stk_rwmutex_trylock(), stk_rwmutex_unlock(), stk_sem_create(), stk_sem_get_count(), stk_sem_signal(), stk_sem_trywait(), stk_sem_wait(), stk_spinlock_create(), stk_spinlock_lock(), stk_spinlock_trylock(), stk_spinlock_unlock(), stk_task_create_privileged(), stk_task_create_user(), stk_task_destroy(), stk_task_get_id(), stk_task_get_name(), stk_task_set_name(), stk_task_set_priority(), stk_task_set_weight(), stk_timer_create(), stk_timer_destroy(), stk_timer_get_deadline(), stk_timer_get_period(), stk_timer_get_remaining_ticks(), stk_timer_get_timestamp(), stk_timer_is_active(), stk_timer_reset(), stk_timer_restart(), stk_timer_set_period(), stk_timer_start(), stk_timer_start_or_reset(), stk_timer_stop(), stk_timerhost_get_size(), stk_timerhost_get_time_now(), stk_timerhost_init(), stk_timerhost_is_empty(), stk_timerhost_shutdown(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelService::Suspend(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::SuspendTask(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelService::SwitchToNext(), stk::memory::BlockMemoryPool::TimedAlloc(), stk::memory::BlockMemoryPool::TimedAllocT(), stk::sync::Mutex::TimedLock(), stk::sync::RWMutex::TimedLock(), stk::sync::RWMutex::TimedReadLock(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::Unbind(), stk::util::DListHead< T, TClosedLoop >::Unlink(), stk::sync::Mutex::Unlock(), stk::sync::RWMutex::Unlock(), stk::sync::SpinLock::Unlock(), stk::time::TimerHost::UpdateTime(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelService::Wait(), stk::sync::ConditionVariable::Wait(), stk::sync::Event::Wait(), stk::sync::Semaphore::Wait(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::WaitObject::Wake(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::Wake(), stk::sync::Pipe::Write(), xEventGroupSync(), xMessageBufferReceive(), xMessageBufferReceiveFromISR(), xMessageBufferSend(), xMessageBufferSendFromISR(), xQueueAddToSet(), xQueueRemoveFromSet(), stk::sync::ConditionVariable::~ConditionVariable(), stk::sync::Event::~Event(), stk::sync::Mutex::~Mutex(), stk::sync::RWMutex::~RWMutex(), stk::sync::Semaphore::~Semaphore(), and stk::sync::SpinLock::~SpinLock().

◆ STK_CRITICAL_SECTION_NESTINGS_MAX

#define STK_CRITICAL_SECTION_NESTINGS_MAX   (16U)

Maximum allowable recursion depth for critical section entry (default: 16).

Note
Establishes a hard deterministic bound for nested calls to Context::EnterCriticalSection() and Context::UnprivEnterCriticalSection(). This limit is mandatory for safety-critical certification (e.g., ISO 26262, IEC 61508) to prevent unbounded stack usage and identify logic deadlocks.
Exceeding this value at runtime shall trigger a Kernel Panic with the code KERNEL_PANIC_CS_NESTING_OVERFLOW to transition the system into a Safe State. Can be overridden in stk_config.h based on Worst-Case Stack Usage (WCSU) analysis.

Definition at line 483 of file stk_defs.h.

◆ STK_ENDIAN_IDX_HI

#define STK_ENDIAN_IDX_HI   (1U)

Array index of the high 32-bit word when a 64-bit value is viewed as uint32_t[2].

Note
Big-endian: 0 (high word first). Little-endian: 1 (high word second).
See also
STK_ENDIAN_IDX_LO, hw::ReadVolatile64, hw::WriteVolatile64

Definition at line 586 of file stk_defs.h.

Referenced by stk::hw::ReadVolatile64(), and stk::hw::WriteVolatile64().

◆ STK_ENDIAN_IDX_LO

#define STK_ENDIAN_IDX_LO   (0U)

Array index of the low 32-bit word when a 64-bit value is viewed as uint32_t[2].

Note
Big-endian: 1 (low word second). Little-endian: 0 (low word first).
See also
STK_ENDIAN_IDX_HI, hw::ReadVolatile64, hw::WriteVolatile64

Definition at line 587 of file stk_defs.h.

Referenced by stk::hw::ReadVolatile64(), and stk::hw::WriteVolatile64().

◆ STK_NONCOPYABLE_CLASS

#define STK_NONCOPYABLE_CLASS ( TYPE)
Value:
TYPE(const TYPE &) = delete;\
TYPE &operator=(const TYPE &) = delete;

Disables copy construction and assignment for a class.

This macro declares a private copy constructor and copy assignment operator to prevent the compiler from generating default ones. It ensures that instances of a class cannot be duplicated.

Parameters
[in]TYPEThe name of the class to be made non-copyable.
Warning
This macro must be placed within the private or protected section of the class declaration to be effective.
Note
In C++11 and later, it is generally preferred to use = delete, however, this macro provides compatibility for legacy environments.

Definition at line 601 of file stk_defs.h.

601#define STK_NONCOPYABLE_CLASS(TYPE)\
602 TYPE(const TYPE &) = delete;\
603 TYPE &operator=(const TYPE &) = delete;

◆ STK_SLEEP_TRAP_STACK_SIZE

#define STK_SLEEP_TRAP_STACK_SIZE   (STK_STACK_SIZE_MIN)

Stack size for the sleep trap in elements of Word (default: STK_STACK_SIZE_MIN).

See also
Kernel::SleepTrapStackMemory
Note
If IEventOverrider::OnSleep() is overridden with a non-trivial implementation (e.g. calling platform-specific low-power APIs that use the stack), increase this value to accommodate the additional stack frame depth required by that implementation. Can be defined in stk_config.h.

Definition at line 546 of file stk_defs.h.

◆ STK_STACK_MEMORY_ALIGN

#define STK_STACK_MEMORY_ALIGN   (4U)

Stack memory alignment.

Definition at line 468 of file stk_defs.h.

Referenced by stk::PlatformContext::InitStackMemory().

◆ STK_STACK_MEMORY_FILLER

#define STK_STACK_MEMORY_FILLER   (static_cast<stk::Word>((sizeof(stk::Word) <= 4U) ? 0xDEADBEEFU : 0xDEADBEEFDEADBEEFULL))

Sentinel value written to the entire stack region at initialization (stack watermark pattern).

Note
Used to detect stack overflow and to measure peak stack usage at run-time: any stack word that still contains this value was never written by the task.
Defaults to 0xDEADBEEF on 32-bit targets and 0xDEADBEEFDEADBEEF on 64-bit targets. Can be overridden by defining STK_STACK_MEMORY_FILLER before including this header or in stk_config.h.

Definition at line 456 of file stk_defs.h.

Referenced by stk::IStackMemory::GetStackSpace(), stk::PlatformContext::InitStackMemory(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::StateSwitch(), and stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::StateWake().

◆ STK_STACK_SIZE_MIN

#define STK_STACK_SIZE_MIN   (32U)

Minimum stack size in elements of Word, shared by all stack allocation lower-bound checks.

See also
TrapStackMemory
Note
This is the smallest stack that can correctly save and restore all CPU registers during a context switch or service trap. The required size depends on the number of registers the architecture mandates saving and specific platform alignment requirements.
Default values by architecture:
  • ARM Cortex-M and RISC-V RV32E (reduced 16-register file): 32 elements.
  • Standard RISC-V (RV32I / RV64I) without FPU: 256 elements (larger register file; smaller sizes may cause memory corruption on RP2350).
  • Standard RISC-V with FPU: 512 elements + (__riscv_flen * 2) (dedicated FP registers significantly expand the required frame size).
Can be overridden to any larger value in stk_config.h if your application's interrupt nesting or stack frame size requires it.

Definition at line 533 of file stk_defs.h.

◆ STK_STATIC_ASSERT

#define STK_STATIC_ASSERT ( X)
Value:
#define STK_STATIC_ASSERT_DESC_N(NAME, X, DESC)
Compile-time assertion with a user-defined name suffix and a custom error description.
Definition stk_defs.h:421

Compile-time assertion. Produces a compilation error if X is false.

Note
Uses a fixed internal symbol name. If more than one STK_STATIC_ASSERT appears in the same scope, use STK_STATIC_ASSERT_N to provide distinct name suffixes and avoid duplicate symbol errors.

Definition at line 446 of file stk_defs.h.

Referenced by stk::IKernel::EnumerateTasksT(), stk::hw::PtrToWord(), stk::StackMemoryWrapper<((32U))>::StackMemoryWrapper(), stk_kernel_create(), and stk::hw::WordToPtr().

◆ STK_STATIC_ASSERT_DESC

#define STK_STATIC_ASSERT_DESC ( X,
DESC )
Value:

Compile-time assertion with a custom error description. Produces a compilation error if X is false.

Note
Uses a fixed internal symbol name. If more than one STK_STATIC_ASSERT_DESC appears in the same scope, use STK_STATIC_ASSERT_DESC_N to provide distinct name suffixes and avoid duplicate symbol errors.

Definition at line 429 of file stk_defs.h.

Referenced by stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::Kernel(), and stk::SwitchStrategyFixedPriority< 32 >::SwitchStrategyFixedPriority().

◆ STK_STATIC_ASSERT_DESC_N

#define STK_STATIC_ASSERT_DESC_N ( NAME,
X,
DESC )
Value:
static_assert((X), DESC)

Compile-time assertion with a user-defined name suffix and a custom error description.

Note
NAME is appended to the internal symbol name, allowing multiple assertions in the same scope without symbol-name collisions.
DESC is a string literal shown in the compiler diagnostic — use it to provide a human-readable explanation of the constraint. Prefer this over STK_STATIC_ASSERT_N when the expression alone would not be self-explanatory in a compiler error.

Definition at line 421 of file stk_defs.h.

◆ STK_STATIC_ASSERT_N

#define STK_STATIC_ASSERT_N ( NAME,
X )
Value:

Compile-time assertion with a user-defined name suffix.

Note
NAME is appended to the internal symbol name, allowing multiple assertions in the same scope without symbol-name collisions.
The compiler diagnostic message is the stringified form of expression X. Use STK_STATIC_ASSERT_DESC_N instead when you need a more descriptive error message.

Definition at line 438 of file stk_defs.h.

Referenced by stk::util::DListCast::ListEntryToParent(), stk::hw::ReadVolatile64(), and stk::hw::WriteVolatile64().

◆ STK_STRICT_COMPLIANCY

#define STK_STRICT_COMPLIANCY   (0)

Allow the use of workarounds to make binary smaller and faster.

Note
Applied workarounds will break safety-critical rules (MISRA, etc).

Definition at line 51 of file stk_defs.h.

◆ STK_SYNC_DEBUG_NAMES

#define STK_SYNC_DEBUG_NAMES   (0)

Enable debug names for synchronization primitives (mutexes, events, etc.) for debugging and tracing purposes.

Note
When set to 1, synchronization objects gain a string name field (see ITraceable::SetTraceName) that is visible in SEGGER SystemView and other trace tools.
Automatically set to 1 when STK_SEGGER_SYSVIEW is enabled. Can be manually defined in stk_config.h to override the default.
Default: 0 (disabled) unless STK_SEGGER_SYSVIEW is active.

Definition at line 152 of file stk_defs.h.

◆ STK_TICKLESS_TICKS_MAX

#define STK_TICKLESS_TICKS_MAX   (1000)

Maximum number of kernel ticks the hardware timer may be suppressed in one tickless idle interval when STK_TICKLESS_IDLE=1. Default: 1000.

Note
Must not exceed 100000. Values above this limit cause a compile-time error because the internal tick-request calculation uses a uint32_t accumulator that would overflow at higher values.
Increase to allow longer uninterrupted sleep intervals; decrease to improve wakeup responsiveness at the cost of more frequent timer interrupts.
See also
STK_TICKLESS_IDLE, KERNEL_TICKLESS

Definition at line 77 of file stk_defs.h.

Referenced by stk::GetInitialSleepTicks< true >().

◆ STK_TICKLESS_USE_ARM_DWT

#define STK_TICKLESS_USE_ARM_DWT   (1)

Use DWT timer of ARM Cortex-M for a precise tick calculation.

Note
DWT is available on Cortex-M3 and higher only (__CORTEX_M >= 3). It has no effect on Cortex-M0/M0+.
STK_TICKLESS_USE_ARM_DWT has no effect on RISC-V targets. RISC-V tickless uses the CLINT mtime absolute timestamp for drift-free timer rearm and does not require rearm-error compensation.

Definition at line 63 of file stk_defs.h.

◆ STK_TLS

#define STK_TLS   (0)

Enable per-task thread-local storage (TLS).

Note
When set to 1, the kernel saves and restores a per-task TLS pointer on every context switch, making a dedicated pointer available to each task at all times via stk::hw::GetTlsPtr/SetTlsPtr.
Storage strategy is controlled by STK_TLS_PREFER_REGISTER:
  • STK_TLS_PREFER_REGISTER=0 (default): the pointer is kept in the stk::Stack::tls member. No special compiler flags required.
  • STK_TLS_PREFER_REGISTER=1: the pointer is kept in a CPU register (r9 on Cortex-M, tp on RISC-V) for single-instruction access. Cortex-M additionally requires -ffixed-r9 for all task translation units; see STK_TLS_PREFER_REGISTER.
Default: 0 (disabled).
See also
STK_TLS_PREFER_REGISTER, stk::hw::GetTlsPtr, stk::hw::SetTlsPtr

Definition at line 99 of file stk_defs.h.

◆ STK_TLS_PREFER_REGISTER

#define STK_TLS_PREFER_REGISTER   (0)

Store the per-task TLS pointer in a dedicated CPU register instead of the stk::Stack::tls member, enabling single-instruction TLS access.

Note
ARM Cortex-M: uses r9 (ARM EABI "platform register", AAPCS 5.2.2). Every translation unit that contains task code must be compiled with -ffixed-r9. Without it the compiler may allocate r9 as an ordinary callee-saved register, silently overwriting the TLS pointer after a context switch. See stk_arch_arm-cortex-m.h for the full explanation.
RISC-V: uses the tp (x4) register, which is reserved for TLS by the RISC-V psABI. STK_TLS_PREFER_REGISTER is forced to 1 on RISC-V regardless of this setting; no additional compiler flags are needed.
When set to 1 on Cortex-M, stk::Stack gains no tls member, reducing per-task RAM by one Word. On targets with many tasks this saving can be significant.
Default: 0 (disabled). Leave at 0 if -ffixed-r9 cannot be applied to all task translation units (e.g. pre-built third-party libraries); the memory-based fallback incurs only one extra load/store per TLS access.
Warning
Cortex-M only: -ffixed-r9 must be applied to every translation unit in the binary that contains task code, including inlined functions and any library code those tasks call. A single TU compiled without the flag is sufficient to cause intermittent, hard-to-reproduce TLS corruption.
See also
STK_TLS, stk::hw::GetTlsPtr, stk::hw::SetTlsPtr

Definition at line 127 of file stk_defs.h.

◆ STK_UNUSED

#define STK_UNUSED ( X)
Value:
static_cast<void>((X))

Explicitly marks a variable as unused to suppress compiler warnings.

Definition at line 608 of file stk_defs.h.

Referenced by stk::memory::MemoryAllocator::AllocateArrayT(), stk::memory::MemoryAllocator::AllocateOneT(), stk::memory::BlockMemoryPool::BlockMemoryPool(), stk::memory::BlockMemoryPool::BlockMemoryPool(), stk::memory::MemoryAllocator::FreeArrayT(), FrtosMessageBuffer::FrtosMessageBuffer(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::InitTraps(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::Kernel(), stk::sync::Mutex::Lock(), stk::sync::RWMutex::Lock(), stk::ITask::OnDeadlineMissed(), CTimerWrapper::OnExpired(), stk::IPlatform::IEventOverrider::OnSleep(), stk::ITaskSwitchStrategy::OnTaskDeadlineMissed(), stk::ITaskSwitchStrategy::OnTaskWeightChange(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::OnTick(), osKernelResume(), osThreadJoin(), stk::time::TimerHost::ProcessCommands(), QueueSetNotify(), stk::sync::RWMutex::ReadLock(), stk::ITraceable::SetTraceName(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::StateExit(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::StateSleep(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::StateWake(), STK_MEMCPY(), and stk::time::TimerHost::UpdateTime().

◆ STK_VIRT_DTOR

#define STK_VIRT_DTOR

Makes destructors virtual and compliant to strict rules if STK_STRICT_COMPLIANCY=0.

Definition at line 159 of file stk_defs.h.

Referenced by stk::sync::ConditionVariable::~ConditionVariable(), stk::sync::Event::~Event(), stk::sync::EventFlags::~EventFlags(), EventOverrider::~EventOverrider(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::~Kernel(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelService::~KernelService(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::~KernelTask(), stk::sync::MessageQueue::~MessageQueue(), stk::sync::MessageQueueT< N, MSG >::~MessageQueueT(), stk::sync::Mutex::~Mutex(), stk::sync::Pipe::~Pipe(), stk::PlatformArmCortexM::~PlatformArmCortexM(), stk::PlatformContext::~PlatformContext(), stk::sync::RWMutex::~RWMutex(), stk::sync::ScopedCriticalSection::~ScopedCriticalSection(), stk::sync::Semaphore::~Semaphore(), stk::sync::SpinLock::~SpinLock(), stk::StackMemoryWrapper<((32U))>::~StackMemoryWrapper(), stk::SwitchStrategyEDF::~SwitchStrategyEDF(), stk::SwitchStrategyFixedPriority< 32 >::~SwitchStrategyFixedPriority(), stk::SwitchStrategyMonotonic< MSS_TYPE_RATE >::~SwitchStrategyMonotonic(), stk::SwitchStrategyRoundRobin::~SwitchStrategyRoundRobin(), stk::SwitchStrategySmoothWeightedRoundRobin::~SwitchStrategySmoothWeightedRoundRobin(), stk::Task< _StackSize, _AccessMode >::~Task(), stk::TaskW< _Weight, _StackSize, _AccessMode >::~TaskW(), TaskWrapper::~TaskWrapper(), stk::time::TimerHost::Timer::~Timer(), and stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::WaitObject::~WaitObject().

Function Documentation

◆ __stk_debug_break()

void __stk_debug_break ( )
inlinestatic

Definition at line 372 of file stk_defs.h.

372{}

References __stk_forceinline.

Referenced by stk::STK_KERNEL_PANIC().

Here is the caller graph for this function: