From 5e45472d6ec29d89eb677c8588cfab2038837636 Mon Sep 17 00:00:00 2001 From: Joseph Julicher Date: Wed, 3 Mar 2021 10:38:12 -0700 Subject: [PATCH 1/6] fixed documentation for ulTaskNotifyTake() and ulTaskNotifyTakeIndexed() (#269) --- include/task.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/include/task.h b/include/task.h index 181ed70fd..d17bef8e7 100644 --- a/include/task.h +++ b/include/task.h @@ -1934,9 +1934,8 @@ uint32_t ulTaskGetIdleRunTimeCounter( void ) PRIVILEGED_FUNCTION; * that way task notifications can be used to send data to a task, or be used as * light weight and fast binary or counting semaphores. * - * A task can use xTaskNotifyWaitIndexed() to [optionally] block to wait for a - * notification to be pending, or ulTaskNotifyTakeIndexed() to [optionally] block - * to wait for a notification value to have a non-zero value. The task does + * A task can use xTaskNotifyWaitIndexed() or ulTaskNotifyTakeIndexed() to + * [optionally] block to wait for a notification to be pending. The task does * not consume any CPU time while it is in the Blocked state. * * A notification sent to a task will remain pending until it is cleared by the @@ -2522,8 +2521,8 @@ void vTaskGenericNotifyGiveFromISR( TaskHandle_t xTaskToNotify, * value acts like a counting semaphore. * * A task can use ulTaskNotifyTakeIndexed() to [optionally] block to wait for - * the task's notification value to be non-zero. The task does not consume any - * CPU time while it is in the Blocked state. + * a notification. The task does not consume any CPU time while it is in the + * Blocked state. * * Where as xTaskNotifyWaitIndexed() will return when a notification is pending, * ulTaskNotifyTakeIndexed() will return when the task's notification value is From 98eba938e2defa4eca516517113e5bfb0c38969f Mon Sep 17 00:00:00 2001 From: xuelix <33909469+xuelix@users.noreply.github.com> Date: Thu, 4 Mar 2021 21:00:22 +0000 Subject: [PATCH 2/6] Added git-secrets check to Github Actions (#270) Co-authored-by: Gary Wicker <14828980+gkwicker@users.noreply.github.com> --- .github/workflows/ci.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f5ff4eefb..cb689b7d4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,3 +44,23 @@ jobs: - name: URL Checker run: | bash kernel/.github/actions/url_verifier.sh kernel + + git-secrets: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Checkout awslabs/git-secrets + uses: actions/checkout@v2 + with: + repository: awslabs/git-secrets + ref: master + path: git-secrets + - name: Install git-secrets + run: cd git-secrets && sudo make install && cd .. + - name: Run git-secrets + run: | + git-secrets --register-aws + git-secrets --scan + From 4b5d1e43959e5f4e245c3af708056f6b4b324862 Mon Sep 17 00:00:00 2001 From: alfred gedeon <28123637+alfred2g@users.noreply.github.com> Date: Fri, 5 Mar 2021 09:13:03 -0800 Subject: [PATCH 3/6] Comment: fix code comment for xTaskAbortDelay (#272) --- tasks.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks.c b/tasks.c index a994ec908..fd3c25744 100644 --- a/tasks.c +++ b/tasks.c @@ -2694,8 +2694,8 @@ BaseType_t xTaskCatchUpTicks( TickType_t xTicksToCatchUp ) #if ( configUSE_PREEMPTION == 1 ) { /* Preemption is on, but a context switch should only be - * performed if the unblocked task has a priority that is - * equal to or higher than the currently executing task. */ + * performed if the unblocked task has a priority that is + * higher than the currently executing task. */ if( pxTCB->uxPriority > pxCurrentTCB->uxPriority ) { /* Pend the yield to be performed when the scheduler From de19eeb7d343531496a7e46ca36e10abe3874f02 Mon Sep 17 00:00:00 2001 From: xuelix <33909469+xuelix@users.noreply.github.com> Date: Fri, 5 Mar 2021 22:00:57 +0000 Subject: [PATCH 4/6] Moved git-secrets check to a different workflow (#271) git-secrets check is now performed on all PR branches --- .github/workflows/ci.yml | 19 ------------------- .github/workflows/git-secrets.yml | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/git-secrets.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb689b7d4..50c1b1871 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,22 +45,3 @@ jobs: run: | bash kernel/.github/actions/url_verifier.sh kernel - git-secrets: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - name: Checkout awslabs/git-secrets - uses: actions/checkout@v2 - with: - repository: awslabs/git-secrets - ref: master - path: git-secrets - - name: Install git-secrets - run: cd git-secrets && sudo make install && cd .. - - name: Run git-secrets - run: | - git-secrets --register-aws - git-secrets --scan - diff --git a/.github/workflows/git-secrets.yml b/.github/workflows/git-secrets.yml new file mode 100644 index 000000000..b78a79c45 --- /dev/null +++ b/.github/workflows/git-secrets.yml @@ -0,0 +1,24 @@ +name: git-secrets Check +on: + push: + pull_request: + workflow_dispatch: +jobs: + git-secrets: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Checkout awslabs/git-secrets + uses: actions/checkout@v2 + with: + repository: awslabs/git-secrets + ref: master + path: git-secrets + - name: Install git-secrets + run: cd git-secrets && sudo make install && cd .. + - name: Run git-secrets + run: | + git-secrets --register-aws + git-secrets --scan From 18d4ba9c0792278a4e6351508e3410bdabe98275 Mon Sep 17 00:00:00 2001 From: Paul Bartell Date: Fri, 5 Mar 2021 18:46:49 -0800 Subject: [PATCH 5/6] Add some assertions and coverage exceptions to queue.c (#273) * Add an LCOV_BRANCH exception for the check that sizeof( StaticQueue_t ) == sizeof( Queue_t ) * Add LCOV_BRANCH coverage exception for a configASSERT on pxQueueSetContainer with a condition that is unreachable. * Add configASSERTs to alert when invalid parameters are passed into Queue Registry related functions. * Assert that the semaphore handle passed into xQueueGetMutexHolder is not NULL. * Correct some typos in queue.c * Update lexicon.txt --- .github/lexicon.txt | 6 ++++-- queue.c | 30 ++++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/.github/lexicon.txt b/.github/lexicon.txt index 9ffef9ac6..800def74d 100644 --- a/.github/lexicon.txt +++ b/.github/lexicon.txt @@ -1529,6 +1529,7 @@ prvinitialisenewstreambuffer prvinitialisenewtimer prvinsertblockintofreelist prvlockqueue +prvnotifyqueuesetcontainer prvportmalloc prvportresetpic prvprocesssimulatedinterrupts @@ -1631,7 +1632,6 @@ pvyieldevent pwdtc pwm pwmc -pxtaskcode pxblock pxblocktoinsert pxcallbackfunction @@ -1688,6 +1688,7 @@ pxprevious pxpreviouswaketime pxqueue pxqueuebuffer +pxqueuesetcontainer pxramstack pxreadycoroutinelists pxreadytaskslists @@ -1707,6 +1708,7 @@ pxstreambuffercreatestatic pxtagvalue pxtask pxtaskbuffer +pxtaskcode pxtaskdefinition pxtaskstatus pxtaskstatusarray @@ -2653,7 +2655,6 @@ wu www wwwfreertos wxr -xtasktodelete xa xaa xaaaa @@ -3020,6 +3021,7 @@ xtaskswaitingforbits xtaskswaitingtermination xtaskswaitingtoreceive xtaskswaitingtosend +xtasktodelete xtasktonotify xtasktoquery xtasktoresume diff --git a/queue.c b/queue.c index 7ed8e9878..6805cd050 100644 --- a/queue.c +++ b/queue.c @@ -342,8 +342,10 @@ BaseType_t xQueueGenericReset( QueueHandle_t xQueue, * variable of type StaticQueue_t or StaticSemaphore_t equals the size of * the real queue and semaphore structures. */ volatile size_t xSize = sizeof( StaticQueue_t ); - configASSERT( xSize == sizeof( Queue_t ) ); - ( void ) xSize; /* Keeps lint quiet when configASSERT() is not defined. */ + + /* This assertion cannot be branch covered in unit tests */ + configASSERT( xSize == sizeof( Queue_t ) ); /* LCOV_EXCL_BR_LINE */ + ( void ) xSize; /* Keeps lint quiet when configASSERT() is not defined. */ } #endif /* configASSERT_DEFINED */ @@ -398,7 +400,7 @@ BaseType_t xQueueGenericReset( QueueHandle_t xQueue, configASSERT( ( uxItemSize == 0 ) || ( uxQueueLength == ( xQueueSizeInBytes / uxItemSize ) ) ); /* Check for addition overflow. */ - configASSERT( ( sizeof( Queue_t ) + xQueueSizeInBytes ) > xQueueSizeInBytes ); + configASSERT( ( sizeof( Queue_t ) + xQueueSizeInBytes ) > xQueueSizeInBytes ); /* Allocate the queue and storage area. Justification for MISRA * deviation as follows: pvPortMalloc() always ensures returned memory @@ -561,6 +563,8 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength, TaskHandle_t pxReturn; Queue_t * const pxSemaphore = ( Queue_t * ) xSemaphore; + configASSERT( xSemaphore ); + /* This function is called by xSemaphoreGetMutexHolder(), and should not * be called directly. Note: This is a good way of determining if the * calling task is the mutex holder, but not a good way of determining the @@ -944,15 +948,15 @@ BaseType_t xQueueGenericSend( QueueHandle_t xQueue, vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToSend ), xTicksToWait ); /* Unlocking the queue means queue events can effect the - * event list. It is possible that interrupts occurring now + * event list. It is possible that interrupts occurring now * remove this task from the event list again - but as the * scheduler is suspended the task will go onto the pending - * ready last instead of the actual ready list. */ + * ready list instead of the actual ready list. */ prvUnlockQueue( pxQueue ); /* Resuming the scheduler will move tasks from the pending * ready list into the ready list - so it is feasible that this - * task is already in a ready list before it yields - in which + * task is already in the ready list before it yields - in which * case the yield will not cause a context switch unless there * is also a higher priority task in the pending ready list. */ if( xTaskResumeAll() == pdFALSE ) @@ -1774,7 +1778,7 @@ BaseType_t xQueuePeek( QueueHandle_t xQueue, taskEXIT_CRITICAL(); /* Interrupts and other tasks can send to and receive from the queue - * now the critical section has been exited. */ + * now that the critical section has been exited. */ vTaskSuspendAll(); prvLockQueue( pxQueue ); @@ -2723,6 +2727,9 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue ) { UBaseType_t ux; + configASSERT( xQueue ); + configASSERT( pcQueueName ); + /* 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++ ) @@ -2753,6 +2760,8 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue ) UBaseType_t ux; const char * pcReturn = NULL; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ + configASSERT( xQueue ); + /* Note there is nothing here to protect against another task adding or * removing entries from the registry while it is being searched. */ @@ -2781,6 +2790,8 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue ) { UBaseType_t ux; + configASSERT( xQueue ); + /* See if the handle of the queue being unregistered in actually in the * registry. */ for( ux = ( UBaseType_t ) 0U; ux < ( UBaseType_t ) configQUEUE_REGISTRY_SIZE; ux++ ) @@ -2967,7 +2978,10 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue ) /* This function must be called form a critical section. */ - configASSERT( pxQueueSetContainer ); + /* The following line is not reachable in unit tests because every call + * to prvNotifyQueueSetContainer is preceded by a check that + * pxQueueSetContainer != NULL */ + configASSERT( pxQueueSetContainer ); /* LCOV_EXCL_BR_LINE */ configASSERT( pxQueueSetContainer->uxMessagesWaiting < pxQueueSetContainer->uxLength ); if( pxQueueSetContainer->uxMessagesWaiting < pxQueueSetContainer->uxLength ) From 66b3f908df957ab2fc6ccd40dc309465ec4ec267 Mon Sep 17 00:00:00 2001 From: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com> Date: Fri, 12 Mar 2021 12:11:19 -0800 Subject: [PATCH 6/6] Update comment in list.c (#276) The tick interrupt priority must be configured to ensure that it cannot interrupt a critical section. This change updates the comment to help the application writer while debugging. Signed-off-by: Gaurav Aggarwal --- list.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/list.c b/list.c index 17a4e903e..d1a59649e 100644 --- a/list.c +++ b/list.c @@ -158,6 +158,9 @@ void vListInsert( List_t * const pxList, * 4) Using a queue or semaphore before it has been initialised or * before the scheduler has been started (are interrupts firing * before vTaskStartScheduler() has been called?). + * 5) If the FreeRTOS port supports interrupt nesting then ensure that + * the priority of the tick interrupt is at or below + * configMAX_SYSCALL_INTERRUPT_PRIORITY. **********************************************************************/ for( pxIterator = ( ListItem_t * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext ) /*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM. This is checked and valid. *//*lint !e440 The iterator moves to a different value, not xValueOfInsertion. */