]> granicus.if.org Git - esp-idf/commitdiff
freertos: add configTASKLIST_INCLUDE_COREID
authorIvan Grokhotkov <ivan@espressif.com>
Mon, 9 Jul 2018 07:25:59 +0000 (15:25 +0800)
committerbot <bot@espressif.com>
Tue, 17 Jul 2018 10:57:26 +0000 (10:57 +0000)
components/freertos/include/freertos/FreeRTOS.h
components/freertos/include/freertos/FreeRTOSConfig.h
components/freertos/include/freertos/task.h
components/freertos/tasks.c
docs/Doxyfile
examples/system/console/main/cmd_system.c

index 1bc931757c8d4748ee722e12cf21824ed8e16139..486d9c329aab1ca2a04da83f8721c80f145b9a15 100644 (file)
@@ -740,6 +740,10 @@ extern "C" {
        #define configUSE_STATS_FORMATTING_FUNCTIONS 0
 #endif
 
+#ifndef configTASKLIST_INCLUDE_COREID
+    #define configTASKLIST_INCLUDE_COREID   0
+#endif
+
 #ifndef portASSERT_IF_INTERRUPT_PRIORITY_INVALID
        #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID()
 #endif
index c52bc927cf4ac0ca023b5b4c9180c0f27b49110d..f74b79d4eaefcaee0242ddc6dda0784d852e7159 100644 (file)
@@ -211,6 +211,10 @@ int xt_clock_freq(void) __attribute__((deprecated));
 #define configUSE_STATS_FORMATTING_FUNCTIONS    1   /* Used by vTaskList() */
 #endif
 
+#ifdef CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID
+#define configTASKLIST_INCLUDE_COREID   1
+#endif
+
 #ifdef CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS
 #define configGENERATE_RUN_TIME_STATS   1       /* Used by vTaskGetRunTimeStats() */
 #endif
index c548c945fde2b00c9696c8b2feec6bf24f808ee8..31df0bdd1040b12c251e0ef813033e12001cad6d 100644 (file)
@@ -181,7 +181,9 @@ typedef struct xTASK_STATUS
        uint32_t ulRunTimeCounter;              /*!< The total run time allocated to the task so far, as defined by the run time stats clock.  See http://www.freertos.org/rtos-run-time-stats.html.  Only valid when configGENERATE_RUN_TIME_STATS is defined as 1 in FreeRTOSConfig.h. */
        StackType_t *pxStackBase;               /*!< Points to the lowest address of the task's stack area. */
        uint32_t usStackHighWaterMark;  /*!< The minimum amount of stack space that has remained for the task since the task was created.  The closer this value is to zero the closer the task has come to overflowing its stack. */
-       BaseType_t xCoreID;                             /*!< Core this task is pinned to */
+#if configTASKLIST_INCLUDE_COREID
+       BaseType_t xCoreID;                             /*!< Core this task is pinned to. This field is present if CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID is set. */
+#endif
 } TaskStatus_t;
 
 /**
index 1265583b7ebfcae543795d46dbd54acb921e5d52..ac0b732a8b8dbefc9cf1e71af97ee1bf2cae6ffe 100644 (file)
@@ -3784,7 +3784,10 @@ BaseType_t xTaskGetAffinity( TaskHandle_t xTask )
                                pxTaskStatusArray[ uxTask ].xTaskNumber = pxNextTCB->uxTCBNumber;
                                pxTaskStatusArray[ uxTask ].eCurrentState = eState;
                                pxTaskStatusArray[ uxTask ].uxCurrentPriority = pxNextTCB->uxPriority;
+
+                               #if ( configTASKLIST_INCLUDE_COREID == 1 )
                                pxTaskStatusArray[ uxTask ].xCoreID = pxNextTCB->xCoreID;
+                               #endif /* configTASKLIST_INCLUDE_COREID */
 
                                #if ( INCLUDE_vTaskSuspend == 1 )
                                {
@@ -4450,7 +4453,7 @@ For ESP32 FreeRTOS, vTaskExitCritical implements both portEXIT_CRITICAL and port
                                pcWriteBuffer = prvWriteNameToBuffer( pcWriteBuffer, pxTaskStatusArray[ x ].pcTaskName );
 
                                /* Write the rest of the string. */
-#ifdef CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID
+#if configTASKLIST_INCLUDE_COREID
                                sprintf( pcWriteBuffer, "\t%c\t%u\t%u\t%u\t%hd\r\n", cStatus, ( unsigned int ) pxTaskStatusArray[ x ].uxCurrentPriority, ( unsigned int ) pxTaskStatusArray[ x ].usStackHighWaterMark, ( unsigned int ) pxTaskStatusArray[ x ].xTaskNumber, ( int ) pxTaskStatusArray[ x ].xCoreID );
 #else
                                sprintf( pcWriteBuffer, "\t%c\t%u\t%u\t%u\r\n", cStatus, ( unsigned int ) pxTaskStatusArray[ x ].uxCurrentPriority, ( unsigned int ) pxTaskStatusArray[ x ].usStackHighWaterMark, ( unsigned int ) pxTaskStatusArray[ x ].xTaskNumber );
index 643ae2e29f88360207758b98fbb25dbfed0c31eb..c898e9469e164e8110b4ed487e195ea4e631aefc 100644 (file)
@@ -199,7 +199,8 @@ PREDEFINED             = \
     configUSE_RECURSIVE_MUTEXES=1 \
     configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS=1 \
     configNUM_THREAD_LOCAL_STORAGE_POINTERS=1 \
-    configUSE_APPLICATION_TASK_TAG=1
+    configUSE_APPLICATION_TASK_TAG=1 \
+    configTASKLIST_INCLUDE_COREID=1
 
 ## Do not complain about not having dot
 ##
index b65645829510e55a4882a3f625675cd430ab0105..0d5c76fd7af54a6f002adbf34fc6acb08ccd4fd9 100644 (file)
@@ -94,7 +94,11 @@ static int tasks_info(int argc, char** argv)
         ESP_LOGE(__func__, "failed to allocate buffer for vTaskList output");
         return 1;
     }
-    fputs("Task Name\tStatus\tPrio\tHWM\tTask Number\n", stdout);    
+    fputs("Task Name\tStatus\tPrio\tHWM\tTask#", stdout);
+#ifdef CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID
+    fputs("\tAffinity", stdout);
+#endif
+    fputs("\n", stdout);
     vTaskList(task_list_buffer);
     fputs(task_list_buffer, stdout);
     free(task_list_buffer);