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:
Darian Leung
2023-08-23 17:50:08 +08:00
parent 9d8b121ef2
commit 39cf3638ae
15 changed files with 275 additions and 216 deletions
+2 -2
View File
@@ -219,7 +219,7 @@ entries:
port:vPortCleanUpCoprocArea (default)
if FREERTOS_TLSP_DELETION_CALLBACKS = y:
port:vPortTLSPointersDelCb (default)
port:vPortCleanUpTCB (default)
port:vPortTCBPreDeleteHook (default)
# --------------------------------------------------------------------------------------------------------------
# portable/riscv/port.c
# - Most functions are called from an ISR context, except for scheduler/task init/deinit functions
@@ -234,4 +234,4 @@ entries:
port:pxPortInitialiseStack (default)
if FREERTOS_TLSP_DELETION_CALLBACKS = y:
port:vPortTLSPointersDelCb (default)
port:vPortCleanUpTCB (default)
port:vPortTCBPreDeleteHook (default)