I am working with Freescale MQX and I try to implement CLU load measurement. I have got big problem because one of my task (standard MQX shell task) consume all CPU (program never goes to idle task).
Do You know how to change it ? Maybe Shell task could work in interrupts ?
I am working with 3.7 version of MQX.
Did you get your answer. I am also seeking the same, using IAR V 7.40, MQX 4.1.1, TAD plugin V 4.7.3 is enabled but I cannot see CPU Utilization anywhere in any menu.
Both IAR and Freescale seem to be stating that use "CPU Utilization" from MQX menu but I don't see any
Does something else has to be enabled and I am missing it.
There are two facets to this issue. The first is the generation of CPU profiling data from the MQX kernel. This is independent of tool chain. The key steps to do this are:
Enable kernel logging by setting the following in MQX user_config.h:
#define MQX_USE_LOGS 1
#define MQX_KERNEL_LOGGING 1
Be sure to rebuild the BSP and PSP after setting these.
Next, your application must configure and enable kernel logging. Here are a few lines of code taken from the web_hvac_v2 demo (hvac_task.c) that show how it’s done:
/* create kernel log */
_klog_create_at(DEMOCFG_KLOG_SIZE, 0,(void *)DEMOCFG_KLOG_ADDR);
/* Enable kernel logging */
_klog_control(KLOG_ENABLED | KLOG_CONTEXT_ENABLED |
KLOG_INTERRUPTS_ENABLED|
KLOG_FUNCTIONS_ENABLED|KLOG_RTCS_FUNCTIONS, TRUE);
Note the stock web_hvac_v2 doesn’t contain the following lines that are needed to properly setup the log:
#define DEMOCFG_KLOG_SIZE 0x1000
#define DEMOCFG_KLOG_ADDR 0x20000000
Of course, feel free to adjust the size and location as needed in your application. Take a look at the hvac_task.c file to see more about how kernel logging is setup. Some of the other demos may have good examples for reference as well.
Once an application is built that has kernel logging enabled, the MQX TAD plug in IAR can access that data. To do so, simply select “MQX->Kernel Data” menu item from a paused debug session. This will provide a text dump of the log. You may be able to figure some stuff out from it, but it is unlikely. You can save the data with the “MQX->Copy Active to Clipboard” menu item. You can then paste it in a document of your choosing.
What you’re after is the performance data. It, too, is available from the MQX TAD. Select “MQX->Save Performance Data.”
The second step is analyzing the performance data. IAR has not written a performance data viewer. The only viewer available is part of CodeWarrior, as there has been very little demand for it. The good news is the viewer works with the data generated by the MQX TAD in IAR. You’ll need to install CodeWarrior for MCUs v10.6, Special Edition, which is a free tool. You can get it here:
www.freescale.com/webapp/sps/site/prod_summary.jsp?code=CW-SUITE-SPECIAL
Click on Download, and then find Special Edition: CodeWarrior for Microcontrollers 10.6
The “online” version is a small download that then fetches what is needed during installs.
The “offline” version is a big download that has everything.
Once installed, start CodeWarrior and create a workspace. You won’t be putting much in the workspace. Within CodeWarrior, look at the “MQX Tools” menu. You’ll see “performance data viewer,” “CPU utilization” and more. Open the items of interest. A window will open. Click the folder icon near the upper right to select the performance file saved from IAR. Enjoy the views.
Thanks.
Thanks! It's useful.
But I have a question, because customer used Keil IDE, but I found it don't have “Save Performance Data” option. So I can't use Mqx TOOLs menu in Codewarrior. Do you have any good idea for this case?
Hello Nitin Harish,
Please check the below links!
MQX - CPU Utilization Performance Test
calculating CPU time with the idle task
Have a great day,
Sol
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------