FreeRTOS 10.0.0 Problem: vTaskList is truncating information about the calling task

I am using vTaskList to minitor reaming stat for each task. Under version 9.0.0 all of the tasks information is being returned, but under 10,0.0 the calling task information is being truncated and the is combuned with the next task in the list. Version 9.0.0 ~~~ Name Status Pri Free No. —- —— — —- — Diag R 2 403 3 IDLE R 0 108 10 Tmr Svc B 4 191 11 Led B 2 36 2 MB/TCPAcpt B 2 218 7 TCP/IP Stack B 2 596 1 RS4852 S 2 474 6 CC S 2 463 8 Qsec S 2 191 9 RS4850 S 2 474 4 RS4851 S 2 474 5 ~~~ Version 10.0.0 ~~~ Name Status Pri Free No. —- —— — —- — Diag IDLE R 0 108 10 Tmr Svc B 4 191 11 Led B 2 36 2 MB/TCPAcpt B 2 218 7 TCP/IP Stack B 2 596 1 RS4852 S 2 474 6 CC S 2 463 8 Qsec S 2 191 9 RS4850 S 2 474 4 RS4851 S 2 474 5 ~~~ After I investigated the problem I discovered that version 9.0.0 returns a “eReady” value for the tasks “eCurrentState” where version 10.0.0 returnes a “eRunning” value. The switch statement in vTaskList does not have a case statement for “eRunning” and thus falls into the default case and “cStatus” gets set to a null character ‘’. ~~~ /* Generate the (binary) data. */ uxArraySize = uxTaskGetSystemState( pxTaskStatusArray, uxArraySize, NULL );
        /* Create a human readable table from the binary data. */
        for( x = 0; x < uxArraySize; x++ )
        {
            switch( pxTaskStatusArray[ x ].eCurrentState )
            {
                case eRunning:      cStatus = tskRUNNING_CHAR;
                                                        break;

                case eReady:        cStatus = tskREADY_CHAR;
                                                        break;

                case eBlocked:      cStatus = tskBLOCKED_CHAR;
                                                        break;

                case eSuspended:    cStatus = tskSUSPENDED_CHAR;
                                                        break;

                case eDeleted:      cStatus = tskDELETED_CHAR;
                                                        break;

                default:            /* Should not get here, but it is included
                                                        to prevent static checking errors. */
                                                        cStatus = 0x00;
                                                        break;
            }

            /* Write the task name to the string, padding with spaces so it
            can be printed in tabular form more easily. */
            pcWriteBuffer = prvWriteNameToBuffer( pcWriteBuffer, pxTaskStatusArray[ x ].pcTaskName );

            /* Write the rest of the string. */
            sprintf( pcWriteBuffer, "t%ct%ut%ut%urn", cStatus, ( unsigned int ) pxTaskStatusArray[ x ].uxCurrentPriority, ( unsigned int ) pxTaskStatusArray[ x ].usStackHighWaterMark, ( unsigned int ) pxTaskStatusArray[ x ].xTaskNumber );
            pcWriteBuffer += strlen( pcWriteBuffer );
        }
~~~ The sprintf statement puts a null terminator after the name of the first tasks and looses the remainder of the data. I modified the code to fix the problem. I needed a way to show that the task is running so I used ‘E’ to indicating that it is “Executing” The following are snippets of my changes to the file: tasks.c”: ~~~

define tskRUNNING_CHAR ( ‘E’ )

define tskBLOCKED_CHAR ( ‘B’ )

define tskREADY_CHAR ( ‘R’ )

define tskDELETED_CHAR ( ‘D’ )

define tskSUSPENDED_CHAR ( ‘S’ )

~~~ ~~~ /* Generate the (binary) data. */ uxArraySize = uxTaskGetSystemState( pxTaskStatusArray, uxArraySize, NULL );
        /* Create a human readable table from the binary data. */
        for( x = 0; x < uxArraySize; x++ )
        {
            switch( pxTaskStatusArray[ x ].eCurrentState )
            {
                case eRunning:      cStatus = tskRUNNING_CHAR;
                                                        break;

                case eReady:        cStatus = tskREADY_CHAR;
                                                        break;

                case eBlocked:      cStatus = tskBLOCKED_CHAR;
                                                        break;

                case eSuspended:    cStatus = tskSUSPENDED_CHAR;
                                                        break;

                case eDeleted:      cStatus = tskDELETED_CHAR;
                                                        break;

                default:            /* Should not get here, but it is included
                                                        to prevent static checking errors. */
                                                        cStatus = 0x00;
                                                        break;
            }

            /* Write the task name to the string, padding with spaces so it
            can be printed in tabular form more easily. */
            pcWriteBuffer = prvWriteNameToBuffer( pcWriteBuffer, pxTaskStatusArray[ x ].pcTaskName );

            /* Write the rest of the string. */
            sprintf( pcWriteBuffer, "t%ct%ut%ut%urn", cStatus, ( unsigned int ) pxTaskStatusArray[ x ].uxCurrentPriority, ( unsigned int ) pxTaskStatusArray[ x ].usStackHighWaterMark, ( unsigned int ) pxTaskStatusArray[ x ].xTaskNumber );
            pcWriteBuffer += strlen( pcWriteBuffer );
        }
~~~ Result after the fix ~~~ Name Status Pri Free No. —- —— — —- — Diag E 2 403 3 IDLE R 0 108 10 Tmr Svc B 4 191 11 Led B 2 36 2 MB/TCPAcpt B 2 218 7 TCP/IP Stack B 2 596 1 RS4852 S 2 474 6 CC S 2 463 8 Qsec S 2 191 9 RS4850 S 2 474 4 RS4851 S 2 474 5 ~~~

FreeRTOS 10.0.0 Problem: vTaskList is truncating information about the calling task

Going to try and replicate this now.