]> granicus.if.org Git - esp-idf/commitdiff
Add UNTESTED_FUNCTION() call to untested functions, make Kconfig option to enable...
authorJeroen Domburg <git@j0h.nl>
Tue, 27 Sep 2016 03:36:30 +0000 (11:36 +0800)
committerJeroen Domburg <git@j0h.nl>
Tue, 27 Sep 2016 03:36:30 +0000 (11:36 +0800)
components/freertos/Kconfig
components/freertos/croutine.c
components/freertos/include/freertos/FreeRTOSConfig.h
components/freertos/queue.c
components/freertos/tasks.c

index d7c306c246ae07d292f1aba4ae81c7ee62805c42..af7142bb1f0a29e929e1bcaec3e78763a439f50a 100644 (file)
@@ -44,6 +44,14 @@ config FREERTOS_HZ
        help
                Select the tick rate at which FreeRTOS does pre-emptive context switching.
 
+config FREERTOS_ASSERT_ON_UNTESTED_FUNCTION
+       bool "Halt when an SMP-untested function is called"
+       default y
+       help
+               Some functions in FreeRTOS have not been thoroughly tested yet when moving to
+               the SMP implementation of FreeRTOS. When this option is enabled, these fuctions
+               will throw an assert().
+
 choice FREERTOS_CHECK_STACKOVERFLOW
        prompt "Check for stack overflow"
        default FREERTOS_CHECK_STACKOVERFLOW_QUICK
index 6a36da903350af7b59f55586a17c03ecb0b1b7aa..cd596ad45cc3b6c45abcab54c89a4f3a584e574f 100644 (file)
@@ -143,6 +143,7 @@ BaseType_t xCoRoutineCreate( crCOROUTINE_CODE pxCoRoutineCode, UBaseType_t uxPri
 BaseType_t xReturn;
 CRCB_t *pxCoRoutine;
 
+       UNTESTED_FUNCTION(); //Actually, coroutines are entirely unsupported
        /* Allocate the memory that will store the co-routine control block. */
        pxCoRoutine = ( CRCB_t * ) pvPortMalloc( sizeof( CRCB_t ) );
        if( pxCoRoutine )
index 089d799ddafb24586778c7ea1d8b4a50dd6c9dad..466c6404c7c484a6959130cdb851e6bcb0f8e5e7 100644 (file)
 #define configXT_SIMULATOR                                     0
 
 
+#if CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION
+#include "rom/ets_sys.h"
+#define UNTESTED_FUNCTION() { ets_printf("Untested FreeRTOS function %s\r\n", __FUNCTION__); configASSERT(false); } while(0)
+#else
+#define UNTESTED_FUNCTION()
+#endif
+
+
 #endif /* FREERTOS_CONFIG_H */
 
index 1fb0552d4955b53ef9a4d6042df0007ffd840cd0..bf4866569ba77446076ca61832d96a07fa0c455b 100644 (file)
@@ -888,7 +888,7 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue;
 
                configASSERT( pxQueue );
                configASSERT( !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) );
