FRDM-KW41Z评估板 MCUXpresso 调试问题

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FRDM-KW41Z评估板 MCUXpresso 调试问题

1,036 Views
bin_er
NXP Employee
NXP Employee

A trainee in NXP roadshow send me a question

Could you help him please?

我是北京杰安泰无损检测技术有限公司的贾工,听过您MCUXpresso IDE的讲座,您当时讲有问题可以给您发邮件,今天冒昧打扰您一下。

我现在在使用FRDM-KW41Z评估板测试程序,使用的是MCUXpresso IDE集成开发工具,使用SEGGER J-Link Probes在调试SDK_2.2_FRDM-KW41Z中的BLE demo application中的Wireless UART(使用FreeRTOS操作系统)时,因为MCUXpresso IDE FreeRTOS Debug Guide写的比较简单,

MCUXpresso IDE FreeRTOS Debug Guide中Task List View中有一项Runtime项(如下图最右边一项所示),可以显示FreeRTOS每个任务的运行时间,在MCUXpresso IDE FreeRTOS Debug Guide中的图例中是可以显示此项的,但在Wireless UART示例中这个选项是关闭的(configGENERATE_RUN_TIME_STATS=0),我把这个参数设置为1时,编译就报错,在FreeRTOS.h中如下文所示的一段程序,要求增加处理函数,请问真对FreeRTOS Wireless UART示例应该如何增加相关参数和处理函数可以显示出Runtime项?

================================================================

#if ( configGENERATE_RUN_TIME_STATS == 1 )

 

    #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS

        #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.

    #endif /* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS */

 

    #ifndef portGET_RUN_TIME_COUNTER_VALUE

        #ifndef portALT_GET_RUN_TIME_COUNTER_VALUE

            #error 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.

        #endif /* portALT_GET_RUN_TIME_COUNTER_VALUE */

    #endif /* portGET_RUN_TIME_COUNTER_VALUE */

 

#endif /* configGENERATE_RUN_TIME_STATS */

0 Kudos
2 Replies

681 Views
bjemt
Contributor III

我在Mastering the FreeRTOS Real Time Kernel - a Hands On Tutorial Guide 的364页关于Configuring an Application to Collect Run-Time Statistics中给出的实例说明如下:

Listing 171 shows the lines added to FreeRTOSConfig.h to enable the collection of run-time
statistics.
/* Set configGENERATE_RUN_TIME_STATS to 1 to enable collection of run-time
statistics. When this is done, both portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() and
portGET_RUN_TIME_COUNTER_VALUE() or portALT_GET_RUN_TIME_COUNTER_VALUE(x) must also
be defined. */
#define configGENERATE_RUN_TIME_STATS 1
/* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() is defined to call the function that sets
up the hypothetical 16-bit timer (the function’s implementation is not shown). */
void vSetupTimerForRunTimeStats( void );
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vSetupTimerForRunTimeStats()
/* portALT_GET_RUN_TIME_COUNTER_VALUE() is defined to set its parameter to the
current run-time counter/time value. The returned time value is 32-bits long, and is
formed by shifting the count of 16-bit timer overflows into the top two bytes of a
32-bit number, then bitwise ORing the result with the current 16-bit counter
value. */
#define portALT_GET_RUN_TIME_COUNTER_VALUE( ulCountValue ) \
{ \
extern volatile unsigned long ulOverflowCount; \\
/* Disconnect the clock from the counter so it does not change hile its value is being used. */ \
PauseTimer(); \\
/* The number of overflows is shifted into the most significant \
two bytes of the returned 32-bit value. */ \
ulCountValue = ( ulOverflowCount << 16UL ); \\
/* The current counter value is used as the least significant \
two bytes of the returned 32-bit value. */ \
ulCountValue |= ( unsigned long ) ReadTimerCount(); \\
/* Reconnect the clock to the counter. */ \
ResumeTimer(); \
}
==============================================

但是没有给出void vSetupTimerForRunTimeStats( void )该如何写,哪位知到真对FRDM-KW41Z评估板的FreeRTOS Wireless UART示例应该选用哪个硬件定时器作为run-time statistics clock,具体如何编写这个处理函数。

另外,在MCUXpresso IDE 中Runtime百分数是显示在FreeRTOS Debug Task List View窗口中的,MCUXpresso IDE在使用SEGGER J-Link Probes时,FreeRTOS Task Aware Debug Views是通过 GDBServer/RTOSPlugin_FreeRTOS插件完成的。那如何将自己增加的代码与这个插件同步,使用其能够在Task List View窗口中显示Runtime百分数?如:查看哪个文件中的哪个参数项或增加必要的代码,最好能给个实例,谢谢!

0 Kudos

681 Views
Carlos_Mendoza
NXP Employee
NXP Employee

Hi Limin Jia and Bin Er,

 

As mentioned on the other post, you can find more information about MCUXpresso and FreeRTOS Thread aware debugging on the following document:

 

https://www.nxp.com/docs/en/quick-reference-guide/MCUXpresso_IDE_FreeRTOS_Debug_Guide.pdf 


Hope it helps!

 

Best Regards,
Carlos Mendoza
Technical Support Engineer

0 Kudos