Part V: Kernel Configuration

This chapter details the available configuration options, covering system parameters, scheduling settings, memory protection, interrupt handling, and enabled services. QRT settings are defined at compile-time and must be adjusted before building the kernel. Developers can:

  • Enable or disable kernel features (e.g., FPU support, caching).

  • Adjust system parameters (e.g., thread limits, total memory allocated for thread stacks).

  • Define memory protection settings (e.g., MPU regions).

Configuration Options

Configuration options for QRT Real-Time Kernel.

Allows configuring processor core, MPU, FPU, System Timer, scheduler, interrupt handling, IPC and kernel.

Defines

QRT_CPU_RV32E 12

RISC-V 32-bit embedded

QRT_CPU_RV32I 13

RISC-V 32-bit

QRT_CPU_CORTEX_A15 20

ARM Cortex-A15 (AArch32)

QRT_CPU_CORTEX_R5 21

ARM Cortex-R5

QRT_CFG_CPU_CORE

Options:

  • QRT_CPU_CORTEX_M0P

  • QRT_CPU_CORTEX_M3

  • QRT_CPU_CORTEX_M4

  • QRT_CPU_CORTEX_M7

  • QRT_CPU_CORTEX_M23

  • QRT_CPU_CORTEX_M33

  • QRT_CPU_CORTEX_M35P

  • QRT_CPU_CORTEX_M52

  • QRT_CPU_CORTEX_M55

  • QRT_CPU_CORTEX_M85

  • QRT_CPU_RV32E

  • QRT_CPU_RV32I

QRT_CFG_ICACHE_ENABLE (0)

Enable instruction cache (if supported by CPU core)

Options:

  • 0: Instruction cache disabled

  • 1: Instruction cache enabled

QRT_CFG_DCACHE_ENABLE (0)

Enable data cache (if supported by CPU core)

Options:

  • 0: Data cache disabled

  • 1: Data cache enabled

QRT_CFG_THREAD_LIMIT (256)

Maximum number of threads.

QRT_CFG_CLEANUP_LIMIT (4u)

Maximum cleanup handlers per thread.

QRT_CFG_STACK_POOL_SIZE (65536u)

Total stack pool size in bytes.

QRT_CFG_THREAD_STACK_DEFAULT (2048u)

Default thread stack size in bytes.

QRT_CFG_THREAD_STACK_LIMIT_CHECK (0)

Enable stack limit checking for threads (ARMv8-M only)

Options:

  • 0: Stack limit checking disabled

  • 1: Stack limit checking enabled

QRT_CFG_THREAD_NAME_ENABLE (1)

Enable thread naming support.

Options:

  • 0: Thread naming disabled

  • 1: Thread naming enabled

QRT_CFG_SCHED_TIME_SLICE (10u)

Default time slice in milliseconds.

QRT_CFG_SCHED_TIME_SLICE_MIN_US (100u)

Minimum round-robin time slice in microseconds.

Must stay well above the time one System Timer re-arm pass takes on this core, or a thread’s slice ends before it can run.

QRT_CFG_IDLE_STACK_SIZE (128u)

Idle thread stack size in bytes.

QRT_CFG_IDLE_SLEEP_ENABLE (0)

Enable sleep mode in idle thread.

Options:

  • 0: Sleep disabled (most clock signals stopped)

  • 1: Sleep enabled (CPU enters sleep mode when idle)

QRT_CFG_IDLE_DEEP_SLEEP_ENABLE (0)

Enable deep sleep mode in idle thread. Overrides configuration option QRT_CFG_IDLE_SLEEP_ENABLE.

Options:

  • 0: Deep sleep disabled (all clock signals stopped)

  • 1: Deep sleep enabled (CPU enters deep sleep mode when idle)

QRT_CFG_ATOMIC_DISABLE_IRQ

Atomic operation method.

Options:

  • 0: Use LDREX/STREX (ARM) or Load-Reserved/Store-Conditional (RISC-V) instructions for atomic operations

  • 1: Disable interrupts for atomic operations

QRT_CFG_MPU_ENABLE (0)

Enable Memory Protection Unit support.

Options:

  • 0: MPU disabled (all memory accessible)

  • 1: MPU enabled (enforces memory access restrictions)

QRT_CFG_MPU_ENTRIES (8u)

Number of MPU regions to configure.

QRT_CFG_TZ_SECURE_WORLD (0u)

TrustZone configuration (ARMv8-M only)

Options:

  • 0: Running in Non-Secure World

  • 1: Running in Secure World

QRT_CFG_SEMAPHORE_ENABLE (1)

Enable semaphore support.

Options:

  • 0: Semaphores disabled

  • 1: Semaphores enabled

QRT_CFG_MUTEX_ENABLE (1)

Enable mutex support.

Options:

  • 0: Mutexes disabled

  • 1: Mutexes enabled

QRT_CFG_MESSAGE_QUEUE_ENABLE (1)

Enable message queue support.

Options:

  • 0: Message queues disabled

  • 1: Message queues enabled

QRT_CFG_TIMER_ENABLE (1)

Enable software timer support.

Options:

  • 0: Software timers disabled

  • 1: Software timers enabled

QRT_CFG_ERRNO_ENABLE (1)

Enable errno support.

Options:

  • 0: errno disabled

  • 1: errno enabled

QRT_CFG_DEFER_ENABLE (1u)

Enable deferred calls.

Options:

  • 0: Deferred calls disabled

  • 1: Deferred calls enabled

QRT_CFG_DEFER_LIMIT (8u)

Maximum number of deferred calls.

QRT_CFG_SYSCALL_EXT_ENABLE (0u)

Enable System Call Extension support (requires MPU)

Options:

  • 0: System Call Extensions disabled

  • 1: System Call Extensions enabled

