diff --git a/components/freertos/FreeRTOS-Kernel-SMP/portable/linux/port.c b/components/freertos/FreeRTOS-Kernel-SMP/portable/linux/port.c index 569349f46b..c3944ae970 100644 --- a/components/freertos/FreeRTOS-Kernel-SMP/portable/linux/port.c +++ b/components/freertos/FreeRTOS-Kernel-SMP/portable/linux/port.c @@ -820,6 +820,12 @@ void vPortTLSPointersDelCb( void *pxTCB ) void vPortCleanUpTCB ( 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_TLSP_DELETION_CALLBACKS ) /* Call TLS pointers deletion callbacks */ vPortTLSPointersDelCb( pxTCB ); diff --git a/components/freertos/FreeRTOS-Kernel-SMP/portable/riscv/include/freertos/portmacro.h b/components/freertos/FreeRTOS-Kernel-SMP/portable/riscv/include/freertos/portmacro.h index 26202a36fd..e238498ec8 100644 --- a/components/freertos/FreeRTOS-Kernel-SMP/portable/riscv/include/freertos/portmacro.h +++ b/components/freertos/FreeRTOS-Kernel-SMP/portable/riscv/include/freertos/portmacro.h @@ -173,9 +173,6 @@ static inline BaseType_t __attribute__((always_inline)) xPortGetCoreID( void ); * 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 ); diff --git a/components/freertos/FreeRTOS-Kernel-SMP/portable/riscv/port.c b/components/freertos/FreeRTOS-Kernel-SMP/portable/riscv/port.c index 1ba9ec0a9a..914964fa00 100644 --- a/components/freertos/FreeRTOS-Kernel-SMP/portable/riscv/port.c +++ b/components/freertos/FreeRTOS-Kernel-SMP/portable/riscv/port.c @@ -270,16 +270,6 @@ void vPortTCBPreDeleteHook( 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 */ - #if ( CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS ) /* Call TLS pointers deletion callbacks */ vPortTLSPointersDelCb( pxTCB ); diff --git a/components/freertos/FreeRTOS-Kernel-SMP/portable/xtensa/include/freertos/portmacro.h b/components/freertos/FreeRTOS-Kernel-SMP/portable/xtensa/include/freertos/portmacro.h index 9e8bcf6b28..d29389c457 100644 --- a/components/freertos/FreeRTOS-Kernel-SMP/portable/xtensa/include/freertos/portmacro.h +++ b/components/freertos/FreeRTOS-Kernel-SMP/portable/xtensa/include/freertos/portmacro.h @@ -143,9 +143,6 @@ static inline BaseType_t __attribute__((always_inline)) xPortGetCoreID( void ); * 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 ); diff --git a/components/freertos/FreeRTOS-Kernel-SMP/portable/xtensa/port.c b/components/freertos/FreeRTOS-Kernel-SMP/portable/xtensa/port.c index 12f8ad6bd0..a9dbaaebe8 100644 --- a/components/freertos/FreeRTOS-Kernel-SMP/portable/xtensa/port.c +++ b/components/freertos/FreeRTOS-Kernel-SMP/portable/xtensa/port.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -296,16 +296,6 @@ void vPortTCBPreDeleteHook( 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 */ - #if ( CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS ) /* Call TLS pointers deletion callbacks */ vPortTLSPointersDelCb( pxTCB ); diff --git a/components/freertos/FreeRTOS-Kernel/portable/linux/include/freertos/portmacro_idf.h b/components/freertos/FreeRTOS-Kernel/portable/linux/include/freertos/portmacro_idf.h index bf1724c374..ebd8e730f8 100644 --- a/components/freertos/FreeRTOS-Kernel/portable/linux/include/freertos/portmacro_idf.h +++ b/components/freertos/FreeRTOS-Kernel/portable/linux/include/freertos/portmacro_idf.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -115,12 +115,6 @@ static inline void vPortAssertIfInISR(void) */ #define portASSERT_IF_IN_ISR() vPortAssertIfInISR() -#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 */ - #ifdef __cplusplus } #endif diff --git a/components/freertos/FreeRTOS-Kernel/portable/linux/port.c b/components/freertos/FreeRTOS-Kernel/portable/linux/port.c index d79d423525..436017b211 100644 --- a/components/freertos/FreeRTOS-Kernel/portable/linux/port.c +++ b/components/freertos/FreeRTOS-Kernel/portable/linux/port.c @@ -6,7 +6,7 @@ * * SPDX-License-Identifier: MIT * - * SPDX-FileContributor: 2023-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileContributor: 2023-2025 Espressif Systems (Shanghai) CO LTD * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in @@ -422,6 +422,12 @@ void vPortThreadDying( void *pxTaskToDelete, volatile BaseType_t *pxPendYield ) void vPortCancelThread( void *pxTaskToDelete ) { + #if ( CONFIG_FREERTOS_TASK_PRE_DELETION_HOOK ) + /* Call the user defined task pre-deletion hook before canceling the thread */ + extern void vTaskPreDeletionHook( void * pxTCB ); + vTaskPreDeletionHook( pxTaskToDelete ); + #endif /* CONFIG_FREERTOS_TASK_PRE_DELETION_HOOK */ + Thread_t *pxThreadToCancel = prvGetThreadFromTask( pxTaskToDelete ); /* diff --git a/components/freertos/FreeRTOS-Kernel/portable/riscv/include/freertos/portmacro.h b/components/freertos/FreeRTOS-Kernel/portable/riscv/include/freertos/portmacro.h index f1b0257d54..56939101fe 100644 --- a/components/freertos/FreeRTOS-Kernel/portable/riscv/include/freertos/portmacro.h +++ b/components/freertos/FreeRTOS-Kernel/portable/riscv/include/freertos/portmacro.h @@ -450,9 +450,6 @@ FORCE_INLINE_ATTR BaseType_t xPortGetCoreID(void) * 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 ); diff --git a/components/freertos/FreeRTOS-Kernel/portable/riscv/port.c b/components/freertos/FreeRTOS-Kernel/portable/riscv/port.c index 449e7af8d6..902e761d7a 100644 --- a/components/freertos/FreeRTOS-Kernel/portable/riscv/port.c +++ b/components/freertos/FreeRTOS-Kernel/portable/riscv/port.c @@ -736,16 +736,6 @@ void vPortTCBPreDeleteHook( 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 */ - #if ( CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS ) /* Call TLS pointers deletion callbacks */ vPortTLSPointersDelCb( pxTCB ); diff --git a/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h b/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h index 4a5b0fb87d..53a35e0dfb 100644 --- a/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h +++ b/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h @@ -386,9 +386,6 @@ FORCE_INLINE_ATTR BaseType_t xPortGetCoreID(void); * 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 ); diff --git a/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c b/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c index 658b8dff3f..7f75dc241a 100644 --- a/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c +++ b/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c @@ -8,7 +8,7 @@ * * SPDX-License-Identifier: MIT * - * SPDX-FileContributor: 2023-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileContributor: 2023-2025 Espressif Systems (Shanghai) CO LTD * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in @@ -649,16 +649,6 @@ void vPortTCBPreDeleteHook( 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 */ - #if ( CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS ) /* Call TLS pointers deletion callbacks */ vPortTLSPointersDelCb( pxTCB ); diff --git a/components/freertos/Kconfig b/components/freertos/Kconfig index 8c874070e8..021e01d5e2 100644 --- a/components/freertos/Kconfig +++ b/components/freertos/Kconfig @@ -405,10 +405,7 @@ menu "FreeRTOS" off to save space in the TCB memory. config FREERTOS_TASK_PRE_DELETION_HOOK - # This option is a replacement for FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP (which is now deprecated). If the - # deprecated option is defined, we hide this option to avoid multiple pre-deletion hooks from running. bool "Enable task pre-deletion hook" - depends on !FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP default n help Enable this option to make FreeRTOS call a user provided hook function right before it deletes a task @@ -418,18 +415,6 @@ menu "FreeRTOS" If this config option is enabled, users must define a ``void vTaskPreDeletionHook( void * pxTCB )`` hook function in their application. - config FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP - # This option is deprecated (replaced by FREERTOS_TASK_PRE_DELETION_HOOK) but still exists to maintain - # compatibility. Todo: Remove by v6.0 (see IDF-8097). - bool "Enable static task clean up hook (DEPRECATED)" - default n - help - THIS OPTION IS DEPRECATED. Use FREERTOS_TASK_PRE_DELETION_HOOK instead. - - Enable this option to make FreeRTOS call the static task clean up hook when a task is deleted. - - Note: Users will need to provide a ``void vPortCleanUpTCB ( void *pxTCB )`` callback - config FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER # This feature is innately supported in FreeRTOS SMP, and hence not available as a config option when # FreeRTOS SMP is enabled. diff --git a/components/freertos/sdkconfig.rename b/components/freertos/sdkconfig.rename index da4c466482..718c2a777e 100644 --- a/components/freertos/sdkconfig.rename +++ b/components/freertos/sdkconfig.rename @@ -1,7 +1,7 @@ # sdkconfig replacement configurations for deprecated options formatted as # CONFIG_DEPRECATED_OPTION CONFIG_NEW_OPTION -CONFIG_ENABLE_STATIC_TASK_CLEAN_UP_HOOK CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP +CONFIG_ENABLE_STATIC_TASK_CLEAN_UP_HOOK CONFIG_FREERTOS_TASK_PRE_DELETION_HOOK CONFIG_TIMER_TASK_PRIORITY CONFIG_FREERTOS_TIMER_TASK_PRIORITY CONFIG_TIMER_TASK_STACK_DEPTH CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH CONFIG_TIMER_QUEUE_LENGTH CONFIG_FREERTOS_TIMER_QUEUE_LENGTH diff --git a/tools/idf_py_actions/hints.yml b/tools/idf_py_actions/hints.yml index 349f646254..4ea5775630 100644 --- a/tools/idf_py_actions/hints.yml +++ b/tools/idf_py_actions/hints.yml @@ -567,3 +567,11 @@ - re_variables: ['xTaskNotifyWait'] hint_variables: ['xTaskNotifyWait', 'the macro xTaskNotifyWait'] + +- + re: "(no previous prototype for 'vTaskPreDeletionHook'|undefined reference to `vTaskPreDeletionHook')" + hint: "CONFIG_FREERTOS_TASK_PRE_DELETION_HOOK is enabled but your project does not provide vTaskPreDeletionHook( void * pxTCB ). Either disable the Kconfig option or implement the hook." + +- + re: "error: implicit declaration of function 'vPortCleanUpTCB'" + hint: "The legacy FreeRTOS hook vPortCleanUpTCB() has been removed from ESP-IDF. Use CONFIG_FREERTOS_TASK_PRE_DELETION_HOOK with vTaskPreDeletionHook( void * pxTCB ) instead."