Merge branch 'bugfix/assert_on_pin_task_nonexistent_cpu' into 'master'

Assert when a new task is started on a nonexisting CPU

Previously, starting a task on a CPU ID higher than the amount of CPUs FreeRTOS is configured with would not start the task and possibly have unintended side effects due to some out-of-bounds array writes. Assert on this so the app aborts cleanly.

See merge request !701
This commit is contained in:
Ivan Grokhotkov 2017-04-28 19:55:26 +08:00
commit e18f8da528

View File

@ -1046,6 +1046,11 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB, TaskFunction_t pxTaskCode
{
TCB_t *curTCB, *tcb0, *tcb1;
/* Assure that xCoreID is valid or we'll have an out-of-bounds on pxCurrentTCB
You will assert here if e.g. you only have one CPU enabled in menuconfig and
are trying to start a task on core 1. */
configASSERT( xCoreID == tskNO_AFFINITY || xCoreID < portNUM_PROCESSORS);
/* Ensure interrupts don't access the task lists while the lists are being
updated. */
taskENTER_CRITICAL(&xTaskQueueMutex);