mirror of
https://github.com/espressif/esp-idf.git
synced 2025-12-07 17:08:49 +00:00
change(freertos): Deprecate usage of vPortCleanUpTCB() by applications
Previously, if CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP was enabled, users would provide a definition for a vPortCleanUpTCB() hook function that is called right before a task's memory is freed in prvDeleteTCB(). However, vPortCleanUpTCB() will be reclaimed by ESP-IDF for internal use in v6.0. This commit introduces the following changes... Introduced a new CONFIG_FREERTOS_TASK_PRE_DELETION_HOOK option: - Provides the same pre-deletion hook functionality. But users now define vTaskPreDeletionHook() instead. - CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP still exists, but is marked as deprecated. This is to maintain compatibility with existing applications that already define vPortCleanUpTCB(). - Removed redundant --wl --wrap workaround with vPortCleanUpTCB() - Added todo notes to remove support for user defined vPortCleanUpTCB() completely in v6.0. - Updated test cases to use new CONFIG_FREERTOS_TASK_PRE_DELETION_HOOK option Freed up portCLEAN_UP_TCB() to call a new internal vPortTCBPreDeleteHook(): - vPortTCBPreDeleteHook() now replaces the previous "wrapped" implementation of vPortCleanUpTCB(). - vPortTCBPreDeleteHook() is an internal task pre-delete hook for IDF FreeRTOS ports to inject some pre-deletion operations. - Internal pre-delete hook now invokes user provided vTaskPreDeletionHook() if enabled. - Relocated vPortTCBPreDeleteHook() to correct section in port.c
This commit is contained in:
@@ -427,7 +427,19 @@ FORCE_INLINE_ATTR BaseType_t xPortGetCoreID(void)
|
||||
return (BaseType_t) esp_cpu_get_core_id();
|
||||
}
|
||||
|
||||
// --------------------- TCB Cleanup -----------------------
|
||||
|
||||
/**
|
||||
* @brief TCB cleanup hook
|
||||
*
|
||||
* The portCLEAN_UP_TCB() macro is called in prvDeleteTCB() right before a
|
||||
* deleted task's memory is freed. We map that macro to this internal function
|
||||
* so that IDF FreeRTOS ports can inject some task pre-deletion operations.
|
||||
*
|
||||
* @note We can't use vPortCleanUpTCB() due to API compatibility issues. See
|
||||
* CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP. Todo: IDF-8097
|
||||
*/
|
||||
void vPortTCBPreDeleteHook( void *pxTCB );
|
||||
|
||||
/* ------------------------------------------- FreeRTOS Porting Interface ----------------------------------------------
|
||||
* - Contains all the mappings of the macros required by FreeRTOS
|
||||
@@ -561,11 +573,7 @@ FORCE_INLINE_ATTR BaseType_t xPortGetCoreID(void)
|
||||
|
||||
// --------------------- TCB Cleanup -----------------------
|
||||
|
||||
#if CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP
|
||||
/* If enabled, users must provide an implementation of vPortCleanUpTCB() */
|
||||
extern void vPortCleanUpTCB ( void *pxTCB );
|
||||
#define portCLEAN_UP_TCB( pxTCB ) vPortCleanUpTCB( pxTCB )
|
||||
#endif /* CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP */
|
||||
#define portCLEAN_UP_TCB( pxTCB ) vPortTCBPreDeleteHook( pxTCB )
|
||||
|
||||
// -------------- Optimized Task Selection -----------------
|
||||
|
||||
|
||||
@@ -589,7 +589,26 @@ void vPortSetStackWatchpoint(void *pxStackStart)
|
||||
esp_cpu_set_watchpoint(STACK_WATCH_POINT_NUMBER, (char *)addr, STACK_WATCH_AREA_SIZE, ESP_CPU_WATCHPOINT_STORE);
|
||||
}
|
||||
|
||||
// --------------------- TCB Cleanup -----------------------
|
||||
|
||||
void vPortTCBPreDeleteHook( void *pxTCB )
|
||||
{
|
||||
#if ( CONFIG_FREERTOS_TASK_PRE_DELETION_HOOK )
|
||||
/* Call the user defined task pre-deletion hook */
|
||||
extern void vTaskPreDeletionHook( void * pxTCB );
|
||||
vTaskPreDeletionHook( pxTCB );
|
||||
#endif /* CONFIG_FREERTOS_TASK_PRE_DELETION_HOOK */
|
||||
|
||||
#if ( CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP )
|
||||
/*
|
||||
* If the user is using the legacy task pre-deletion hook, call it.
|
||||
* Todo: Will be removed in IDF-8097
|
||||
*/
|
||||
#warning "CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP is deprecated. Use CONFIG_FREERTOS_TASK_PRE_DELETION_HOOK instead."
|
||||
extern void vPortCleanUpTCB( void * pxTCB );
|
||||
vPortCleanUpTCB( pxTCB );
|
||||
#endif /* CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP */
|
||||
}
|
||||
|
||||
/* ---------------------------------------------- Misc Implementations -------------------------------------------------
|
||||
*
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* SPDX-FileContributor: 2016-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileContributor: 2016-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*/
|
||||
/*
|
||||
* FreeRTOS Kernel V10.4.3
|
||||
@@ -406,6 +406,19 @@ void vPortSetStackWatchpoint( void *pxStackStart );
|
||||
*/
|
||||
FORCE_INLINE_ATTR BaseType_t xPortGetCoreID(void);
|
||||
|
||||
// --------------------- TCB Cleanup -----------------------
|
||||
|
||||
/**
|
||||
* @brief TCB cleanup hook
|
||||
*
|
||||
* The portCLEAN_UP_TCB() macro is called in prvDeleteTCB() right before a
|
||||
* deleted task's memory is freed. We map that macro to this internal function
|
||||
* so that IDF FreeRTOS ports can inject some task pre-deletion operations.
|
||||
*
|
||||
* @note We can't use vPortCleanUpTCB() due to API compatibility issues. See
|
||||
* CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP. Todo: IDF-8097
|
||||
*/
|
||||
void vPortTCBPreDeleteHook( void *pxTCB );
|
||||
|
||||
|
||||
/* ------------------------------------------- FreeRTOS Porting Interface ----------------------------------------------
|
||||
@@ -525,11 +538,7 @@ extern void _frxt_setup_switch( void ); //Defined in portasm.S
|
||||
|
||||
// --------------------- TCB Cleanup -----------------------
|
||||
|
||||
#if CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP
|
||||
/* If enabled, users must provide an implementation of vPortCleanUpTCB() */
|
||||
extern void vPortCleanUpTCB ( void *pxTCB );
|
||||
#define portCLEAN_UP_TCB( pxTCB ) vPortCleanUpTCB( pxTCB )
|
||||
#endif /* CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP */
|
||||
#define portCLEAN_UP_TCB( pxTCB ) vPortTCBPreDeleteHook( pxTCB )
|
||||
|
||||
// -------------- Optimized Task Selection -----------------
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* SPDX-FileContributor: 2016-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileContributor: 2016-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*/
|
||||
/*
|
||||
* FreeRTOS Kernel V10.4.3
|
||||
@@ -605,6 +605,27 @@ void vPortSetStackWatchpoint( void *pxStackStart )
|
||||
esp_cpu_set_watchpoint(STACK_WATCH_POINT_NUMBER, (char *)addr, 32, ESP_CPU_WATCHPOINT_STORE);
|
||||
}
|
||||
|
||||
// --------------------- TCB Cleanup -----------------------
|
||||
|
||||
void vPortTCBPreDeleteHook( void *pxTCB )
|
||||
{
|
||||
#if ( CONFIG_FREERTOS_TASK_PRE_DELETION_HOOK )
|
||||
/* Call the user defined task pre-deletion hook */
|
||||
extern void vTaskPreDeletionHook( void * pxTCB );
|
||||
vTaskPreDeletionHook( pxTCB );
|
||||
#endif /* CONFIG_FREERTOS_TASK_PRE_DELETION_HOOK */
|
||||
|
||||
#if ( CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP )
|
||||
/*
|
||||
* If the user is using the legacy task pre-deletion hook, call it.
|
||||
* Todo: Will be removed in IDF-8097
|
||||
*/
|
||||
#warning "CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP is deprecated. Use CONFIG_FREERTOS_TASK_PRE_DELETION_HOOK instead."
|
||||
extern void vPortCleanUpTCB( void * pxTCB );
|
||||
vPortCleanUpTCB( pxTCB );
|
||||
#endif /* CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP */
|
||||
}
|
||||
|
||||
// -------------------- Co-Processor -----------------------
|
||||
|
||||
#if XCHAL_CP_NUM > 0
|
||||
|
||||
Reference in New Issue
Block a user