Debugging techniques with MQX and KDS?

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

Debugging techniques with MQX and KDS?

Jump to solution
655 Views
dave408
Senior Contributor II

I'm new to MQX and am running into problems here and there, and I'm sure there will be more!  I was hoping that members of the community can share some of their special debugging techniques with MQX.

I am aware of the Task Aware Debugging (TAD) feature and have added it to KDS 2.0 (I haven't migrated to KDS 3.0 yet).  But other than this, what else is there?  I have read about enabling the Kernel Logging feature, but have only seen that with the older MQX component.  Since PEx now has MQX as an OSA selection, I no longer see Kernel Logging in the parameter list.

I'd also like to see my stack usage over time, but whenever I go to MQX -> Stack usage, it just says "Stack usage information not found!".  I've had cases where my application locks up, and when I increase my stack space, my problem goes away.  I can only assume that this is okay, since I don't use dynamic memory allocation and don't have to worry about memory leaks.  I got lucky this time, because the way the error manifested itself was with a troubling message when I paused execution:

pastedImage_0.png

How do I enable Stack Usage information?

Furthermore, what about the case where an application locks up, and it's not a stack space issue?  How do you go about figuring out what happened?  I left my application running overnight, and when I came back to it this morning, it was frozen.  The green D2 LED on my FRDM-K64F was blinking steadily, but this doesn't tell me much because that LED is controlled by the K20 onboard.  I couldn't pause execution, because the debugger had completely lost connection to the board somehow.

And what about catching Hard Fault errors?  I tried to follow BlackNight​'s informative post on mcuoneclipse, but I have enabled Unhandled vectors -> "Own handler for every", and now I can't figure out where those handlers reside.  :smileyhappy:


I'm looking forward to hearing what everyone else does, as well as hopefully getting feedback on how to enable the debugging features that I have mentioned above.  Thank you!

0 Kudos
1 Solution
5 Replies
376 Views
dave408
Senior Contributor II

I'm also open to suggestions about how to better handle this sort of request.  It's a little open-ended, and I'm not sure if that prevents people from posting responses.  Is there a better forum mechanism for this sort of thing?  Maybe I should go back to just posting separate questions...

0 Kudos
376 Views
dave408
Senior Contributor II

It seems better to ask directed questions, so I am going to end this discussion and focus on specific ones from now on.  :smileyhappy:

0 Kudos
377 Views
BlackNight
NXP Employee
NXP Employee
376 Views
dave408
Senior Contributor II

Hi Erich, I did read both of those posts already.  I enabled "Own handler for every" as described, but as I stated in my original post, I cannot find where those handlers end up, so I can't confirm that they exist.  :smileyhappy:  Your post refers to Vectors.c, but I don't have that in the Generated Code section.  I have looked for Fault, Hard_Fault, vect_table, etc etc and don't see that lookup table anywhere.  Can you point me to where it is in KDS 2.0?  Thanks!

0 Kudos
376 Views
dave408
Senior Contributor II

We're now up to KDS 3.0 and I had to get fault handlers working.  It turns out that they are weak linked, so all you have to do is define your own functions like this:

void HardFault_Handler(unsigned long *hardfault_args)

{

}

void MemManage_Handler(unsigned long *hardfault_args)

{

}

void BusFault_Handler(unsigned long *hardfault_args)

{

}

void UsageFault_Handler(unsigned long *hardfault_args)

{

}

0 Kudos