freertos: modify configASSERTs around scheduler state check

Regression introduced in commit 79e74e5d5f

It is possible that some FreeRTOS APIs are invoked prior to
scheduler start condition (e.g. flash initialization in unicore mode).
In that condition these asserts should not trigger (scheduler state being yet to be started),
hence changes per this fix.
This commit is contained in:
Mahavir Jain 2019-11-12 22:36:30 +05:30 committed by bot
parent 376107b2ae
commit 1b53af2e88

View File

@ -1302,7 +1302,7 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB, TaskFunction_t pxTaskCode
//No mux; no harm done if this misfires. The deleted task won't get scheduled anyway. //No mux; no harm done if this misfires. The deleted task won't get scheduled anyway.
if( pxTCB == pxCurrentTCB[ core ] ) //If task was currently running on this core if( pxTCB == pxCurrentTCB[ core ] ) //If task was currently running on this core
{ {
configASSERT( xTaskGetSchedulerState() == taskSCHEDULER_RUNNING ) configASSERT( xTaskGetSchedulerState() != taskSCHEDULER_SUSPENDED )
/* The pre-delete hook is primarily for the Windows simulator, /* The pre-delete hook is primarily for the Windows simulator,
in which Windows specific clean up operations are performed, in which Windows specific clean up operations are performed,
@ -1337,7 +1337,7 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB, TaskFunction_t pxTaskCode
configASSERT( pxPreviousWakeTime ); configASSERT( pxPreviousWakeTime );
configASSERT( ( xTimeIncrement > 0U ) ); configASSERT( ( xTimeIncrement > 0U ) );
configASSERT( xTaskGetSchedulerState() == taskSCHEDULER_RUNNING ); configASSERT( xTaskGetSchedulerState() != taskSCHEDULER_SUSPENDED );
taskENTER_CRITICAL(&xTaskQueueMutex); taskENTER_CRITICAL(&xTaskQueueMutex);
// vTaskSuspendAll(); // vTaskSuspendAll();
@ -1435,7 +1435,7 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB, TaskFunction_t pxTaskCode
/* A delay time of zero just forces a reschedule. */ /* A delay time of zero just forces a reschedule. */
if( xTicksToDelay > ( TickType_t ) 0U ) if( xTicksToDelay > ( TickType_t ) 0U )
{ {
configASSERT( xTaskGetSchedulerState() == taskSCHEDULER_RUNNING ); configASSERT( xTaskGetSchedulerState() != taskSCHEDULER_SUSPENDED );
taskENTER_CRITICAL(&xTaskQueueMutex); taskENTER_CRITICAL(&xTaskQueueMutex);
// vTaskSuspendAll(); // vTaskSuspendAll();
{ {
@ -1818,7 +1818,7 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB, TaskFunction_t pxTaskCode
if( xSchedulerRunning != pdFALSE ) if( xSchedulerRunning != pdFALSE )
{ {
/* The current task has just been suspended. */ /* The current task has just been suspended. */
configASSERT( xTaskGetSchedulerState() == taskSCHEDULER_RUNNING ); configASSERT( xTaskGetSchedulerState() != taskSCHEDULER_SUSPENDED );
portYIELD_WITHIN_API(); portYIELD_WITHIN_API();
} }
else else
@ -2212,9 +2212,9 @@ BaseType_t xTaskResumeAll( void )
TCB_t *pxTCB; TCB_t *pxTCB;
BaseType_t xAlreadyYielded = pdFALSE; BaseType_t xAlreadyYielded = pdFALSE;
/* If uxSchedulerSuspended[ xPortGetCoreID() ] is zero then this function does not match a /* If scheduler state is `taskSCHEDULER_RUNNING` then this function does not match a
previous call to vTaskSuspendAll(). */ previous call to vTaskSuspendAll(). */
configASSERT( xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED ); configASSERT( xTaskGetSchedulerState() != taskSCHEDULER_RUNNING );
/* It is possible that an ISR caused a task to be removed from an event /* It is possible that an ISR caused a task to be removed from an event
list while the scheduler was suspended. If this was the case then the list while the scheduler was suspended. If this was the case then the
removed task will have been added to the xPendingReadyList. Once the removed task will have been added to the xPendingReadyList. Once the