How to Port ConfigureTimerForRunTimeStats to the LPC55xx Series ?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to Port ConfigureTimerForRunTimeStats to the LPC55xx Series ?

101 次查看
inse1979
Contributor I

I want to monitor task status on FreeRTOS, so I enabled config_GENERATE_RUN_TIME_STATS in FreeRTOSConfig.h. However, I encountered the following error:

If configGENERATE_RUN_TIME_STATS is defined then portCONFIGURE_TIMER_FOR_RUN_TIME_STATS must also be defined. portCONFIGURE_TIMER_FOR_RUN_TIME_STATS should call a port layer function to setup a peripheral timer/counter that can then be used as the run time counter time base.
If configGENERATE_RUN_TIME_STATS is defined then either portGET_RUN_TIME_COUNTER_VALUE or portALT_GET_RUN_TIME_COUNTER_VALUE must also be defined. See the examples provided and the FreeRTOS web site for more information.

I'm unsure how to implement portCONFIGURE_TIMER_FOR_RUN_TIME_STATS and portALT_GET_RUN_TIME_COUNTER_VALUE on the LPC55xx.
Could you provide assistance with this?

标签 (2)
0 项奖励
回复
1 回复

59 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @inse1979 

To enable run-time statistics in FreeRTOS on the LPC55xx, you need to configure a hardware timer that FreeRTOS can use to track task execution time. The error you're seeing is because the required macros are not yet defined in your FreeRTOSConfig.h.

Make sure these are defined:

#define configGENERATE_RUN_TIME_STATS 1
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS configureTimerForRunTimeStats()
#define portGET_RUN_TIME_COUNTER_VALUE getRunTimeCounterValue()
 

You’ll need to implement two functions in your application code:

configureTimerForRunTimeStats()

This function sets up a hardware timer (e.g., CTIMER0) to count at a known frequency.

void configureTimerForRunTimeStats(void)
{
   ...
}

getRunTimeCounterValue()

This function returns the current timer count.

uint32_t getRunTimeCounterValue(void)
{
    return CTIMER0->TC;
}
 
 
Thank you.
 
BR
Alice

0 项奖励
回复