MQX Lite supported by MQX Tools

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

MQX Lite supported by MQX Tools

3,611 Views
mkrug
Contributor II

Hello,

I am just asking myself if the MQX Lite is also supported by the MQX Tools (Runtime TAD and Performance Tool). So far I could not find a hint on it. However the MQX Lite has the logging feature. So it might be possible to use the MQX Tools also with the MQX Lite RTOS. Has anyone already made some experience?

Best Regards

Markus

0 Kudos
12 Replies

1,597 Views
mkrug
Contributor II

Hello,

it took me a while to get my own MQX Lite application running and also be able to use most of the MQX Tools (timeline, stack and cpu usage) to have the possibility of monitoring everything.

If someone has the same attempt please do not forget:

  1. Increase the stack size of MQX Lite at least to 512. I guess the unit is byte but I did not verify that. Even if you call one simple MQX function inside your application tasks that can lead to a context switch the original 256 is not sufficient. That might be something to be changed by the PE MQX Lite component in the next release because it is always hard to debug problems that came from stack overflow.

  2. Add in User settings in the PE MQX Lite component the line #define MQX_ENABLE_IDLE_LOOP    1 (see the picture below). I tried with and without with no noticable difference. However I got this from Petr from freescale and I assume there is a good reason for this.
    MQXLite settings01.jpg
  3. Changing something during development time in the PE MQX Lite component always adds a new 'Task1' to the end of the file mqx_tasks.c. It is easy to detect but propably also something to refine in the next release.
  4. The thing that cost me almost 2 days is rather simple - but not easy if you have not much experience with kernel support during debugging and also trust in the officieal PE components. You have to set 'MQX OS for Cortex' in the 'OS Awareness' tab of the Debug Configuration menu (see picture below). The default is 'none' which is different to a standard MQX application that is started with the MQX project wizard. So this might be another topic that could be changed in the next release of the PE MQX Lite component.
    MQXLite settings02.jpg
  5. Do not forget to include klog.h, lw_log_prv.h and lwlog.h in those files who call functions of the logging API. Again something that propably better automatically included in the source code during generation of the PE MQX Lite component for the file mqx_tasks.c.

Finally I want to say thank you to Petr that helped me with his hints and demo application to find all the traps:smileyhappy:

Best Regards Markus

0 Kudos

1,597 Views
Martin_
NXP Employee
NXP Employee

Performance Tool works, just enable Kernel Logging in the MQXLite component. Note you need to use _klog_create_at to provide the memory for the kernel log, maybe on a task's stack.

For the Runtime TAD, there is no FreeMASTER OpenSDA plugin. We will provide one but as far as I know it is not ready yet. In using the RS232 connection (directly with a PC host or with the CDC device in OpenSDA application), there is Processor Expert FreeMASTER plugin under CPU External Devices -> FreeMaster. However, there is currently one problem on Kinetis L (for Kinetis K this works OK). For Kinetis L, the Processor Expert FreeMASTER component will be usable with next upgrade. There is just small change needed in order to support Cortex M0.

0 Kudos

1,597 Views
mkrug
Contributor II

Dear Martin,

today I had a closer look again to the 'performance tools' in connection with MQX Lite. I started with the MQX because I am convinced that it works there and the plan was to move step by step from MQX  to MQX Lite while always maintaining the logging. I was able to repeat the lwdemo example that comes with the MQX (not Lite!). After a while I get it to work.

So I tried to transform that logging scheme to a MQX Lite project. However it does not work and give me always the message: 'kernel log is not activated' - However it is enabled for sure.

