]> granicus.if.org Git - esp-idf/commitdiff
Assert when a new task is started on a nonexisting CPU
authorJeroen Domburg <jeroen@espressif.com>
Tue, 25 Apr 2017 09:47:25 +0000 (17:47 +0800)
committerJeroen Domburg <jeroen@espressif.com>
Tue, 25 Apr 2017 09:47:25 +0000 (17:47 +0800)
components/freertos/tasks.c

index ff407d9baf2d2b255134d5fb0e35dcfbfba0aa41..59974ef5e638b8ac72312208758c11a72b380f9c 100644 (file)
@@ -1044,6 +1044,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);