feat(freertos): Add xTaskGetStackStart and deprecate pxTaskGetStackStart

The following changes have been made:
- Add new xTaskGetStackStart() function with proper StackType_t* return type
- Deprecate pxTaskGetStackStart() with wrapper implementation for backward compatibility
This commit is contained in:
Sudeep Mohanty
2025-07-04 16:53:52 +02:00
committed by Zhang Shuxian
parent 669939d786
commit 7b57540cc4
4 changed files with 30 additions and 7 deletions

View File

@@ -547,15 +547,18 @@ BaseType_t xTaskGetCoreID( TaskHandle_t xTask )
#endif /* ( !CONFIG_FREERTOS_SMP && ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) ) */
/*-----------------------------------------------------------*/
uint8_t * pxTaskGetStackStart( TaskHandle_t xTask )
StackType_t * xTaskGetStackStart( TaskHandle_t xTask )
{
TCB_t * pxTCB;
uint8_t * uxReturn;
pxTCB = prvGetTCBFromHandle( xTask );
uxReturn = ( uint8_t * ) pxTCB->pxStack;
return pxTCB->pxStack;
}
/*----------------------------------------------------------*/
return uxReturn;
uint8_t * pxTaskGetStackStart( TaskHandle_t xTask )
{
return (uint8_t *)xTaskGetStackStart( xTask );
}
/*----------------------------------------------------------*/

View File

@@ -195,14 +195,12 @@ BaseType_t xTaskGetCoreID( TaskHandle_t xTask );
* Returns the lowest stack memory address, regardless of whether the stack
* grows up or down.
*
* [refactor-todo] Change return type to StackType_t (IDF-8158)
*
* @param xTask Handle of the task associated with the stack returned.
* Set xTask to NULL to return the stack of the calling task.
*
* @return A pointer to the start of the stack.
*/
uint8_t * pxTaskGetStackStart( TaskHandle_t xTask );
StackType_t * xTaskGetStackStart( TaskHandle_t xTask );
/* --------------------------------------------- TLSP Deletion Callbacks -------------------------------------------- */
@@ -628,6 +626,16 @@ void vStreamBufferGenericDeleteWithCaps( StreamBufferHandle_t xStreamBuffer,
#endif /* configSUPPORT_STATIC_ALLOCATION == 1 */
/* --------------------------------------------------- Deprecated ------------------------------------------------------
* Deprecated IDF FreeRTOS API additions.
* Todo: Remove in v7.0 (IDF-13569)
* ------------------------------------------------------------------------------------------------------------------ */
/** @cond */
uint8_t * pxTaskGetStackStart( TaskHandle_t xTask ) __attribute__((deprecated("Use xTaskGetStackStart() for improved type safety")));
/** @endcond */
/* *INDENT-OFF* */
#ifdef __cplusplus
}

View File

@@ -60,8 +60,14 @@ Removed extra data buffering option. `CONFIG_APPTRACE_PENDING_DATA_SIZE_MAX` is
FreeRTOS
--------
**Removed Functions**
The following deprecated FreeRTOS functions have been removed in ESP-IDF v6.0:
- :cpp:func:`xTaskGetAffinity` - Use :cpp:func:`xTaskGetCoreID` instead
- :cpp:func:`xTaskGetIdleTaskHandleForCPU` - Use :cpp:func:`xTaskGetIdleTaskHandleForCore` instead
- :cpp:func:`xTaskGetCurrentTaskHandleForCPU` - Use :cpp:func:`xTaskGetCurrentTaskHandleForCore` instead
**Deprecated Functions**
The function :cpp:func:`pxTaskGetStackStart` has been deprecated. Use :cpp:func:`xTaskGetStackStart` instead for improved type safety.

View File

@@ -40,8 +40,14 @@ Xtensa 特殊寄存器头文件已更新,使用新的命名约定。旧的 ``s
FreeRTOS
--------
**已移除的函数**
以下已弃用的 FreeRTOS 函数已在 ESP-IDF v6.0 中移除:
- :cpp:func:`xTaskGetAffinity` - 请使用 :cpp:func:`xTaskGetCoreID` 替代
- :cpp:func:`xTaskGetIdleTaskHandleForCPU` - 请使用 :cpp:func:`xTaskGetIdleTaskHandleForCore` 替代
- :cpp:func:`xTaskGetCurrentTaskHandleForCPU` - 请使用 :cpp:func:`xTaskGetCurrentTaskHandleForCore` 替代
**已弃用的函数**
函数 :cpp:func:`pxTaskGetStackStart` 已被弃用。请使用 :cpp:func:`xTaskGetStackStart` 替代以提高类型安全性。