Skip to content

Commit cd0d09c

Browse files
authored
Merge branch 'main' into update-pxcurrentTCB
2 parents ba2306d + 23cfd11 commit cd0d09c

File tree

5 files changed

+21
-41
lines changed

5 files changed

+21
-41
lines changed

portable/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -798,8 +798,8 @@ target_include_directories(freertos_kernel_port_headers INTERFACE
798798
$<$<STREQUAL:${FREERTOS_PORT},GCC_ARM_CA9>:${CMAKE_CURRENT_LIST_DIR}/GCC/ARM_CA9>
799799

800800
# ARMv8-A ports for GCC
801-
$<$<STREQUAL:${FREERTOS_PORT},GCC_ARM_AARCH64>:${CMAKE_CURRENT_LIST_DIR}/GCC/Arm_AARCH64>
802-
$<$<STREQUAL:${FREERTOS_PORT},GCC_ARM_AARCH64_SRE>:${CMAKE_CURRENT_LIST_DIR}/GCC/Arm_AARCH64_SRE>
801+
$<$<STREQUAL:${FREERTOS_PORT},GCC_ARM_AARCH64>:${CMAKE_CURRENT_LIST_DIR}/GCC/ARM_AARCH64>
802+
$<$<STREQUAL:${FREERTOS_PORT},GCC_ARM_AARCH64_SRE>:${CMAKE_CURRENT_LIST_DIR}/GCC/ARM_AARCH64_SRE>
803803

804804
# ARMv6-M port for GCC
805805
$<$<STREQUAL:${FREERTOS_PORT},GCC_ARM_CM0>:${CMAKE_CURRENT_LIST_DIR}/GCC/ARM_CM0>

portable/Common/mpu_wrappers_v2.c

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3838,27 +3838,16 @@
38383838
BaseType_t xReturn = pdFALSE;
38393839
TimerHandle_t xInternalTimerHandle = NULL;
38403840
int32_t lIndex;
3841-
BaseType_t xIsHigherPriorityTaskWokenWriteable = pdFALSE;
38423841

3843-
if( pxHigherPriorityTaskWoken != NULL )
3844-
{
3845-
xIsHigherPriorityTaskWokenWriteable = xPortIsAuthorizedToAccessBuffer( pxHigherPriorityTaskWoken,
3846-
sizeof( BaseType_t ),
3847-
tskMPU_WRITE_PERMISSION );
3848-
}
3842+
lIndex = ( int32_t ) xTimer;
38493843

3850-
if( ( pxHigherPriorityTaskWoken == NULL ) || ( xIsHigherPriorityTaskWokenWriteable == pdTRUE ) )
3844+
if( IS_EXTERNAL_INDEX_VALID( lIndex ) != pdFALSE )
38513845
{
3852-
lIndex = ( int32_t ) xTimer;
3846+
xInternalTimerHandle = MPU_GetTimerHandleAtIndex( CONVERT_TO_INTERNAL_INDEX( lIndex ) );
38533847

3854-
if( IS_EXTERNAL_INDEX_VALID( lIndex ) != pdFALSE )
3848+
if( xInternalTimerHandle != NULL )
38553849
{
3856-
xInternalTimerHandle = MPU_GetTimerHandleAtIndex( CONVERT_TO_INTERNAL_INDEX( lIndex ) );
3857-
3858-
if( xInternalTimerHandle != NULL )
3859-
{
3860-
xReturn = xTimerGenericCommandFromISR( xInternalTimerHandle, xCommandID, xOptionalValue, pxHigherPriorityTaskWoken, xTicksToWait );
3861-
}
3850+
xReturn = xTimerGenericCommandFromISR( xInternalTimerHandle, xCommandID, xOptionalValue, pxHigherPriorityTaskWoken, xTicksToWait );
38623851
}
38633852
}
38643853

portable/MemMang/heap_4.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ void * pvPortMalloc( size_t xWantedSize )
308308
/* The block is being returned - it is allocated and owned
309309
* by the application and has no "next" block. */
310310
heapALLOCATE_BLOCK( pxBlock );
311-
pxBlock->pxNextFreeBlock = NULL;
311+
pxBlock->pxNextFreeBlock = heapPROTECT_BLOCK_POINTER( NULL );
312312
xNumberOfSuccessfulAllocations++;
313313
}
314314
else
@@ -367,11 +367,11 @@ void vPortFree( void * pv )
367367

