Hello, I downloaded FreeRTOS 202212.01 and used the MSP430X_MSP430FR5969_LaunchPad_IAR_CCS Demo to get things working on my MSP430FR6989 using Code Composer Studio v12. Everything seems to work except my run time stats return “u%” for some of the percent times and “u” for all the absolute times (See image below). anyone have any idea what might be going on here and can point me in the right direction. Also, this is my first time posting so forgive me if I didn’t follow the forum etiquette.
Look at the code that is printing that result. if it is using a printf variant, perhaps the format string got messed up.
Okay, after digging through the files, I found sprintf()
in the function vTaskGetRunTimeStats()
in tasks.c file. I think this is where the format is getting messed up:
if( ulStatsAsPercentage > 0UL )
{
#ifdef portLU_PRINTF_SPECIFIER_REQUIRED
{
sprintf( pcWriteBuffer, "\t%lu\t\t%lu%%\r\n", pxTaskStatusArray[ x ].ulRunTimeCounter, ulStatsAsPercentage );
}
#else
{
/* sizeof( int ) == sizeof( long ) so a smaller
* printf() library can be used. */
sprintf( pcWriteBuffer, "\t%u\t\t%u%%\r\n", ( unsigned int ) pxTaskStatusArray[ x ].ulRunTimeCounter, ( unsigned int ) ulStatsAsPercentage ); /*lint !e586 sprintf() allowed as this is compiled with many compilers and this is a utility function only - not part of the core kernel implementation. */
}
#endif
}
else
{
/* If the percentage is zero here then the task has
* consumed less than 1% of the total run time. */
#ifdef portLU_PRINTF_SPECIFIER_REQUIRED
{
sprintf( pcWriteBuffer, "\t%lu\t\t<1%%\r\n", pxTaskStatusArray[ x ].ulRunTimeCounter );
}
#else
{
/* sizeof( int ) == sizeof( long ) so a smaller
* printf() library can be used. */
sprintf( pcWriteBuffer, "\t%u\t\t<1%%\r\n", ( unsigned int ) pxTaskStatusArray[ x ].ulRunTimeCounter ); /*lint !e586 sprintf() allowed as this is compiled with many compilers and this is a utility function only - not part of the core kernel implementation. */
}
#endif
}
I removed the #define portLU_PRINTF_SPECIFIER_REQUIRED
definition in the portmacro.h file and the console output now looks like this:
Thanks for the help @richard-damon . Do you know why this fixed things? Does the compiler not understand the %lu
format specifer?
It may be your C library doesn’t understad %lu and that is causing the errors.