QRT_CFG_SYSCALL_EXT_LIMIT (8u)

Maximum number of registered System Call Extensions.

QRT_CFG_KERNEL_IDLE_HOOK_REGISTER_ENABLE (1)

Per-system-call enable switches.

Each option below includes (1) or excludes (0) a single system call (or a small related group) from the build, allowing the linker to drop the associated kernel service and so reduce the kernel memory footprint. A call that is disabled but still invoked returns ENOSYS.

Options:

QRT_CFG_CLOCK_GETRES_ENABLE (1)

Enable clock_getres().

QRT_CFG_CLOCK_GETTIME_ENABLE (1)

Enable clock_gettime().

QRT_CFG_CLOCK_SETTIME_ENABLE (1)

Enable clock_settime().

QRT_CFG_CLOCK_NANOSLEEP_ENABLE (1)

Enable clock_nanosleep().

QRT_CFG_NANOSLEEP_ENABLE (1)

Enable nanosleep().

QRT_CFG_PTHREAD_CLEANUP_ENABLE (1)

Enable pthread cleanup handlers: pthread_cleanup_push()/pop().

QRT_CFG_PTHREAD_GET_SCHED_PARAM_ENABLE (1)

Enable pthread_getschedparam().

QRT_CFG_PTHREAD_SET_SCHED_PARAM_ENABLE (1)

Enable pthread_setschedparam().

QRT_CFG_PTHREAD_SET_SCHED_PRIO_ENABLE (1)

Enable pthread_setschedprio().

QRT_CFG_PTHREAD_KEY_ENABLE (1)

Enable pthread thread-specific data: pthread_key_create()/delete(), pthread_getspecific()/setspecific().

QRT_CFG_PTHREAD_ONCE_ENABLE (1)

Enable pthread_once().

QRT_CFG_PTHREAD_ATTR_GET_INHERIT_SCHED_ENABLE (1)

Enable pthread_attr_getinheritsched().

QRT_CFG_PTHREAD_ATTR_SET_INHERIT_SCHED_ENABLE (1)

Enable pthread_attr_setinheritsched().

QRT_CFG_PTHREAD_ATTR_GET_STACK_ENABLE (1)

Enable pthread_attr_getstack().

QRT_CFG_PTHREAD_ATTR_SET_STACK_ENABLE (1)

Enable pthread_attr_setstack().

QRT_CFG_PTHREAD_ATTR_GET_STACK_SIZE_ENABLE (1)

Enable pthread_attr_getstacksize().

QRT_CFG_PTHREAD_ATTR_SET_STACK_SIZE_ENABLE (1)

Enable pthread_attr_setstacksize().

QRT_CFG_PTHREAD_ATTR_GET_SCHED_POLICY_ENABLE (1)

Enable pthread_attr_getschedpolicy().

QRT_CFG_PTHREAD_ATTR_SET_SCHED_POLICY_ENABLE (1)

Enable pthread_attr_setschedpolicy().

QRT_CFG_PTHREAD_ATTR_GET_SCHED_PARAM_ENABLE (1)

Enable pthread_attr_getschedparam().

QRT_CFG_PTHREAD_ATTR_SET_SCHED_PARAM_ENABLE (1)

Enable pthread_attr_setschedparam().

QRT_CFG_PTHREAD_ATTR_GET_DETACH_STATE_ENABLE (1)

Enable pthread_attr_getdetachstate().

QRT_CFG_PTHREAD_ATTR_SET_DETACH_STATE_ENABLE (1)

Enable pthread_attr_setdetachstate().

QRT_CFG_PTHREAD_ATTR_SET_TIMESLICE_ENABLE (1)

Enable pthread_attr_settimeslice_np().

QRT_CFG_PTHREAD_ATTR_GET_TIMESLICE_ENABLE (1)

Enable pthread_attr_gettimeslice_np().

QRT_CFG_PTHREAD_ATTR_SET_PRIVILEGE_ENABLE (1)

Enable pthread_attr_setprivilege_np() (requires MPU).

QRT_CFG_PTHREAD_ATTR_GET_PRIVILEGE_ENABLE (1)

Enable pthread_attr_getprivilege_np() (requires MPU).

QRT_CFG_PTHREAD_CANCEL_ENABLE (1)

Enable pthread cancellation: pthread_cancel(), pthread_setcancelstate()/type(), pthread_testcancel().

QRT_CFG_SYSTIMER_GET_MONOTONIC_ENABLE (1)

Enable qrt_systimer_getmonotonic().

QRT_CFG_SCHED_YIELD_ENABLE (1)

Enable sched_yield().

QRT_CFG_KERNEL_HEAP_SIZE (4096u)

Kernel heap size in bytes.

QRT_CFG_FPU_ENABLE (0)

Enable Floating-Point Unit support.

Options:

  • 0: FPU disabled (no floating-point support)

  • 1: FPU enabled (floating-point operations supported)

QRT_CFG_FPU_STACK_ENABLE (0)

Enable FPU context stacking.

Options:

  • 0: Never save FPU context (single-thread FPU use only)

  • 1: Save FPU context on context switches (multi-thread FPU support)

QRT_CFG_PERF_ENABLE (0)

Enable performance (WCET) instrumentation.

When enabled, the kernel times each system call and context switch with the CPU cycle counter and records the worst case per service (see the qrt_perf module). Adds a small overhead to every system call; leave disabled in production.

Options:

  • 0: Performance instrumentation disabled

  • 1: Performance instrumentation enabled

QRT_CFG_CONSOLE_ENABLE (1)

Enable kernel console output.

When enabled, the kernel prints a boot banner and diagnostic messages via the qrt_console_puts() hook. When disabled, every console call site compiles to nothing, leaving zero footprint.

Options:

  • 0: Console output disabled

  • 1: Console output enabled