368368
heapVALIDATE_BLOCK_POINTER( pxLink );
369369
configASSERT( heapBLOCK_IS_ALLOCATED( pxLink ) != 0 );
370-
configASSERT( pxLink->pxNextFreeBlock == NULL );
370+
configASSERT( pxLink->pxNextFreeBlock == heapPROTECT_BLOCK_POINTER( NULL ) );
371371

372372
if( heapBLOCK_IS_ALLOCATED( pxLink ) != 0 )
373373
{
374-
if( pxLink->pxNextFreeBlock == NULL )
374+
if( pxLink->pxNextFreeBlock == heapPROTECT_BLOCK_POINTER( NULL ) )
375375
{
376376
/* The block is being returned to the heap - it is no longer
377377
* allocated. */

portable/MemMang/heap_5.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ void * pvPortMalloc( size_t xWantedSize )
336336
/* The block is being returned - it is allocated and owned
337337
* by the application and has no "next" block. */
338338
heapALLOCATE_BLOCK( pxBlock );
339-
pxBlock->pxNextFreeBlock = NULL;
339+
pxBlock->pxNextFreeBlock = heapPROTECT_BLOCK_POINTER( NULL );
340340
xNumberOfSuccessfulAllocations++;
341341
}
342342
else
@@ -395,11 +395,11 @@ void vPortFree( void * pv )
395395

396396
heapVALIDATE_BLOCK_POINTER( pxLink );
397397
configASSERT( heapBLOCK_IS_ALLOCATED( pxLink ) != 0 );
398-
configASSERT( pxLink->pxNextFreeBlock == NULL );
398+
configASSERT( pxLink->pxNextFreeBlock == heapPROTECT_BLOCK_POINTER( NULL ) );
399399

400400
if( heapBLOCK_IS_ALLOCATED( pxLink ) != 0 )
401401
{
402-
if( pxLink->pxNextFreeBlock == NULL )
402+
if( pxLink->pxNextFreeBlock == heapPROTECT_BLOCK_POINTER( NULL ) )
403403
{
404404
/* The block is being returned to the heap - it is no longer
405405
* allocated. */

tasks.c

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3031,19 +3031,13 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
30313031
{
30323032
TCB_t * pxTCB;
30333033
BaseType_t xCoreID;
3034-
UBaseType_t uxPrevCoreAffinityMask;
3035-
3036-
#if ( configUSE_PREEMPTION == 1 )
3037-
UBaseType_t uxPrevNotAllowedCores;
3038-
#endif
30393034

30403035
traceENTER_vTaskCoreAffinitySet( xTask, uxCoreAffinityMask );
30413036

30423037
taskENTER_CRITICAL();
30433038
{
30443039
pxTCB = prvGetTCBFromHandle( xTask );
30453040

3046-
uxPrevCoreAffinityMask = pxTCB->uxCoreAffinityMask;
30473041
pxTCB->uxCoreAffinityMask = uxCoreAffinityMask;
30483042

30493043
if( xSchedulerRunning != pdFALSE )
@@ -3063,17 +3057,14 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
30633057
{
30643058
#if ( configUSE_PREEMPTION == 1 )
30653059
{
3066-
/* Calculate the cores on which this task was not allowed to
3067-
* run previously. */
3068-
uxPrevNotAllowedCores = ( ~uxPrevCoreAffinityMask ) & ( ( 1U << configNUMBER_OF_CORES ) - 1U );
3069-
3070-
/* Does the new core mask enables this task to run on any of the
3071-
* previously not allowed cores? If yes, check if this task can be
3072-
* scheduled on any of those cores. */
3073-
if( ( uxPrevNotAllowedCores & uxCoreAffinityMask ) != 0U )
3074-
{
3075-
prvYieldForTask( pxTCB );
3076-
}
3060+
/* The SMP scheduler requests a core to yield when a ready
3061+
* task is able to run. It is possible that the core affinity
3062+
* of the ready task is changed before the requested core
3063+
* can select it to run. In that case, the task may not be
3064+
* selected by the previously requested core due to core affinity
3065+
* constraint and the SMP scheduler must select a new core to
3066+
* yield for the task. */
3067+
prvYieldForTask( xTask );
30773068
}
30783069
#else /* #if( configUSE_PREEMPTION == 1 ) */
30793070
{

0 commit comments

Comments
 (0)