AnsweredAssumed Answered

Bus- Hard- MemManage Faults and Screen messing up using eGUI on TWR-K60 and TWR-LCD

Question asked by Dominik Burkhart on Feb 5, 2012
Latest reply on Feb 14, 2012 by Dominik Burkhart

I have a problem with the eGUI on a TWR-K60 Kit with the TWR-LCD module.

 

I made a project using the D4D eGUI to display some screens, derived it from the official demo in the eGUI software package.

I added USB Host support, which I took from the Codewarrior 10.1 Examples Kit. I took the hidmouse example and added keyboard support.

I added terminal support and use the P&E Terminal for some "printf debugging".

For debugging I implemented the busfault/usagefault/memfault and hardfault ISRs.

 

I have now a strange problem, which I've been trying to solve now for some time:

When I change screens (using the function D4D_Activate_Screen(..)) the screen starts to mess up after a few screen changes, displaying no title bar, placing the scroll bar somewhere on the screen, and the button I use to display a menu of screens stops working.

 

Sometimes I get a BusFault or MemManageFault with weird values on the BFAR or on the stacked PC, when the MCU tries to execute code in the heap mem. The USB stack and the D4D functions make heavy use of global data structures with pointers to functions, which I've seen changing after initialization, which should not happen.

 

I have the feeling that the compiler places different global variables in the same memory area which leads to altering of function pointers and finally to the mentioned faults.

 

The question is now, what I can do against it; how can I make the compiler (or the mem manager) use correct memory allocation? Or is it just something wrong or missing in my project?

 

Thanks!

Dominik

Outcomes