Some other things takes me an incredible lot of time around MQX Lite. I am struggling with using floating point and printf(). It is unclear to me if floating point is an allowed or mandatory or option to MQX Lite. If I keep the default settings in the project wizard of MQX Lite the linking failed as soon as I include somewhere a printf() - and the logging function uses that call - I got an error message from the linker that it can not merge the whole applicatinon because of some I/O inconsistency. If I change the order or Libs that are included to use the floating point lib as the last one I get rid of the printf() error - however I add an error that the linker does not know where fp_init() to take from :-(

Even more investigation on MQX Lite shows me some other strange thing. I looked for an official MQX Lite demo (that comes with the installation) that uses the kernel logging. I found surprinsingly the lwdemo. However as soon as I turned on the logging in the MQX-Lite PE-Component you end up with a lot of error messages during the build process. If you look now more in detail you discover that there are logging functions used that are not allowed in MQX Lite. For instance the demo code uses _klog_create() that is a function that is explicitly forbidden and unsupported for good reasons in MQX Lite. So I come to the conclusion that the logging option of this demo has not been tested by freescale before getting released :-( If I am right with my conclusion I have to say I am pretty much disappointed about the quality process at freescale - so hopefully I overlooked something.

I will do some further investigations tomorrow and if I found a solution for MQX Lite and logging I will post it here. Again, if someone has a demo application based on MQX Lite that also uses the performance tools based on the logging I would be happy if you can post it here.

Best Regards

Markus

0 Kudos

1,597 Views
petr_uhlir
NXP Employee
NXP Employee

Hi Marcus,

can you please specify following information to better help you

  1. Are using PEx within CodeWarrior or DriverSuite standalone version?
  2. What build toolset are you using IAR, Keil,..?
  3. What Kinetis derivative are you working with?
  4. What version of MQX Lite do you have set in MQX Lite component?

I have tested the kernel logging on Freedom KL25Z board.

Attached are modified V1.0.1 files. Unzip the V1.0.1.zip into "c:\Freescale\CW MCU v10.4\MCU\ProcessorExpert\lib\mqxlite\V1.0.1" directory.

The LWDEMO_KL25Z.ZIP contains the fixed lwdemo application which runs with MQX Lite.

If you are using different toolset the documentation can be found in full MQX in \mqx\doc\tools directory.

The fixed kernel logging issue is going to be fixed in MQX Lite V1.1.0

Regards Petr

0 Kudos

1,597 Views
mkrug
Contributor II

Dear Petr,

I changed my MQX Lite v1.0.1 files according to your instructions and load the demo project into my workspace. I first decide to stay with the K25 configuration because from what I have discovered till now my problems seems not to be related to the microcontroller that is used.

Trying to build the application showed the following:

  1. The kernel logging was disabled in the settings -> I enabled it (setting to Kernel Logging to 'yes' in the MQX Lite PE-Component)
  2. The build showed many errors in the second call of klog_control(...) in mqx_tasks.c. The reason for this that the compiler does not know about the defines that are used in this call (e.g. KLOG_ENABLED). They are defined in klog.h. So I add this as an include. Probably it is an good idea to cover that issue by the PE automatic code generation in future releases. To avoid useless code it can be covered by something like #if MQX_USE_LOGS like it is done at other parts of the code.
  3. The next try to build your demo application including kernel logging showed the problem that the used function call: _log_create_component() is unknown to the linker. That is not a surprise because in the MQX Lite Reference manual it is stated that only _log_create_at() is supported (See also MQX Lite System User Guide Section 1.1.1. and the notes about dynamic memory)

So finally I stopped my activities on your demo application because I'm not sure if this application is able to demonstrate the kernel logging of MQX Lite and also to show that the Timeline-, Stack and CPU view will work with MQX Lite. If your have a working example I will be happy to adopt it to my needs.

To move to MQX is currently not really an option for my because the amount of memory that is required for MQX is for my kind of applications too much in comparison to what I need from an operating system.

Best Regards

Markus

0 Kudos

1,597 Views
petr_uhlir
NXP Employee
NXP Employee

Dear Markus,

attached is the LWDEMO application created for K60F120 which runs on your board.

Below are screenshots from CW10.4. Hope it helps you to get it running on your HW.

timeline.PNG

stack.PNGklog.PNG

0 Kudos

1,597 Views
mkrug
Contributor II

Dear Petr,

thanks for your example. I get it to run within seconds and also the performance tools works. So great to see that MQXLite is capable to do so. However then I start to develop my own application and had the same problem that I had before. I tried to copy almost everything concerning the logging from your demo project. But i still get the error message: 4967_4967.png

I attached my project. I would be great if you can have a look at it and find the configuration problem that I obvious still have.

Best Regards

Markus

0 Kudos

1,597 Views
petr_uhlir
NXP Employee
NXP Employee

Dear Marcus,

if you change some settings in MQX Lite component specifically the ones which have conditional compilation in

assembly file dispatch.S #if MQX_KERNEL_LOGGING, #if MQX_ENABLE_USER_MODE, you have to "Clean Project" to get rid of object files before build. Its because of issue GCC assembly pre-processor which does not detect change in included header files. The issue has been already reported and will be fixed in CW 10.5 which will be released in Q3 2013.

Regards Petr

0 Kudos

1,597 Views
mkrug
Contributor II

  Hi Petr,

  

thanks for your hint with the clean. I did it and get finally rid of all 'grey' blocks around #if MQX_KERNEL_LOGGING. Acutally the clean+build does not do the whole job. I had to insert a 'blank' in user_conf.h and save it again. After that the header file was reloaded correctly and the build works fine. However the logging still do not work and I had a closer look again. I realized that in your demo project the debugger is aware of 8 threads. One for each task and one for the idle-task or the logging (depending at which point in time I paused the debugger). See screenshot below for explaination.

debuggerthreads01.jpg

In my application there is only one thread that the debugger is aware of although the two tasks run in an infinity loop and they really do if I follow step by step with the debugger (see below the single thread in the debugger).

debuggerthreads02.jpg

I inserted a printf() in each task to follow on the serial line what the application does and as expected it runs in an infinitey loop and switches the tasks as expected.

So I am asking myself if this could be a hint what goes wrong in my application that causes still the message 'The debug application has no kernel logging enabled'. Just to say it again. The logging function (e.g. _klog_context_switch_internal() ) is called as expected in my application and writes to the belonging data structure. It is just the the displaying tool like timeline or CPU usage is not able to detect and display the filled data structure.

Another hint might be that I did not install the latest patch of MQX. I installed the version 4.0.1 (that reports itself as 4.0.0 if I ask for the '_mqx_version'). The reason for this that I was unable to locate where to install the patch directories because I found no instructions in the zip file (see the zip file contents below).MQX patch files.jpg

Finally I took your demo application and modified it to my task scheme and to the application contents. I did this without changing any line of code inside mqy_tasks.c to my original application where the displaying of the logging data does not work. I did this to be sure it is an configuration and not an application program issue. I got two surprises: 1.) I got a thread for every task in the debugger + a thread for the actual position in the application (see below). 2.) the timeline etc. works :smileyhappy:.debuggerthreads03.jpg

