Forráskód Böngészése

refactor(freertos): Remove portCLEAN_UP_COPROC()

portCLEAN_UP_COPROC() was an IDF specific addition to FreeRTOS, where the
macro was called from prvDeleteTCB() to clean up the coprocessor context of a
deleted task.

This commit removes portCLEAN_UP_COPROC(). The coprocessor cleanup routine
(i.e., vPortCleanUpCoprocArea()) is now called via portCLEAN_UP_TCB()->
vPortTCBPreDeleteHook().

This removes a minor code difference between IDF FreeRTOS and upstream.
Darian Leung 2 éve
szülő
commit
5f2443b7d1

+ 0 - 7
components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h

@@ -647,13 +647,6 @@ FORCE_INLINE_ATTR BaseType_t xPortGetCoreID(void)
  * - These are not part of the FreeRTOS porting interface, but are used by other FreeRTOS dependent components
  * ------------------------------------------------------------------------------------------------------------------ */
 
-// -------------------- Co-Processor -----------------------
-
-#if XCHAL_CP_NUM > 0
-void vPortCleanUpCoprocArea(void *pvTCB);
-#define portCLEAN_UP_COPROC(pvTCB)      vPortCleanUpCoprocArea(pvTCB)
-#endif
-
 // -------------------- Heap Related -----------------------
 
 /**

+ 23 - 21
components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c

@@ -607,6 +607,25 @@ void vPortSetStackWatchpoint( void *pxStackStart )
 
 // --------------------- TCB Cleanup -----------------------
 
+#if ( XCHAL_CP_NUM > 0 )
+static void vPortCleanUpCoprocArea(void *pvTCB)
+{
+    UBaseType_t uxCoprocArea;
+    BaseType_t xTargetCoreID;
+
+    /* Get a pointer to the task's coprocessor save area */
+    uxCoprocArea = ( UBaseType_t ) ( ( ( StaticTask_t * ) pvTCB )->pxDummy8 );  /* Get TCB_t.pxEndOfStack */
+    uxCoprocArea = STACKPTR_ALIGN_DOWN(16, uxCoprocArea - XT_CP_SIZE);
+
+    /* Get xTargetCoreID from the TCB.xCoreID */
+    xTargetCoreID = ( ( StaticTask_t * ) pvTCB )->xDummyCoreID;
+
+    /* If task has live floating point registers somewhere, release them */
+    void _xt_coproc_release(volatile void *coproc_sa_base, BaseType_t xTargetCoreID);
+    _xt_coproc_release( (void *)uxCoprocArea, xTargetCoreID );
+}
+#endif /* XCHAL_CP_NUM > 0 */
+
 void vPortTCBPreDeleteHook( void *pxTCB )
 {
     #if ( CONFIG_FREERTOS_TASK_PRE_DELETION_HOOK )
@@ -624,26 +643,9 @@ void vPortTCBPreDeleteHook( void *pxTCB )
         extern void vPortCleanUpTCB( void * pxTCB );
         vPortCleanUpTCB( pxTCB );
     #endif /* CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP */
-}
 
-// -------------------- Co-Processor -----------------------
-
-#if XCHAL_CP_NUM > 0
-void _xt_coproc_release(volatile void *coproc_sa_base, BaseType_t xTargetCoreID);
-
-void vPortCleanUpCoprocArea(void *pvTCB)
-{
-    UBaseType_t uxCoprocArea;
-    BaseType_t xTargetCoreID;
-
-    /* Get a pointer to the task's coprocessor save area */
-    uxCoprocArea = ( UBaseType_t ) ( ( ( StaticTask_t * ) pvTCB )->pxDummy8 );  /* Get TCB_t.pxEndOfStack */
-    uxCoprocArea = STACKPTR_ALIGN_DOWN(16, uxCoprocArea - XT_CP_SIZE);
-
-    /* Get xTargetCoreID from the TCB.xCoreID */
-    xTargetCoreID = ( ( StaticTask_t * ) pvTCB )->xDummyCoreID;
-
-    /* If task has live floating point registers somewhere, release them */
-    _xt_coproc_release( (void *)uxCoprocArea, xTargetCoreID );
+    #if ( XCHAL_CP_NUM > 0 )
+        /* Cleanup coproc save area */
+        vPortCleanUpCoprocArea( pxTCB );
+    #endif /* XCHAL_CP_NUM > 0 */
 }
-#endif /* XCHAL_CP_NUM > 0 */

+ 0 - 4
components/freertos/FreeRTOS-Kernel/tasks.c

@@ -4951,10 +4951,6 @@ BaseType_t xTaskGetAffinity( TaskHandle_t xTask )
             vPortReleaseTaskMPUSettings( &( pxTCB->xMPUSettings ) );
         #endif
 
-        #ifdef portCLEAN_UP_COPROC
-            portCLEAN_UP_COPROC( ( void * ) pxTCB );
-        #endif
-
         #if ( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 0 ) && ( portUSING_MPU_WRAPPERS == 0 ) )
             {
                 /* The task can only have been allocated dynamically - free both

+ 3 - 1
components/freertos/linker.lf

@@ -233,9 +233,10 @@ entries:
             port:xPortStartScheduler (default)
             port:vPortEndScheduler (default)
             port:pxPortInitialiseStack (default)
+            port:xPortGetTickRateHz (default)
             if IDF_TARGET_ESP32 = y || IDF_TARGET_ESP32S3 = y :
                 port:vPortCleanUpCoprocArea (default)
-            port:xPortGetTickRateHz (default)
+            port:vPortTCBPreDeleteHook (default)
         # --------------------------------------------------------------------------------------------------------------
         # portable/riscv/port.c
         # - Most functions are called from an ISR context, except for scheduler/task init/deinit functions
@@ -245,3 +246,4 @@ entries:
             port:vPortEndScheduler (default)
             port:pxPortInitialiseStack (default)
             port:xPortGetTickRateHz (default)
+            port:vPortTCBPreDeleteHook (default)