refactor(freertos): Call TLSP deletion callback from portCLEAN_UP_TCB()

Previously, TLSP deletion callbacks were...

- Stored in a seprate TCB member "pvThreadLocalStoragePointersDelCallback"
- Called separately via multipole prvDeleteTLS() insertions in tasks.c

This commit refactors how TLSP deletion callbacks are stored and called:

- TLSP deletion callbacks are now stored in "pvThreadLocalStoragePointers"
directly. configNUM_THREAD_LOCAL_STORAGE_POINTERS is doubled in size so that
the deletion callbacks are stored in the latter half of the array

- The callbacks are now called via "portCLEAN_UP_TCB()". As such, the
prvDeleteTLS() additions are no longer needed and the function can be removed

- Removed some legacy TLSP tests using the old method of storing the callback
pointers.

This commit reduces the source code diff between IDF FreeRTOS and upstream
vanilla FreeRTOS, in preparation for v10.5.1 upgrade.
This commit is contained in:
Darian Leung
2023-08-23 00:45:54 +08:00
parent 5f2443b7d1
commit 57eb41ce83
8 changed files with 97 additions and 185 deletions

View File

@@ -109,15 +109,16 @@
#define configMAX_TASK_NAME_LEN CONFIG_FREERTOS_MAX_TASK_NAME_LEN
/* The distinciton between Amazon SMP FreeRTOS and IDF FreeRTOS is necessary because in IDF FreeRTOS,
* TLSP deletion callbacks can be added directly to the TCB, which is not allowed in Amazon SMP FreeRTOS.
* In the latter, the TLSP number is simply doubled to accomodate space for a deletion callback of each TLSP.
*/
#if CONFIG_FREERTOS_SMP
/* If deletion callbacks are enabled, the number of TLSP's are doubled (i.e.,
* the length of the TCB's pvThreadLocalStoragePointersThis array). This allows
* the latter half of the array to store the deletion callback pointers (whereas
* the first half stores the TLSPs themselves). */
#if CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS ( CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS * 2 )
#else /* CONFIG_FREERTOS_SMP */
#else /* CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS */
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS
#endif /* CONFIG_FREERTOS_SMP */
#endif /* CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS */
#define configSTACK_DEPTH_TYPE uint32_t
#if CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY
#define configENABLE_BACKWARD_COMPATIBILITY 1