However I have to find out what the reason is that my original application does not work. Otherwise I could not use the MQX Lite in my university course because I am 100% sure that the students will run into the same problem that I have and I have to help them out.

So any hint why I am not able to display the logging data in my original application will be welcome - final question for today- does it belong to the fact that my original application is build for RAM and not for FLASH?

Best Regards

Markus

0 Kudos

1,597 Views
mkrug
Contributor II

Dear Petr,

thanks for your reply. I try to answer your questions:

  1. I am using PEx within Codewarrior (10.4)
  2. I use the GCC build toolset (as it is the default in CW10.4)
  3. I am working with the K60F120 using the TWR-Modul (to be precise it is the MK60FN1M0VMD12)
  4. I using MQX Lite V1.0.1

I will try to get you example running on my board later this afternoon and come back with the results.

Best Regards

Markus

0 Kudos

1,597 Views
mkrug
Contributor II

Dear Martin,

I followed your advice and setup a simple application consisting of two tasks. Task 1 is already enabled and 'creates' Task 2 at its end. Task 2 runs in an infinite loop. So far the application works fine if I step through by using the debugger. However I did not get any result from the performance tools. Even worse - the timeline tool tells me that kernel log is not switched on. But I did it for sure in the PE configuration and checked it also in the user_conf.h file. I am writing the logging data to a global data structure and and monitor that it gets filled very quickly. So it seams that the logging works but the displaying of the data does not. Do you have any hints?

Additional I got the following warnings related to the printf when I switch on the logging. Does that give any hint to my mistake?

Best Regards

Markus

0 Kudos

1,597 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

MQX and MQX lite are not supposed to use together. MQX lite is included in CW install package. if you want to use MQX lite, you needn't install MQX. CW10.4 can support MQX lite. To work with MQX lite, user must use professional license. You can check MQXLite_User_Guide.pdf under CW10 install folder.

0 Kudos