When debugging with RTOS, CLion provides views for FreeRTOS, Azure RTOS, and Zephyr tasks (threads). For FreeRTOS, you can also explore objects and the heap.
Some gdb servers have built-in support for different RTOS. To ensure proper integration with CLion, make sure to disable built-in support on the gdb server side.
To enable the RTOS thread view, go to Settings | Build, Execution, Deployment | Embedded Development | RTOS Integration.
Check the Enable RTOS Integration checkbox and select from the list:
Please note that RTOS integration requires GDB version 7.4 or higher and supports Python.
RTOS integration is designed for any relevant run/debug configurations, such as embedded GDB servers or OpenOCD download & run.
For example, here's how to set up an embedded GDB server configuration using the QEMU emulator:
When debugging configurations like the one above, you will see the FreeRTOS / Azure RTOS / Zephyr task list in the Threads and Variables pane of the debugging tool window.
For each task, variables will be presented in the Variables pane.
The RTOS task view also supports Symmetric Multi-Processing (SMP). The processor cores must be the same and share the same memory.
If you are using Zephyr, make sure to set CONFIG_THREAD_MONITOR and CONFIG_THREAD_NAME in the project configuration file; otherwise, the debugger will not be able to extract the necessary information. If definitions are missing, CLion will notify you:
To explore FreeRTOS objects, switch to the FreeRTOS Objects tab. The task table displays the task list along with their status information; the queue table shows currently active queues, semaphores, and mutexes; the timer table lists software timers:
To make this tab work correctly, configure the following definitions in FreeRTOSConfig.h:
-
Set configUSE_TRACE_FACILITY to 1 to display task numbers and queue types.
-
Set configMAX_TASK_NAME_LEN to a value greater than zero to display task names correctly.
-
Set configRECORD_STACK_HIGH_ADDRESS to 1 to display task stack information.
-
Set configUSE_TRACE_FACILITY and configGENERATE_RUN_TIME_STATS to 1 to collect runtime information (runtime column of the task table).
-
Use configQUEUE_REGISTRY_SIZE greater than zero and use vQueueAddToRegistry() to assign names for queues, semaphores, or mutexes. This is useful since queues do not have names by default, while tasks are given names upon creation.
If certain definitions are missing, CLion will display a warning:
FreeRTOS Heap View
The FreeRTOS heap tab displays the current heap usage and memory block allocations for all default FreeRTOS memory management schemes.
To properly support heap_5, ensure the xHeapRegions variable is defined globally, for example:
HeapRegion_t xHeapRegions[] = {{ &heap_sram_lower1[0], sizeof(heap_sram_lower1)},{ &heap_sram_lower2[0], sizeof(heap_sram_lower2)},{NULL, 0}};int main( void ) {...}
Popular Recommendations
-
Undignified, yet lucrative jobs…
-
The candidates from big companies are indeed a bit strong, but I still rejected him~
-
Essential skills for those wanting to work in state-owned enterprises…