-               ets_printf("Not Supported: %s\n", __FUNCTION__);
+               UNTESTED_FUNCTION();
                for( ;; )
                {
                        taskENTER_CRITICAL();
@@ -1902,6 +1902,7 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue;
        BaseType_t xReturn;
        Queue_t * const pxQueue = ( Queue_t * ) xQueue;
 
+               UNTESTED_FUNCTION();
                /* If the queue is already full we may have to block.  A critical section
                is required to prevent an interrupt removing something from the queue
                between the check to see if the queue is full and blocking on the queue. */
@@ -2175,7 +2176,8 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue;
        void vQueueAddToRegistry( QueueHandle_t xQueue, const char *pcQueueName ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
        {
        UBaseType_t ux;
-
+               
+               UNTESTED_FUNCTION();
                /* See if there is an empty space in the registry.  A NULL name denotes
                a free slot. */
                for( ux = ( UBaseType_t ) 0U; ux < ( UBaseType_t ) configQUEUE_REGISTRY_SIZE; ux++ )
index b9035bda0f34d1b93c5a9c538123d141ce0c2a20..806a047f415345010663a0baf7ae33f4f479bd44 100644 (file)
@@ -129,6 +129,9 @@ functions but without including stdio.h here. */
                                        } while(0)
 #endif
 
+
+
+
 /* Value that can be assigned to the eNotifyState member of the TCB. */
 typedef enum
 {
@@ -584,7 +587,6 @@ BaseType_t xReturn;
 TCB_t * pxNewTCB;
 StackType_t *pxTopOfStack;
 BaseType_t i;
-       
        configASSERT( pxTaskCode );
        configASSERT( ( ( uxPriority & ( ~portPRIVILEGE_BIT ) ) < configMAX_PRIORITIES ) );
        configASSERT( (xCoreID>=0 && xCoreID<portNUM_PROCESSORS) || (xCoreID==tskNO_AFFINITY) );
@@ -859,7 +861,7 @@ BaseType_t i;
        TickType_t xTimeToWake;
        BaseType_t xAlreadyYielded=pdFALSE, xShouldDelay = pdFALSE;
 
-               ets_printf("ToDo %s\n", __FUNCTION__);
+               UNTESTED_FUNCTION();
                configASSERT( pxPreviousWakeTime );
                configASSERT( ( xTimeIncrement > 0U ) );
                configASSERT( uxSchedulerSuspended[ xPortGetCoreID() ] == 0 );
@@ -1029,7 +1031,7 @@ BaseType_t i;
        List_t *pxStateList;
        const TCB_t * const pxTCB = ( TCB_t * ) xTask;
 
-               ets_printf("ToDo %s\n", __FUNCTION__);
+               UNTESTED_FUNCTION();
                configASSERT( pxTCB );
 
                if( pxTCB == pxCurrentTCB[ xPortGetCoreID() ] )
@@ -1099,7 +1101,7 @@ BaseType_t i;
        TCB_t *pxTCB;
        UBaseType_t uxReturn;
 
-               ets_printf("ToDo %s\n", __FUNCTION__);
+               UNTESTED_FUNCTION();
                taskENTER_CRITICAL(&xTaskQueueMutex);
                {
                        /* If null is passed in here then we are changing the
@@ -1307,7 +1309,7 @@ BaseType_t i;
        {
        TCB_t *pxTCB;
 
-               ets_printf("ToDo %s\n", __FUNCTION__);
+               UNTESTED_FUNCTION();
                taskENTER_CRITICAL(&xTaskQueueMutex);
                {
                        /* If null is passed in here then it is the running task that is
@@ -1448,7 +1450,7 @@ BaseType_t i;
        {
        TCB_t * const pxTCB = ( TCB_t * ) xTaskToResume;
 
-               ets_printf("ToDo %s\n", __FUNCTION__);
+               UNTESTED_FUNCTION();
                /* It does not make sense to resume the calling task. */
                configASSERT( xTaskToResume );
 
@@ -1850,7 +1852,7 @@ UBaseType_t uxTaskGetNumberOfTasks( void )
        {
        UBaseType_t uxTask = 0, uxQueue = configMAX_PRIORITIES;
 
-               ets_printf("ToDo %s\n", __FUNCTION__);
+               UNTESTED_FUNCTION();
                vTaskSuspendAll(); //WARNING: This only suspends one CPU. ToDo: suspend others as well. Mux using taskQueueMutex maybe?
                {
                        /* Is there a space in the array for each task in the system? */
@@ -3136,7 +3138,7 @@ UBaseType_t x;
        {
        TCB_t *pxTCB;
 
-               ets_printf("ToDo %s\n", __FUNCTION__);
+               UNTESTED_FUNCTION();
                /* If null is passed in here then we are deleting ourselves. */
                pxTCB = prvGetTCBFromHandle( xTaskToModify );
 
@@ -3344,6 +3346,7 @@ TCB_t *pxNewTCB;
        volatile TCB_t *pxNextTCB, *pxFirstTCB;
        UBaseType_t uxTask = 0;
 
+               UNTESTED_FUNCTION();
                if( listCURRENT_LIST_LENGTH( pxList ) > ( UBaseType_t ) 0 )
                {
                        listGET_OWNER_OF_NEXT_ENTRY( pxFirstTCB, pxList );
@@ -3450,6 +3453,7 @@ TCB_t *pxNewTCB;
        uint8_t *pucEndOfStack;
        UBaseType_t uxReturn;
 
+               UNTESTED_FUNCTION();
                pxTCB = prvGetTCBFromHandle( xTask );
 
                #if portSTACK_GROWTH < 0
@@ -3881,6 +3885,7 @@ scheduler will re-enable the interrupts instead. */
        TaskStatus_t *pxTaskStatusArray;
        volatile UBaseType_t uxArraySize, x;
        char cStatus;
+               UNTESTED_FUNCTION();
 
                /*
                 * PLEASE NOTE:
@@ -3974,6 +3979,7 @@ scheduler will re-enable the interrupts instead. */
        volatile UBaseType_t uxArraySize, x;
        uint32_t ulTotalTime, ulStatsAsPercentage;
 
+               UNTESTED_FUNCTION();
                #if( configUSE_TRACE_FACILITY != 1 )
                {
                        #error configUSE_TRACE_FACILITY must also be set to 1 in FreeRTOSConfig.h to use vTaskGetRunTimeStats().
@@ -4131,6 +4137,7 @@ TickType_t uxReturn;
        TickType_t xTimeToWake;
        uint32_t ulReturn;
 
+               UNTESTED_FUNCTION();
                taskENTER_CRITICAL(&xTaskQueueMutex);
                {
                        /* Only block if the notification count is not already non-zero. */
@@ -4241,6 +4248,7 @@ TickType_t uxReturn;
        TickType_t xTimeToWake;
        BaseType_t xReturn;
 
+               UNTESTED_FUNCTION();
                taskENTER_CRITICAL(&xTaskQueueMutex);
                {
                        /* Only block if a notification is not already pending. */
@@ -4363,6 +4371,7 @@ TickType_t uxReturn;
        eNotifyValue eOriginalNotifyState;
        BaseType_t xReturn = pdPASS;
 
+               UNTESTED_FUNCTION();
                configASSERT( xTaskToNotify );
                pxTCB = ( TCB_t * ) xTaskToNotify;
 
@@ -4447,6 +4456,7 @@ TickType_t uxReturn;
        eNotifyValue eOriginalNotifyState;
        BaseType_t xReturn = pdPASS;
 
+               UNTESTED_FUNCTION();
                configASSERT( xTaskToNotify );
 
                pxTCB = ( TCB_t * ) xTaskToNotify;
@@ -4540,6 +4550,7 @@ TickType_t uxReturn;
        TCB_t * pxTCB;
        eNotifyValue eOriginalNotifyState;
 
+               UNTESTED_FUNCTION();
                configASSERT( xTaskToNotify );