mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
change(freertos/debug): Add API to get current TCB
This commit adds `pvTaskGetCurrentTCBForCore()` to get a void pointer to the current TCB of a particular core. This removes the need to `extern `pxCurrentTCB` in esp_gdbstub.
This commit is contained in:
parent
2b357071f1
commit
65d3931fab
@ -11,6 +11,7 @@
|
|||||||
#include "rv_decode.h"
|
#include "rv_decode.h"
|
||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
#include "esp_private/crosscore_int.h"
|
#include "esp_private/crosscore_int.h"
|
||||||
|
#include "esp_private/freertos_debug.h"
|
||||||
|
|
||||||
extern volatile esp_gdbstub_frame_t *temp_regs_frame;
|
extern volatile esp_gdbstub_frame_t *temp_regs_frame;
|
||||||
|
|
||||||
@ -85,15 +86,7 @@ void esp_gdbstub_int(__attribute__((unused)) void *frame)
|
|||||||
/* Pointer to saved frame is in pxCurrentTCB
|
/* Pointer to saved frame is in pxCurrentTCB
|
||||||
* See rtos_int_enter function
|
* See rtos_int_enter function
|
||||||
*/
|
*/
|
||||||
/* Todo: Provide IDF interface for getting pxCurrentTCB (IDF-8182) */
|
dummy_tcb_t *tcb = (dummy_tcb_t *)pvTaskGetCurrentTCBForCore(esp_cpu_get_core_id());
|
||||||
int core_id = esp_cpu_get_core_id();
|
|
||||||
#if CONFIG_FREERTOS_USE_KERNEL_10_5_1
|
|
||||||
extern void **pxCurrentTCBs;
|
|
||||||
dummy_tcb_t *tcb = (dummy_tcb_t *) &pxCurrentTCBs[core_id];
|
|
||||||
#else
|
|
||||||
extern void **pxCurrentTCB;
|
|
||||||
dummy_tcb_t *tcb = (dummy_tcb_t *) &pxCurrentTCB[core_id];
|
|
||||||
#endif /* CONFIG_FREERTOS_USE_KERNEL_10_5_1 */
|
|
||||||
gdbstub_handle_uart_int((esp_gdbstub_frame_t *)tcb->top_of_stack);
|
gdbstub_handle_uart_int((esp_gdbstub_frame_t *)tcb->top_of_stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1181,6 +1181,26 @@ UBaseType_t uxTaskGetSnapshotAll( TaskSnapshot_t * const pxTaskSnapshotArray,
|
|||||||
}
|
}
|
||||||
/*----------------------------------------------------------*/
|
/*----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- Misc ----------------------------------------------------- */
|
||||||
|
|
||||||
|
void * pvTaskGetCurrentTCBForCore( BaseType_t xCoreID )
|
||||||
|
{
|
||||||
|
void * pvRet;
|
||||||
|
|
||||||
|
configASSERT( ( xCoreID >= 0 ) && ( xCoreID < configNUM_CORES ) );
|
||||||
|
#if CONFIG_FREERTOS_USE_KERNEL_10_5_1
|
||||||
|
pvRet = ( void * ) pxCurrentTCBs[ xCoreID ];
|
||||||
|
#else /* CONFIG_FREERTOS_USE_KERNEL_10_5_1 */
|
||||||
|
#if CONFIG_FREERTOS_SMP
|
||||||
|
/* SMP FreeRTOS defines pxCurrentTCB as a macro function call */
|
||||||
|
pvRet = pxCurrentTCB;
|
||||||
|
#else /* CONFIG_FREERTOS_SMP */
|
||||||
|
pvRet = ( void * ) pxCurrentTCB[ xCoreID ];
|
||||||
|
#endif /* CONFIG_FREERTOS_SMP */
|
||||||
|
#endif /* CONFIG_FREERTOS_USE_KERNEL_10_5_1 */
|
||||||
|
return pvRet;
|
||||||
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------- OpenOCD ---------------------------------------------------- */
|
/* ----------------------------------------------------- OpenOCD ---------------------------------------------------- */
|
||||||
|
|
||||||
#if CONFIG_FREERTOS_DEBUG_OCDAWARE
|
#if CONFIG_FREERTOS_DEBUG_OCDAWARE
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
#endif
|
#endif
|
||||||
/* *INDENT-ON* */
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
|
/* -------------------------------------------------- Task Snapshot ------------------------------------------------- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Task Snapshot structure
|
* @brief Task Snapshot structure
|
||||||
*
|
*
|
||||||
@ -78,6 +80,18 @@ UBaseType_t uxTaskGetSnapshotAll( TaskSnapshot_t * const pxTaskSnapshotArray,
|
|||||||
const UBaseType_t uxArrayLength,
|
const UBaseType_t uxArrayLength,
|
||||||
UBaseType_t * const pxTCBSize );
|
UBaseType_t * const pxTCBSize );
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- Misc ----------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get a void pointer to the current TCB of a particular core
|
||||||
|
*
|
||||||
|
* @note This function provides no guarantee that the return TCB will still be the current task (or that the task still
|
||||||
|
* exists) when it returns. It is the caller's responsibility to ensure that the task does not get scheduled or deleted.
|
||||||
|
* @param xCoreID The core to query
|
||||||
|
* @return Void pointer to current TCB
|
||||||
|
*/
|
||||||
|
void * pvTaskGetCurrentTCBForCore( BaseType_t xCoreID );
|
||||||
|
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user