FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [October 2011 Threads] PIC32configGENERATE_RUN_TIME_STATS ignorance Posted by Robert H. Oujesky on October 25, 2011 Trying to implement runtime statistics and very ignorant and low blood sugar :( Here is where I am. First, I modified FreeRTOS.h with the following:
#if ( configGENERATE_RUN_TIME_STATS == 1 ) #defineportALT_GET_RUN_TIME_COUNTER_VALUE 1 //NOT in ebook, but added here... is this right??? /* Neuralog specific */ void vSetupTimerForRunTimeStats(void);
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vSetupTimerForRunTimeStats()
#define portGET_RUN_TIME_COUNTER_VALUE(ulCountValue)\ {\ extern volatile unsighed long ulTMR2OverflowCount;\ T2CONCLR = T2_ON;\ ulCountValue = (ulTMR2OverflowCount << 16UL);\ ulCountValue |= (unsigned long) ReadTimer2();\ T2CONSET = T2_ON;\ }
/******************/ #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS #error If configGENERATE_RUN_TIME_STATS is defined then portCONFIGURE_TIMER_FOR_RUN_TIME_STATS must also be defined. portCONFIGURE_TIMER_FOR_RUN_TIME_STATS should call a port layer function to setup a peripheral timer/counter that can then be used as the run time counter time base. #endif /* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS */
#ifndef portGET_RUN_TIME_COUNTER_VALUE #ifndef portALT_GET_RUN_TIME_COUNTER_VALUE #error If configGENERATE_RUN_TIME_STATS is defined then either portGET_RUN_TIME_COUNTER_VALUE or portALT_GET_RUN_TIME_COUNTER_VALUE must also be defined. See the examples provided and the FreeRTOS web site for more information. #endif /* portALT_GET_RUN_TIME_COUNTER_VALUE */ #endif /* portGET_RUN_TIME_COUNTER_VALUE */
#endif /* configGENERATE_RUN_TIME_STATS */
when I do this, I get the error:
..\..\Source\tasks.c: In function `vTaskGetRunTimeStats': ..\..\Source\tasks.c:1293: error: called object is not a function ..\..\Source\tasks.c: In function `vTaskSwitchContext': ..\..\Source\tasks.c:1610: error: called object is not a function
I have the PIC32 version of Using the FreeRTOS....
Please point out my idiocracy :)
thanks!
RE: PIC32configGENERATE_RUN_TIME_STATS ignorance Posted by Richard on October 25, 2011 “//NOT in ebook, but added here... is this right???” No - you should not be altering FreeRTOS.h at all. That is part of the core kernel code. The macros you need can be added to FreeRTOSConfig.h, which is a file used to tailor the kernel to any particular application. If you have the PIC32 eBook, then look at section "6.5 Execution Visualization—Run Time Statistics", it describes it, and provides source code for the PIC32. I presume you have seen this page too? The other thing you can do is look in the FreeRTOS/Demo directory for demos that use run time stats on non-PIC32 devices, just to use as references (you can search/grep for the macro names in the various FreeRTOSConfig.h files). Regards.
RE: PIC32configGENERATE_RUN_TIME_STATS ignorance Posted by Erupter on October 25, 2011 In my FreeRTOS.h I put this #if( configGENERATE_RUN_TIME_STATS ) #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() OpenCoreTimer(800); mConfigIntCoreTimer((CT_INT_ON | CT_INT_PRIOR_2 | CT_INT_SUB_PRIOR_0));
//#define portGET_RUN_TIME_COUNTER_VALUE()_CP0_GET_COUNT() #define portGET_RUN_TIME_COUNTER_VALUE()getStatsTimerCount()
#endif then in main.c (before any code) I put this #if( configGENERATE_RUN_TIME_STATS )
unsigned long long StatsTimerCount = 0;
unsigned long long getStatsTimerCount( void ) { return( StatsTimerCount ); }
void __ISR(_CORE_TIMER_VECTOR, ipl2) CoreTimerHandler(void) { // .. things to do
// .. Toggle the LED StatsTimerCount+=1; // update the period UpdateCoreTimer(800);
// clear the interrupt flag mCTClearIntFlag(); }
#endif
then there is the StatTask definition static void prvStatsTask( void *pvParameters ) { int mycnt=0; for(;;) { for( mycnt=0; mycnt<1000; mycnt++) mybuff[mycnt]=0; #if( configGENERATE_RUN_TIME_STATS ) vTaskGetRunTimeStats(mybuff); mycnt=999; while(mybuff[mycnt]==0) mycnt--; if( !(USBUSARTIsTxTrfReady())) while(!(USBUSARTIsTxTrfReady())) vTaskDelay(50);
putUSBUSART(mybuff,mycnt); #endif Task_1_Enable = 0; vTaskSuspend( hTask1 ); } }[/code[
this task is suspended right after creation. I have used a button to trigger the task execution. It's designed to execute on request and auto-suspend after completition. This has worked quite nicely for me. The pic runs at 80MHz, the scheduler runs at 1ms.
I think it's all you need to have the stats. I output them on the USB CDC, that's why the scheduler runs at 1ms: it fires the USB poller at that rate.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|