diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2765466be..edda39154 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ on: workflow_dispatch: jobs: formatting: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v4.1.1 - name: Check Formatting of FreeRTOS-Kernel Files diff --git a/.github/workflows/formatting.yml b/.github/workflows/formatting.yml new file mode 100644 index 000000000..2f369105a --- /dev/null +++ b/.github/workflows/formatting.yml @@ -0,0 +1,25 @@ +name: Format Pull Request Files + +on: + issue_comment: + types: [created] + +env: + bashPass: \033[32;1mPASSED - + bashInfo: \033[33;1mINFO - + bashFail: \033[31;1mFAILED - + bashEnd: \033[0m + +jobs: + Formatting: + name: Run Formatting Check + if: ${{ github.event.issue.pull_request && + ( ( github.event.comment.body == '/bot run uncrustify' ) || + ( github.event.comment.body == '/bot run formatting' ) ) }} + runs-on: ubuntu-20.04 + steps: + - name: Apply Formatting Fix + id: check-formatting + uses: FreeRTOS/CI-CD-Github-Actions/formatting-bot@main + with: + exclude-dirs: portable diff --git a/.github/workflows/kernel-checks.yml b/.github/workflows/kernel-checks.yml index 05443458c..ad3096f0d 100644 --- a/.github/workflows/kernel-checks.yml +++ b/.github/workflows/kernel-checks.yml @@ -5,7 +5,7 @@ on: [push, pull_request] jobs: kernel-checker: name: FreeRTOS Kernel Header Checks - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: # Install python 3 - name: Tool Setup diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index bc8aaf69c..3591436a4 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -3,7 +3,7 @@ on: [push, pull_request] jobs: run: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: Checkout Parent Repository uses: actions/checkout@v4.1.1 diff --git a/examples/template_configuration/FreeRTOSConfig.h b/examples/template_configuration/FreeRTOSConfig.h index 5521adb4d..5684e3c39 100644 --- a/examples/template_configuration/FreeRTOSConfig.h +++ b/examples/template_configuration/FreeRTOSConfig.h @@ -415,8 +415,6 @@ * number of the failing assert (for example, "vAssertCalled( __FILE__, __LINE__ * )" or it can simple disable interrupts and sit in a loop to halt all * execution on the failing line for viewing in a debugger. */ - -/* *INDENT-OFF* */ #define configASSERT( x ) \ if( ( x ) == 0 ) \ { \ @@ -424,7 +422,6 @@ for( ; ; ) \ ; \ } -/* *INDENT-ON* */ /******************************************************************************/ /* FreeRTOS MPU specific definitions. *****************************************/ diff --git a/include/croutine.h b/include/croutine.h index a5e2e4462..25f4caec8 100644 --- a/include/croutine.h +++ b/include/croutine.h @@ -246,10 +246,7 @@ void vCoRoutineSchedule( void ); * \defgroup crSTART crSTART * \ingroup Tasks */ - -/* *INDENT-OFF* */ #define crEND() } -/* *INDENT-ON* */ /* * These macros are intended for internal use by the co-routine implementation diff --git a/include/task.h b/include/task.h index 883f4edd0..3c6f9dde5 100644 --- a/include/task.h +++ b/include/task.h @@ -333,7 +333,6 @@ typedef enum portGET_SPINLOCK( xCoreID, ( portSPINLOCK_TYPE * ) &( ( pxDataGroup )->xISRSpinlock ) ); \ /* Increment the critical nesting count */ \ portINCREMENT_CRITICAL_NESTING_COUNT( xCoreID ); \ - /* Return the previous interrupt status */ \ uxSavedInterruptStatus; \ } ) #endif /* #if ( portUSING_GRANULAR_LOCKS == 1 ) */ @@ -351,7 +350,6 @@ typedef enum do { \ const BaseType_t xCoreID = ( BaseType_t ) portGET_CORE_ID(); \ configASSERT( portGET_CRITICAL_NESTING_COUNT( xCoreID ) > 0U ); \ - /* Decrement the critical nesting count */ \ portDECREMENT_CRITICAL_NESTING_COUNT( xCoreID ); \ if( portGET_CRITICAL_NESTING_COUNT( xCoreID ) == 0 ) \ { \ @@ -384,9 +382,7 @@ typedef enum do { \ const BaseType_t xCoreID = ( BaseType_t ) portGET_CORE_ID(); \ configASSERT( portGET_CRITICAL_NESTING_COUNT( xCoreID ) > 0U ); \ - /* Decrement the critical nesting count */ \ portDECREMENT_CRITICAL_NESTING_COUNT( xCoreID ); \ - /* Release the ISR spinlock */ \ portRELEASE_SPINLOCK( xCoreID, ( portSPINLOCK_TYPE * ) &( pxDataGroup->xISRSpinlock ) ); \ if( portGET_CRITICAL_NESTING_COUNT( xCoreID ) == 0 ) \ { \ diff --git a/portable/Common/mpu_wrappers_v2.c b/portable/Common/mpu_wrappers_v2.c index 9f9fa43ea..e92aca0f5 100644 --- a/portable/Common/mpu_wrappers_v2.c +++ b/portable/Common/mpu_wrappers_v2.c @@ -1059,8 +1059,8 @@ configRUN_TIME_COUNTER_TYPE * pulTotalRunTime ) /* PRIVILEGED_FUNCTION */ { UBaseType_t uxReturn = 0; - BaseType_t xIsTaskStatusArrayWriteable = pdFALSE; - BaseType_t xIsTotalRunTimeWriteable = pdFALSE; + UBaseType_t xIsTaskStatusArrayWriteable = pdFALSE; + UBaseType_t xIsTotalRunTimeWriteable = pdFALSE; uint32_t ulArraySize = ( uint32_t ) uxArraySize; uint32_t ulTaskStatusSize = ( uint32_t ) sizeof( TaskStatus_t ); diff --git a/portable/IAR/RL78/portmacro.h b/portable/IAR/RL78/portmacro.h index 36697a620..544e76e9e 100644 --- a/portable/IAR/RL78/portmacro.h +++ b/portable/IAR/RL78/portmacro.h @@ -187,7 +187,7 @@ * ; * memory mode) registers the _usCriticalNesting value and the Stack Pointer * ; * of the active Task onto the task stack. * ; *---------------------------------------------------------------------------*/ -portSAVE_CONTEXT MACRO + portSAVE_CONTEXT MACRO PUSH AX; /* Save AX Register to stack. */ PUSH HL #if __CODE_MODEL__ == __CODE_MODEL_FAR__ @@ -217,7 +217,7 @@ portSAVE_CONTEXT MACRO * ; * general purpose registers and the CS and ES (only in __far memory mode) * ; * of the selected task from the task stack. * ; *---------------------------------------------------------------------------*/ -portRESTORE_CONTEXT MACRO + portRESTORE_CONTEXT MACRO MOVW AX, _pxCurrentTCB; /* Restore the Task stack pointer. */ MOVW HL, AX MOVW AX, [ HL ] diff --git a/portable/MPLAB/PIC32MZ/port.c b/portable/MPLAB/PIC32MZ/port.c index 4af1fb832..034fc26d1 100644 --- a/portable/MPLAB/PIC32MZ/port.c +++ b/portable/MPLAB/PIC32MZ/port.c @@ -234,11 +234,6 @@ __attribute__(( weak )) void vApplicationSetupTickTimerInterrupt( void ) { const uint32_t ulCompareMatch = ( (configPERIPHERAL_CLOCK_HZ / portTIMER_PRESCALE) / configTICK_RATE_HZ ) - 1UL; - /* PR1 is 16-bit. Ensure that the configPERIPHERAL_CLOCK_HZ and - * configTICK_RATE_HZ are defined such that ulCompareMatch value would fit - * in 16-bits. */ - configASSERT( ( ulCompareMatch & 0xFFFF0000 ) == 0 ); - T1CON = 0x0000; T1CONbits.TCKPS = portPRESCALE_BITS; PR1 = ulCompareMatch; diff --git a/portable/ThirdParty/GCC/Posix/port.c b/portable/ThirdParty/GCC/Posix/port.c index b5a4a1b62..dd7ca1a9a 100644 --- a/portable/ThirdParty/GCC/Posix/port.c +++ b/portable/ThirdParty/GCC/Posix/port.c @@ -48,8 +48,8 @@ * stdio (printf() and friends) should be called from a single task * only or serialized with a FreeRTOS primitive such as a binary * semaphore or mutex. -* -* Note: When using LLDB (the default debugger on macOS) with this port, +* +* Note: When using LLDB (the default debugger on macOS) with this port, * suppress SIGUSR1 to prevent debugger interference. This can be * done by adding the following line to ~/.lldbinit: * `process handle SIGUSR1 -n true -p false -s false` @@ -324,23 +324,17 @@ BaseType_t xPortStartScheduler( void ) void vPortEndScheduler( void ) { Thread_t * pxCurrentThread; - BaseType_t xIsFreeRTOSThread; /* Stop the timer tick thread. */ xTimerTickThreadShouldRun = false; pthread_join( hTimerTickThread, NULL ); - /* Check whether the current thread is a FreeRTOS thread. - * This has to happen before the scheduler is signaled to exit - * its loop to prevent data races on the thread key. */ - xIsFreeRTOSThread = prvIsFreeRTOSThread(); - /* Signal the scheduler to exit its loop. */ xSchedulerEnd = pdTRUE; ( void ) pthread_kill( hMainThread, SIG_RESUME ); /* Waiting to be deleted here. */ - if( xIsFreeRTOSThread == pdTRUE ) + if( prvIsFreeRTOSThread() == pdTRUE ) { pxCurrentThread = prvGetThreadFromTask( xTaskGetCurrentTaskHandle() ); event_wait( pxCurrentThread->ev ); diff --git a/queue.c b/queue.c index 0aac2317f..1e5e3e591 100644 --- a/queue.c +++ b/queue.c @@ -339,14 +339,6 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength, prvUnlockQueue( ( pxQueue ) ); \ portRELEASE_SPINLOCK( portGET_CORE_ID(), &( pxQueue->xTaskSpinlock ) ); \ vTaskPreemptionEnable( NULL ); \ - if( ( xYieldAPI ) == pdTRUE ) \ - { \ - taskYIELD_WITHIN_API(); \ - } \ - else \ - { \ - mtCOVERAGE_TEST_MARKER(); \ - } \ } while( 0 ) #else /* #if ( ( portUSING_GRANULAR_LOCKS == 1 ) && ( configNUMBER_OF_CORES > 1 ) ) */ #define queueLOCK( pxQueue ) \ diff --git a/tasks.c b/tasks.c index 68620d854..e1299c945 100644 --- a/tasks.c +++ b/tasks.c @@ -5406,13 +5406,11 @@ BaseType_t xTaskIncrementTick( void ) * SMP port. */ configASSERT( portGET_CRITICAL_NESTING_COUNT( xCoreID ) == 0 ); - /* vTaskSwitchContext() must not be called with a task that has - * preemption disabled. */ - #if ( configUSE_TASK_PREEMPTION_DISABLE == 1 ) - configASSERT( pxCurrentTCBs[ xCoreID ]->xPreemptionDisable == 0U ); - #endif - - if( uxSchedulerSuspended != ( UBaseType_t ) 0U ) + if( uxSchedulerSuspended != ( UBaseType_t ) 0U + #if ( configUSE_TASK_PREEMPTION_DISABLE == 1 ) + || ( ( taskTASK_IS_RUNNING( pxCurrentTCBs[ xCoreID ] ) ) && ( pxCurrentTCBs[ xCoreID ]->xPreemptionDisable > 0U ) ) + #endif + ) { /* The scheduler is currently suspended or the task * has requested to not be preempted - do not allow @@ -7500,11 +7498,11 @@ static void prvResetNextTaskUnblockTime( void ) BaseType_t xYieldCurrentTask; /* Get the xYieldPending stats inside the critical section. */ - #if ( portUSING_GRANULAR_LOCKS == 1 ) + #if ( configUSE_TASK_PREEMPTION_DISABLE == 1 ) xYieldCurrentTask = xTaskUnlockCanYield(); #else xYieldCurrentTask = xYieldPendings[ xCoreID ]; - #endif /* #if ( portUSING_GRANULAR_LOCKS == 1 ) */ + #endif /* configUSE_TASK_PREEMPTION_DISABLE */ kernelRELEASE_ISR_LOCK( xCoreID ); kernelRELEASE_TASK_LOCK( xCoreID );