---
title: "RTOS and OS awareness"
---

# RTOS and OS awareness

The RTOS view for FreeRTOS, Zephyr and ThreadX, threads through the GDB server's RTOS support, and OSEK and AUTOSAR OS awareness through the OS generator's ORTI file.

The **RTOS** view in Run and Debug shows the kernel's tasks and objects each time the target halts. It reads target memory through whichever GDB server the session uses, so it works with every probe path and in the emulator. **Read the RTOS State Again** refreshes it.

## FreeRTOS, Zephyr and ThreadX

The kernel is recognised from the image's symbols. The view shows:

- a summary line, such as "FreeRTOS: 6 tasks, tick 90203", or that the scheduler has not started yet;
- **Tasks** (or **Threads**): name, state (running, ready, blocked, suspended and the kernel's other states), priority (with a priority inherited from a mutex marked, and the task's own priority named), stack used as a share of its size, what it is waiting on, and run time where the kernel records it;
- **Queues, Semaphores, Mutexes and Event Flags**: kind, messages, tasks waiting to receive or send, and the holder of a mutex.

For FreeRTOS, queues and semaphores appear when they are registered with `vQueueAddToRegistry()` and `configQUEUE_REGISTRY_SIZE` is above 0.

![The RTOS view with FreeRTOS tasks, their stack use, and the queues and mutexes with their holders.](https://neuralinverse.com/docs-images/modules/embedded/rtos-freertos.webp)

State: FreeRTOS unit-tested over fake target memory, and its QEMU integration test is written; Zephyr and ThreadX tested with fakes only. No kernel has been read on a real target.

## Threads through the GDB server

The GDB servers have RTOS support of their own, which shows tasks as GDB threads in the Call Stack:

- **OpenOCD**: `neuralInverse.embedded.debug.rtos` (default `auto`) or the launch configuration's `rtos` turns on OpenOCD's RTOS awareness. FreeRTOS needs the `uxTopUsedPriority` symbol in the image.
- **J-Link**: SEGGER's RTOS plug-ins (FreeRTOS, embOS, ThreadX, Zephyr) show threads, including embOS threads.

State: command lines unit-tested; not run with a probe.

## OSEK and AUTOSAR OS through ORTI

Halted in the lab, see the AUTOSAR OS tasks with state and priority, the running task and ISR, resources with their locker, alarms, counters and stack use, as TRACE32's ORTI windows show them. The OS generator writes an ORTI file describing where the OS keeps these objects; the RTOS view reads it.

1. Set `neuralInverse.embedded.ortiFile` (or `ortiFile` in the launch configuration). Leave it empty to use the `.orti` or `.ort` file next to the image.
2. Start a debug session and halt the target.
3. The view shows the OS attributes the file declares, such as the running task and ISR, then the tasks with state and priority, resources with the task that holds them, alarms, counters, and stacks with their use where the file gives a fill pattern.

![The RTOS view reading an OSEK OS through its ORTI file: OS attributes, tasks, alarms, a locked resource and the system counter.](https://neuralinverse.com/docs-images/modules/embedded/rtos-orti-osek.webp)

![The ORTI file setting in Settings; when empty, the ORTI file next to the image is used.](https://neuralinverse.com/docs-images/modules/embedded/orti-file-setting.webp)

The reader understands ORTI 2.x declarations: `CTYPE`, `ENUM` (with its value names), `STRING`, `TOTRACE` and per-core arrays. An ORTI expression that would assign or call a function is never sent to the target.

State: verified on Linux with Trampoline's OSEK OS (an open stand-in for a vendor AUTOSAR OS) and its generated ORTI file, in QEMU 8.2.2 (`netduinoplus2`) with gdb-multiarch 15.1: tasks, alarms, a resource and a counter. ORTI files of ERIKA2, ERIKA3, Arctic Core and an iSoft AUTOSAR OS were parsed. Stack use from a fill pattern is tested in unit tests only. Kit shipped (orti). **Not yet run against TRACE32, J-Link, ST-LINK or OpenOCD on a board**; the MICROSAR OS, RTA-OS and tresos AutoCore OS dialects are untested (no public file).

Agents can list ORTI objects and read the OS state (**List ORTI Objects**, **Read OS State**), read-only.

## Task stacks elsewhere

The Heap and Stack view lists each task's stack as the RTOS view reads it, and Benchmark Counters can total counts per task from the RTOS view, ORTI included. See [Timing, profiling, heap and stack](https://neuralinverse.com/docs/modules/embedded/timing/).
