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( pcWriteBuffer1, BUFFER_SIZE);
.
.
.
// end trace
ulTaskEndTrace();
// write to terminal
for (i=1;i<=BUFFER_SIZE;i++)
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)
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");
}
in avr32studio I can see the memory of pcWriteBuffer1 ( &pcWriteBuffer1 = 0xbd4)
The data should be tick count followed by task number, so the data looks like it could be real. However, when I open a trace buffer I see the data the other way around, little endian format. Maybe the bytes are being transmit in the wrong order? When looking at pure binary data I would expect it to look more like.
Your data | Expected data
00001388 | 88130000
00000001 | 01000000
00001389 | 89130000
00000003 | 03000000
0000138D | 8D130000
00000000 | 00000000
0000138D | 8D130000
00000001 | 01000000
- does it mean I am getting the right trace data
- tick count of the RTOS program I am using is 5000 ( 5 tick/msec).
so the trace result dosen’t look right, for example task 1 is running 0x1388 = 5000 tick
which is one sec, but the task is schedualed for every msec.
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
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 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)
// 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]));
as you can see the pcWriteBuffer1[i+3] is converted to unsigned as it is the only number with FFFF
the rest are already positive
how come? should it be like that?
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. 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.