xPendingReadyList is crashed in FreeRTOS on RM57L843ZWT
The FreeRTOS is generatd by HALCoGEN 4.6.1 and so its version is 8.2.0.
The system has been running for a while (several minutes) and then crashed. The location crashed is in the function xTaskResumeAll (os_task.c)
while( listLIST_IS_EMPTY( &xPendingReadyList ) == pdFALSE )
{
pxTCB = ( TCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( ( &xPendingReadyList ) );
( void ) uxListRemove( &( pxTCB->xEventListItem ) );
The cause is that when the number of the item in xPendingReadyList is ZERO (because pxList->xListEnd.pxNext == (ListItem_t *)&(pxList->xListEnd)), the variable uxNumberOfItems is still ONE, but the FreeRTOS check if list is empty by uxNumberOfItems,
#define listLIST_IS_EMPTY( pxList ) ( ( BaseType_t ) ( ( pxList )->uxNumberOfItems == ( UBaseType_t ) 0 ) )
So in the next loop the pxTCB is an invalid pointer.
Who can explain why the list xPendingReadyList is crashed.
Thanks.
Zhiqiang