Merge branch 'feature/freertos_runtime_counter_support_v5.2' into 'release/v5.2'

feat(freertos): Runtime Counter support (v5.2)

See merge request espressif/esp-idf!31135
This commit is contained in:
Marius Vikhammer 2024-06-04 16:36:49 +08:00
commit 52df721bb1
5 changed files with 27 additions and 27 deletions

View File

@ -220,11 +220,11 @@ extern void vTaskExitCritical( void );
// ------------------- Run Time Stats ----------------------
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
#define portGET_RUN_TIME_COUNTER_VALUE() 0
#ifdef CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
/* Coarse resolution time (us) */
#define portALT_GET_RUN_TIME_COUNTER_VALUE(x) do {x = (uint32_t)esp_timer_get_time();} while(0)
#endif
#define portGET_RUN_TIME_COUNTER_VALUE() ((configRUN_TIME_COUNTER_TYPE) esp_timer_get_time())
#else
#define portGET_RUN_TIME_COUNTER_VALUE() 0
#endif // CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
// --------------------- TCB Cleanup -----------------------

View File

@ -226,11 +226,11 @@ extern void vTaskExitCritical( void );
//Timers are already configured, so nothing to do for configuration of run time stats timer
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
//We define get run time counter value regardless because the rest of ESP-IDF uses it
#define portGET_RUN_TIME_COUNTER_VALUE() xthal_get_ccount()
#ifdef CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
#define portALT_GET_RUN_TIME_COUNTER_VALUE(x) ({x = (uint32_t)esp_timer_get_time();})
#endif
#define portGET_RUN_TIME_COUNTER_VALUE() ((configRUN_TIME_COUNTER_TYPE) esp_timer_get_time())
#else // Uses CCOUNT
#define portGET_RUN_TIME_COUNTER_VALUE() ((configRUN_TIME_COUNTER_TYPE) xthal_get_ccount())
#endif // CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
// --------------------- TCB Cleanup -----------------------

View File

@ -586,11 +586,11 @@ void vPortTCBPreDeleteHook( void *pxTCB );
// ------------------- Run Time Stats ----------------------
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
#define portGET_RUN_TIME_COUNTER_VALUE() 0
#ifdef CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
/* Coarse resolution time (us) */
#define portALT_GET_RUN_TIME_COUNTER_VALUE(x) do {x = (uint32_t)esp_timer_get_time();} while(0)
#endif
#define portGET_RUN_TIME_COUNTER_VALUE() ((configRUN_TIME_COUNTER_TYPE) esp_timer_get_time())
#else
#define portGET_RUN_TIME_COUNTER_VALUE() 0
#endif // CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
// --------------------- TCB Cleanup -----------------------

View File

@ -8,7 +8,7 @@
*
* SPDX-License-Identifier: MIT
*
* SPDX-FileContributor: 2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileContributor: 2023-2024 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
@ -513,15 +513,11 @@ extern void _frxt_setup_switch( void ); //Defined in portasm.S
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
/**
* - Fine resolution uses ccount
* - ALT is coarse and uses esp_timer
* @note [refactor-todo] Make fine and alt timers mutually exclusive
*/
#define portGET_RUN_TIME_COUNTER_VALUE() xthal_get_ccount()
#ifdef CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
#define portALT_GET_RUN_TIME_COUNTER_VALUE(x) do {x = (uint32_t)esp_timer_get_time();} while(0)
#endif
#define portGET_RUN_TIME_COUNTER_VALUE() ((configRUN_TIME_COUNTER_TYPE) esp_timer_get_time())
#else // Uses CCOUNT
#define portGET_RUN_TIME_COUNTER_VALUE() ((configRUN_TIME_COUNTER_TYPE) xthal_get_ccount())
#endif // CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
// --------------------- TCB Cleanup -----------------------

View File

@ -424,7 +424,7 @@ BaseType_t xTaskGetCoreID( TaskHandle_t xTask )
#if CONFIG_FREERTOS_SMP
UBaseType_t uxCoreAffinityMask;
/* Get the core affinity mask and covert it to an ID */
/* Get the core affinity mask and convert it to an ID */
uxCoreAffinityMask = vTaskCoreAffinityGet( xTask );
/* If the task is not pinned to a particular core, treat it as tskNO_AFFINITY */
@ -503,7 +503,7 @@ BaseType_t xTaskGetCoreID( TaskHandle_t xTask )
configRUN_TIME_COUNTER_TYPE ulTaskGetIdleRunTimeCounterForCore( BaseType_t xCoreID )
{
uint32_t ulRunTimeCounter;
configRUN_TIME_COUNTER_TYPE ulRunTimeCounter;
configASSERT( taskVALID_CORE_ID( xCoreID ) == pdTRUE );
@ -530,7 +530,11 @@ BaseType_t xTaskGetCoreID( TaskHandle_t xTask )
configASSERT( taskVALID_CORE_ID( xCoreID ) == pdTRUE );
ulTotalTime = portGET_RUN_TIME_COUNTER_VALUE();
#ifdef portALT_GET_RUN_TIME_COUNTER_VALUE
portALT_GET_RUN_TIME_COUNTER_VALUE( ulTotalTime );
#else
ulTotalTime = portGET_RUN_TIME_COUNTER_VALUE();
#endif
/* For percentage calculations. */
ulTotalTime /= ( configRUN_TIME_COUNTER_TYPE ) 100;
@ -848,11 +852,11 @@ uint8_t * pxTaskGetStackStart( TaskHandle_t xTask )
/**
* @brief Get reentrancy structure of the current task
*
* - This funciton is required by newlib (when __DYNAMIC_REENT__ is enabled)
* - This function is required by newlib (when __DYNAMIC_REENT__ is enabled)
* - It will return a pointer to the current task's reent struct
* - If FreeRTOS is not running, it will return the global reent struct
*
* @return Pointer to a the (current taks's)/(globa) reent struct
* @return Pointer to a the (current taks's)/(global) reent struct
*/
struct _reent * __getreent( void )
{
@ -1019,7 +1023,7 @@ int xTaskGetNext( TaskIterator_t * xIterator )
if( !portVALID_LIST_MEM( pxNextListItem ) )
{
/* Nothing to do with the corrupted list item. We will skip to the next task state list.
* pxNextListItem should be NULL at the beggining of each task list.
* pxNextListItem should be NULL at the beginning of each task list.
*/
pxNextListItem = NULL;
continue;