Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

vTaskStartTrace buffer size

Posted by natanel on January 18, 2008
Hi
first sorryfor posting it in another thread, this question should be new thread


I am using vTaskStartTrace to trace tasks switch.
and sending the data through the usb port which then is read and plot in matlab.

code:
#if ( configUSE_TRACE_FACILITY == 1 ) //debug
if((sxUSBMessage.sValue1 & TASKS_TRACE_DEBUG)==TASKS_TRACE_DEBUG)
{
void * pvBuffer;
unsigned portLONG ulBufLength;

// write task list
vTaskList( ( (signed portCHAR *)(&(scDebugBuff[0])) ) );

// length of written data
ulBufLength=ulGetBufferLength(); //just return trace buf length in byte with out stoping trace

// place of putting length of data
pvBuffer=((void *)(&(scDebugBuff[DEBUG_BUF_LENGTH-sizeof( unsigned portLONG )])));
// putting length of data
*( unsigned portLONG * ) pvBuffer = ( unsigned portLONG ) ulBufLength;

// start new trace
ulTaskEndTrace();
pvBuffer=((void *)(&(scDebugBuff[DELTA_TASK_LIST])));
vTaskStartTrace( ((signed portCHAR *)(pvBuffer)),DEBUG_BUF_LENGTH-DELTA_TASK_LIST-sizeof( unsigned portLONG ));

// send trough USB
Usb_write_endpoint_in( (unsigned char *)scDebugBuff, DEBUG_BUF_LENGTH, DEBUG_BUF_LENGTH, ONE_SEC_TIMERATE>>2);
}
break;
#endif

from matlab size it look like that
dummy request for debug
pause 200 msec
request for debug
pause 200 msec
request for debug
pause 200 msec
request for debug
pause 200 msec
request for debug
pause 200 msec
request for debug

getting 1 around sec of tasks switch trace

then looking on the data at matlab it is two 32 bit size numbers one tick time/number and second tasks num
which is a waste of space (for up to 6 tasks switch in one msec and tracing for up to 500 msec it is 8*6*500=24000 byte in mcu RAM)
task num can be 8 bit size (up to 255 tasks)
(and time can be one 32 bit start time and then 16 bit delta times)

I tried to modify it by changing the define

/*
* Macro that writes a trace of scheduler activity to a buffer. This trace
* shows which task is running when and is very useful as a debugging tool.
* As this macro is called each context switch it is a good idea to undefine
* it if not using the facility.
*/
#if ( configUSE_TRACE_FACILITY == 1 )
#define vWriteTraceToBuffer()\
{\
if( xTracing )\
{\
static unsigned portBASE_TYPE uxPreviousTask = 255;\\
if( uxPreviousTask != pxCurrentTCB->uxTCBNumber )\
{\
if( ( pcTraceBuffer + tskSIZE_OF_EACH_TRACE_LINE ) < pcTraceBufferEnd ) \
{\
uxPreviousTask = pxCurrentTCB->uxTCBNumber;\
*( unsigned portLONG * ) pcTraceBuffer = ( unsigned portLONG ) xTickCount;\
pcTraceBuffer += sizeof( unsigned portCHAR ); /* was portLONG */ \
*( unsigned portCHAR * ) pcTraceBuffer = ( unsigned portCHAR )uxPreviousTask;/* was portLONG */ \
pcTraceBuffer += sizeof( unsigned portLONG );\
}\
else \
{ \
xTracing = pdFALSE; \
}\
}\
}\
}

#else

#define vWriteTraceToBuffer()

#endif

in task.c

but this just freeze my MCU (evk110 board-atmel 32bit U3A)

any ideas were and how to do it right

regards
Natanel

RE: vTaskStartTrace buffer size

Posted by natanel on January 18, 2008
some how I keep see my question post as comment to another thread - sorry for the mess

RE: vTaskStartTrace buffer size

Posted by natanel on January 18, 2008
copy past mistake
pcTraceBuffer += sizeof( unsigned portLONG ); \
is
pcTraceBuffer += sizeof( unsigned portCHAR ); \

RE: vTaskStartTrace buffer size

Posted by sotd on January 18, 2008
Do you mean this fixes your problem or simple that this was just a mistake in your post and you still have a problem?

RE: vTaskStartTrace buffer size

Posted by natanel on January 18, 2008
mistake in my post still have a problem


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS