# using vTaskStartTrace with terminal

**URL:** <https://forums.freertos.org/t/using-vtaskstarttrace-with-terminal/5643>\
**Category:** Kernel\
**Created:** [September 24, 2007, 10:36am UTC](https://forums.freertos.org/t/using-vtaskstarttrace-with-terminal/5643 "2007-09-24T10:36:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 24, 2007, 10:36am UTC](https://forums.freertos.org/t/using-vtaskstarttrace-with-terminal/5643/1 "2007-09-24T10:36:02Z")

</div>

**[natanel](https://sourceforge.net/u/natanel/)** wrote on [Monday, September 24, 2007](https://sourceforge.net/p/freertos/discussion/382005/thread/fbd9e688/#9c3d):

I would like to use vTaskStartTrace in such a way  
that in the end the result would be sent out to a terminal using uart\_0 and saving it as a file

using the tracecon.exe to convert this file

something like this  
//-----------------------------------------------------------  
// Variable for debug  
#define BUFFER\_SIZE ( ( unsigned portSHORT ) 512 )  
static signed portCHAR pcWriteBuffer1[BUFFER\_SIZE]={0};

// some were in the code  
vTaskStartTrace(&nbsp; pcWriteBuffer1, BUFFER\_SIZE);&nbsp;&nbsp;&nbsp;  
.  
.  
.  
// end trace  
ulTaskEndTrace();

// write to terminal&nbsp;&nbsp;&nbsp;  
for (i=1;i\<=BUFFER\_SIZE;i++)  
&nbsp;&nbsp;&nbsp;&nbsp; print\_dbg\_char( pcWriteBuffer1[i]);  
//-----------------------------------------------------------

then pointing the terminal to transfer it to file and using tracecon over this file

using HyperTerminal and trying any print\_dbg function (print\_dbg\_char, print\_dbg\_ulong, print\_dbg\_hex)  
the tracecon.exe didn’t work for me (got zero size file)

any suggestions

regards

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 24, 2007, 12:56pm UTC](https://forums.freertos.org/t/using-vtaskstarttrace-with-terminal/5643/2 "2007-09-24T12:56:21Z")

</div>

**[natanel](https://sourceforge.net/u/natanel/)** wrote on [Monday, September 24, 2007](https://sourceforge.net/p/freertos/discussion/382005/thread/fbd9e688/#9c3d/cd74):

I have been tring some more staff

using it like that know

for (i=0;i\<BUFFER\_SIZE;i=i+4)  
{  
//print\_dbg("0x");

// create number as seen in memory window of avr32studio  
print\_dbg\_hex( (pcWriteBuffer1[i]\<\<(6\*4))+(pcWriteBuffer1[i+1]\<\<(4\*4))+(pcWriteBuffer1[i+2]\<\<(2\*4))+  
( (unsigned portCHAR) pcWriteBuffer1[i+3]));

print\_dbg("\r\n");

}  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
in avr32studio I can see the memory of pcWriteBuffer1 ( &pcWriteBuffer1 = 0xbd4)

0x00000bd4 : 0xBD4 \<Hex\>  
&nbsp; Address&nbsp;&nbsp; 0 - 3&nbsp;&nbsp;&nbsp;&nbsp; 4 - 7&nbsp;&nbsp;&nbsp;&nbsp; 8 - B&nbsp;&nbsp;&nbsp;&nbsp; C - F&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp; 00000BC0&nbsp; 00000000&nbsp; 00000000&nbsp; 00000000&nbsp; 00000000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp; 00000BD0&nbsp; 00000081&nbsp; 00001388&nbsp; 00000001&nbsp; 00001389&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp; 00000BE0&nbsp; 00000003&nbsp; 0000138D&nbsp; 00000000&nbsp; 0000138D&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp; 00000BF0&nbsp; 00000001&nbsp; 0000138D&nbsp; 00000003&nbsp; 00001392&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp; 00000C00&nbsp; 00000000&nbsp; 00001392&nbsp; 00000001&nbsp; 00001392&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp; 00000C10&nbsp; 00000003&nbsp; 00001397&nbsp; 00000000&nbsp; 00001397&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp; 00000C20&nbsp; 00000001&nbsp; 00001397&nbsp; 00000003&nbsp; 0000139C&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp; 00000C30&nbsp; 00000000&nbsp; 0000139C&nbsp; 00000001&nbsp; 0000139C&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp; 00000C40&nbsp; 00000003&nbsp; 000013A1&nbsp; 00000000&nbsp; 000013A1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp; 00000C50&nbsp; 00000001&nbsp; 000013A1&nbsp; 00000003&nbsp; 000013A6&nbsp;&nbsp;

which is indenticl to the file from the terminal named Trace.hex (but is writen as txt)&nbsp;

00001388  
00000001  
00001389  
00000003  
0000138D  
00000000  
0000138D  
00000001  
0000138D  
00000003  
00001392  
00000000  
00001392  
00000001  
00001392  
00000003  
00001397  
00000000  
00001397  
00000001  
00001397  
00000003  
0000139C  
00000000  
0000139C  
00000001  
0000139C  
00000003  
000013A1  
00000000  
000013A1  
00000001  
000013A1  
00000003  
000013A6&nbsp;&nbsp;

then using hex2bin over this text file (named Trace.hex) giving back zero size file (Trace.bin)

this made me think that hex2bin is not reading txt files with hex numbers but something else

can some one help?  
&nbsp;

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [September 24, 2007, 7:43pm UTC](https://forums.freertos.org/t/using-vtaskstarttrace-with-terminal/5643/3 "2007-09-24T19:43:35Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Monday, September 24, 2007](https://sourceforge.net/p/freertos/discussion/382005/thread/fbd9e688/#9c3d/3478):

The data should be tick count followed by task number, so the data looks like it could be real.&nbsp; However, when I open a trace buffer I see the data the other way around, little endian format.&nbsp; Maybe the bytes are being transmit in the wrong order?&nbsp; When looking at pure binary data I would expect it to look more like.

Your data | Expected data  
00001388&nbsp; | 88130000  
00000001&nbsp; | 01000000  
00001389&nbsp; | 89130000  
00000003&nbsp; | 03000000  
0000138D&nbsp; | 8D130000  
00000000&nbsp; | 00000000  
0000138D&nbsp; | 8D130000  
00000001&nbsp; | 01000000

Etc.

Regards.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 24, 2007, 9:52pm UTC](https://forums.freertos.org/t/using-vtaskstarttrace-with-terminal/5643/4 "2007-09-24T21:52:29Z")

</div>

**[natanel](https://sourceforge.net/u/natanel/)** wrote on [Monday, September 24, 2007](https://sourceforge.net/p/freertos/discussion/382005/thread/fbd9e688/#9c3d/68df):

sorry  
I didn’t understand your response

- does it mean I am getting the right trace data  
- tick count of the RTOS program I am using is 5000 ( 5 tick/msec).  
&nbsp; so the trace result dosen’t look right, for example task 1 is running 0x1388 = 5000 tick  
&nbsp; which is one sec, but the task is schedualed for every msec.  
&nbsp; in my case I also have a counter in the task which show me that this task is runnig each msec then each sec.  
- still I don’t know way the hex2bin give me back 0 size file

is some one used vTaskStartTrace with terminal?

Regards

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 26, 2007, 7:47am UTC](https://forums.freertos.org/t/using-vtaskstarttrace-with-terminal/5643/5 "2007-09-26T07:47:32Z")

</div>

**[natanel](https://sourceforge.net/u/natanel/)** wrote on [Wednesday, September 26, 2007](https://sourceforge.net/p/freertos/discussion/382005/thread/fbd9e688/#9c3d/87b4):

let me see if I got it right (as it not writeen anywere)

0x00001388 = 5000  
00000001  
0x 00001389 = 5001  
00000003  
0x 0000138D = 5005  
00000000  
0x 0000138D = 5005  
00000001  
0x 0000138D = 5005  
00000003  
0x 00001392 = 5100  
00000000

task 1 started at tick 5000 until tick 5001  
task 3 started at tick 5001 until tick 5005  
task 0 started at tick 5005 until tick 5005  
task 1 started at tick 5005 until tick 5005  
task 1 started at tick 5005 until tick 5010  
task 0 started at tick 5010 until tick …

tell me if I got it right  
for my program it is 5000 tick per second

1) the tick are absolute tick count and not delta tick count.  
2) if so how come task (1,0) took zero tick to run (5005 to 5005), shouldn’t it be at least one tick.  
3) if those are the numbers field in the pcWriteBuffer1 way one need the hex2bin.exe and tracecon.exe to get the&nbsp;&nbsp; data.  
4) can it be I got wrong pcWriteBuffer1  
5) I changed the portCHAR pcWriteBuffer1 to the right hex numbers using this code (shifting places)

&nbsp;&nbsp; // create number as seen in memory window of avr32studio  
&nbsp;&nbsp; print\_dbg\_hex( (pcWriteBuffer1[i]\<\<(6\*4))+(pcWriteBuffer1[i+1]\<\<(4\*4))+(pcWriteBuffer1[i+2]\<\<(2\*4))+  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ( (unsigned portCHAR) pcWriteBuffer1[i+3]));

&nbsp;&nbsp; as you can see the pcWriteBuffer1[i+3] is converted to unsigned as it is the only number with FFFF  
&nbsp;&nbsp; the rest are already positive  
&nbsp;&nbsp; how come? should it be like that?

regards

&nbsp;&nbsp;

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 26, 2007, 1:44pm UTC](https://forums.freertos.org/t/using-vtaskstarttrace-with-terminal/5643/6 "2007-09-26T13:44:56Z")

</div>

**[jorick23](https://sourceforge.net/u/jorick23/)** wrote on [Wednesday, September 26, 2007](https://sourceforge.net/p/freertos/discussion/382005/thread/fbd9e688/#9c3d/87b4/ab37):

2) if so how come task (1,0) took zero tick to run (5005 to 5005), shouldn’t it be at least one tick.

If a running task blocks on a semaphore or queue, it can run for less than a tick before another task executes.

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [September 26, 2007, 2:14pm UTC](https://forums.freertos.org/t/using-vtaskstarttrace-with-terminal/5643/7 "2007-09-26T14:14:08Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Wednesday, September 26, 2007](https://sourceforge.net/p/freertos/discussion/382005/thread/fbd9e688/#9c3d/87b4/ab37/0655):

The timing used by default is the tick count, so any context switches that occur with a higher frequency than that do not have accurate timing information - although the order of execution shown is correct.&nbsp; When I use the utility I change the behaviour to use a high resolution free running timer, but the timer used depends on the processor on which it is running so this is not portable and cannot therefore be the default behaviour.

Regards.
