diff --git a/portable/CMakeLists.txt b/portable/CMakeLists.txt index 819e2c116..553397589 100644 --- a/portable/CMakeLists.txt +++ b/portable/CMakeLists.txt @@ -798,8 +798,8 @@ target_include_directories(freertos_kernel_port_headers INTERFACE $<$:${CMAKE_CURRENT_LIST_DIR}/GCC/ARM_CA9> # ARMv8-A ports for GCC - $<$:${CMAKE_CURRENT_LIST_DIR}/GCC/Arm_AARCH64> - $<$:${CMAKE_CURRENT_LIST_DIR}/GCC/Arm_AARCH64_SRE> + $<$:${CMAKE_CURRENT_LIST_DIR}/GCC/ARM_AARCH64> + $<$:${CMAKE_CURRENT_LIST_DIR}/GCC/ARM_AARCH64_SRE> # ARMv6-M port for GCC $<$:${CMAKE_CURRENT_LIST_DIR}/GCC/ARM_CM0> diff --git a/portable/Common/mpu_wrappers_v2.c b/portable/Common/mpu_wrappers_v2.c index 2dc36b33b..96f7734f1 100644 --- a/portable/Common/mpu_wrappers_v2.c +++ b/portable/Common/mpu_wrappers_v2.c @@ -3838,27 +3838,16 @@ BaseType_t xReturn = pdFALSE; TimerHandle_t xInternalTimerHandle = NULL; int32_t lIndex; - BaseType_t xIsHigherPriorityTaskWokenWriteable = pdFALSE; - if( pxHigherPriorityTaskWoken != NULL ) + lIndex = ( int32_t ) xTimer; + + if( IS_EXTERNAL_INDEX_VALID( lIndex ) != pdFALSE ) { - xIsHigherPriorityTaskWokenWriteable = xPortIsAuthorizedToAccessBuffer( pxHigherPriorityTaskWoken, - sizeof( BaseType_t ), - tskMPU_WRITE_PERMISSION ); - } + xInternalTimerHandle = MPU_GetTimerHandleAtIndex( CONVERT_TO_INTERNAL_INDEX( lIndex ) ); - if( ( pxHigherPriorityTaskWoken == NULL ) || ( xIsHigherPriorityTaskWokenWriteable == pdTRUE ) ) - { - lIndex = ( int32_t ) xTimer; - - if( IS_EXTERNAL_INDEX_VALID( lIndex ) != pdFALSE ) + if( xInternalTimerHandle != NULL ) { - xInternalTimerHandle = MPU_GetTimerHandleAtIndex( CONVERT_TO_INTERNAL_INDEX( lIndex ) ); - - if( xInternalTimerHandle != NULL ) - { - xReturn = xTimerGenericCommandFromISR( xInternalTimerHandle, xCommandID, xOptionalValue, pxHigherPriorityTaskWoken, xTicksToWait ); - } + xReturn = xTimerGenericCommandFromISR( xInternalTimerHandle, xCommandID, xOptionalValue, pxHigherPriorityTaskWoken, xTicksToWait ); } } diff --git a/portable/MemMang/heap_4.c b/portable/MemMang/heap_4.c index d1021ea09..f3cab000d 100644 --- a/portable/MemMang/heap_4.c +++ b/portable/MemMang/heap_4.c @@ -308,7 +308,7 @@ void * pvPortMalloc( size_t xWantedSize ) /* The block is being returned - it is allocated and owned * by the application and has no "next" block. */ heapALLOCATE_BLOCK( pxBlock ); - pxBlock->pxNextFreeBlock = NULL; + pxBlock->pxNextFreeBlock = heapPROTECT_BLOCK_POINTER( NULL ); xNumberOfSuccessfulAllocations++; } else @@ -367,11 +367,11 @@ void vPortFree( void * pv ) heapVALIDATE_BLOCK_POINTER( pxLink ); configASSERT( heapBLOCK_IS_ALLOCATED( pxLink ) != 0 ); - configASSERT( pxLink->pxNextFreeBlock == NULL ); + configASSERT( pxLink->pxNextFreeBlock == heapPROTECT_BLOCK_POINTER( NULL ) ); if( heapBLOCK_IS_ALLOCATED( pxLink ) != 0 ) { - if( pxLink->pxNextFreeBlock == NULL ) + if( pxLink->pxNextFreeBlock == heapPROTECT_BLOCK_POINTER( NULL ) ) { /* The block is being returned to the heap - it is no longer * allocated. */ diff --git a/portable/MemMang/heap_5.c b/portable/MemMang/heap_5.c index e0c566640..fccf79825 100644 --- a/portable/MemMang/heap_5.c +++ b/portable/MemMang/heap_5.c @@ -336,7 +336,7 @@ void * pvPortMalloc( size_t xWantedSize ) /* The block is being returned - it is allocated and owned * by the application and has no "next" block. */ heapALLOCATE_BLOCK( pxBlock ); - pxBlock->pxNextFreeBlock = NULL; + pxBlock->pxNextFreeBlock = heapPROTECT_BLOCK_POINTER( NULL ); xNumberOfSuccessfulAllocations++; } else @@ -395,11 +395,11 @@ void vPortFree( void * pv ) heapVALIDATE_BLOCK_POINTER( pxLink ); configASSERT( heapBLOCK_IS_ALLOCATED( pxLink ) != 0 ); - configASSERT( pxLink->pxNextFreeBlock == NULL ); + configASSERT( pxLink->pxNextFreeBlock == heapPROTECT_BLOCK_POINTER( NULL ) ); if( heapBLOCK_IS_ALLOCATED( pxLink ) != 0 ) { - if( pxLink->pxNextFreeBlock == NULL ) + if( pxLink->pxNextFreeBlock == heapPROTECT_BLOCK_POINTER( NULL ) ) { /* The block is being returned to the heap - it is no longer * allocated. */ diff --git a/tasks.c b/tasks.c index d60673a10..1e1a26970 100644 --- a/tasks.c +++ b/tasks.c @@ -3031,11 +3031,6 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, { TCB_t * pxTCB; BaseType_t xCoreID; - UBaseType_t uxPrevCoreAffinityMask; - - #if ( configUSE_PREEMPTION == 1 ) - UBaseType_t uxPrevNotAllowedCores; - #endif traceENTER_vTaskCoreAffinitySet( xTask, uxCoreAffinityMask ); @@ -3043,7 +3038,6 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, { pxTCB = prvGetTCBFromHandle( xTask ); - uxPrevCoreAffinityMask = pxTCB->uxCoreAffinityMask; pxTCB->uxCoreAffinityMask = uxCoreAffinityMask; if( xSchedulerRunning != pdFALSE ) @@ -3063,17 +3057,14 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, { #if ( configUSE_PREEMPTION == 1 ) { - /* Calculate the cores on which this task was not allowed to - * run previously. */ - uxPrevNotAllowedCores = ( ~uxPrevCoreAffinityMask ) & ( ( 1U << configNUMBER_OF_CORES ) - 1U ); - - /* Does the new core mask enables this task to run on any of the - * previously not allowed cores? If yes, check if this task can be - * scheduled on any of those cores. */ - if( ( uxPrevNotAllowedCores & uxCoreAffinityMask ) != 0U ) - { - prvYieldForTask( pxTCB ); - } + /* The SMP scheduler requests a core to yield when a ready + * task is able to run. It is possible that the core affinity + * of the ready task is changed before the requested core + * can select it to run. In that case, the task may not be + * selected by the previously requested core due to core affinity + * constraint and the SMP scheduler must select a new core to + * yield for the task. */ + prvYieldForTask( xTask ); } #else /* #if( configUSE_PREEMPTION == 1 ) */ {