explorer16 wrote on Friday, March 16, 2012:
PIC24
MPLAB X 1.10 Mac
C30 Compiler
Following example 18 for PIC32 and making minor changes for PIC24, I am getting compiler errors. I have the addition to FreeRTOSConfig.h as:
/* The following should not be included in asm files. */
#ifdef __LANGUAGE_C__
/* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() is defined to call the
function that sets up timer 2 (T2) as the time base for the run time
statistics. T2 is a 16-bit timer and generates an interrupt when it
overflows.
portALT_GET_RUN_TIME_COUNTER_VALUE() is defined to set its parameter to
the current run time stats counter/time value. The returned timer value
is 32-bits long, and is formed by shifting the T2 overflow count into the
top two bytes of a 32-bit number, then bitwise ORing the result with the
current T2 count value. */
void vSetupTimerForRunTimeStats( void );
unsigned long ulGetRunTimeStatsCounterValue( void );
extern unsigned long ulCountValue;
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vSetupTimerForRunTimeStats()
/* T2 is 16-bits and generate an interrupt when it overflows. The
number of overflows is stored in ulTMR2OverflowCount. This macro
combines the current 16-bit counter value with the number of overflows
to return a 32-bit timer value. */
#define portALT_GET_RUN_TIME_COUNTER_VALUE( ulCountValue ) \
{ \
extern volatile unsigned long ulTMR2OverflowCount; \
unsigned long ulCountValue; \
\
/* Disconnect the clock from the counter so it does not change \
while its value is being used. */ \
T2CON_VALUE = T2_OFF; \
\
/* The number of overflows is shifted into the most significant \
two bytes of the returned 32-bit value. */ \
ulCountValue = ( ulTMR2OverflowCount << 16UL ); \
\
/* The current T2 counter value is used as the least \
significant two bytes of the returned 32-bit value. */ \
ulCountValue |= ( unsigned long ) ReadTimer2(); \
\
/* Reconnect the clock to the counter. */ \
T2CON_VALUE = T2_ON; \
}
#endif /* __LANGUAGE_C__ */
Note: T2CON_VALUE is being set to match comments and turn timer off at start. This define and value was all that was changed for PIC24
My error is reported in task.c as:
…/…/…/Source/tasks.c: In function ‘vTaskGetRunTimeStats’:
…/…/…/Source/tasks.c:1340: error: invalid lvalue in assignment
…/…/…/Source/tasks.c:1340: error: invalid lvalue in assignment
…/…/…/Source/tasks.c: In function ‘vTaskSwitchContext’:
…/…/…/Source/tasks.c:1598: error: invalid lvalue in assignment
…/…/…/Source/tasks.c:1598: error: invalid lvalue in assignment
It appears that the defined function does not appear to return an unsigned long to the caller(??).
ulCountValue was not previously defined so I have defined it globally for debugging purposes (prior to main())
Thoughts?