Tracing FreeRTOS in Code composer studio

miraekim wrote on Monday, June 12, 2017:

I would like to see the operation of FreeRTOS in code composer studio
I was going to use tracealyzer but it did not work.
Because I am using MSP430 board but MSP430 board does not support J-link debugger.
Board has to support J-link debugger to use tracealyzer.

So I wonder if there any way to trace FreeRTOS?
I would like to see RTOS running with timestamp.
for example,

Task execution time
Task execution sequence
State of the task at a time

Is there any function that I can trace these features?

rtel wrote on Thursday, June 15, 2017:

Sorry for the delay in replying -

Tracalyzer does not require J-link. Maybe streaming trace data does (not sure), but the snapshot recorder definitely doesn’t. With the snapshot recorder you can trace data into a circular buffer, then use whatever features the IDE provides (differs from Eclipse version to Eclipse version - CCS being an Eclipse based IDE) to copy the buffer from the device to the computer that is running the Tracealyzer tool for viewing. This is how ALL the examples in the FreeRTOS download work - none of them rely on J-Link, and I’m sure it will be described in the documentation that comes with Tracealyzer. You can also contact Percepio support.

miraekim wrote on Thursday, June 15, 2017:

Oh… ok I will check about this issue again.

I also had another question about tracing FreeRTOS.

Is there any method that I can trace these features below?

Task execution time / function execution time
Task execution sequence
State of the task at a time <- this feature maybe I could see with vTaskList (?)

Best regards,
Mirae

xz8987f wrote on Thursday, June 15, 2017:

Hi Mirae,
With the Percepio Tracealizer, all what you need is a debug connection and the ability to read from the target memory. There is even an Eclipse plugin (see https://mcuoneclipse.com/2017/03/08/percepio-freertos-tracealyzer-plugin-for-eclipse/) which you can use to read from the target. All what it requries is a GDB connection. Beside of that, you can stream trace data to Segger RTT (yes, that requires a Segger probe), or you can stream it to UART/USB or store things say on a SD card.
Another way I have used is to set a breakpoint in the trace overflow (buffer full) hook and then dump the data with a debugger command to a file. See https://mcuoneclipse.com/2015/01/05/updated-percepio-tracealyzer-and-trace-library-to-version-v2-7-0/.
There is just one thing: to have the Tracealyzer working with the MSP430, you need a port for that. I did it for other (non-ARM) devices and it is not that hard (see the Percepio documenation), or ask Percepio if they have already a port for the MSP430, or see https://percepio.com/docs/FreeRTOS/manual/Recorder.html and https://percepio.com/docs/FreeRTOS/manual/Recorder.html#hardwareports

The other thing I’m using is the vTaskList() and variants. This gets me a list of all tasks, e.g.

TCB Static Handle     Name         State    Prio    Stack Beg  Stack End  Size    Stack Top            Unused  Runtime          
2   no (0) 0x200022A0 Shell        Running  (1,1)   0x20002290 0x20001A00  2200 B 0x20002064 (  560 B)  1648 B 0x00000884 ( <1%)
4   no (0) 0x20003900 IDLE         Ready    (0,0)   0x200038F0 0x200032B8  1600 B 0x20003894 (   96 B)  1512 B 0x00039C06 ( 99%)
3   no (0) 0x20003120 Main         Ready    (0,0)   0x20003110 0x20002308  3600 B 0x2000309C (  120 B)  3472 B 0x00000000 ( <1%)
5   no (0) 0x20003FB0 Tmr Svc      Blocked  (2,2)   0x20003FA0 0x20003968  1600 B 0x20003F24 (  128 B)  1424 B 0x00000000 ( <1%)
1   no (0) 0x20001998 MidiPlay     Suspended(1,1)   0x20001988 0x20001350  1600 B 0x20001904 (  136 B)  1472 B 0x00000000 ( <1%)

The above is produced by a command line interface I have implemented for FreeRTOS, and you can find the implemenation in PrintTaskList() inside https://github.com/ErichStyger/McuOnEclipseLibrary/blob/master/lib/src/McuRTOS.c

Other than that, there is an Eclipse plugin (see https://mcuoneclipse.com/2017/03/18/better-freertos-debugging-in-eclipse/), but I’m not sure if that one will work in your CCS.

I hope this helps,
Erich

rtel wrote on Thursday, June 15, 2017:

See also
http://www.freertos.org/rtos-run-time-stats.html
http://www.freertos.org/uxTaskGetSystemState.html