How to trace FreeRTOS based applications?

Tracing allows recording the software behavior during runtime for later analysis of collected trace data. Tracing is especially important for systems integrating an operating system (OS), like FreeRTOS for embedded systems. FreeRTOS feature is multi-threading – the ability to run multiple programs (threads) on a single processor core by rapidly switching among execution contexts. Multi-threading, however, makes software behavior more complex, and gives the developer less control over run-time behavior as execution is preempted by the scheduler.