AnsweredAssumed Answered

Hard Fault exception when incrementing pointer address?

Question asked by Phataas on Jan 30, 2013
Latest reply on Jan 31, 2013 by Clive One
Hello!


I am making a GUI application on a touchscreen with STM32 F103VC. I have a problem with one of the funtions in the STM32 GUI library.


When stepping through my program when debugging, the line to be executed next is:


          CursorBehindPointer++;


But when it does I get thrown to the hard fault exception handler and I can see from my variables window that CursorBehindPointer get this error message:




"CursorBehindPointer"      <error(s)_during_the_evaluation>     
Target request failed: -var-create: unable to create variable object.     






From the code within the function:







uint16_t* CursorBehindPointer;
....
CursorBehindPointer = Cursor->BehindCursor; //Debugger variable window shows that they get the same value and points to the same address.
.....
if (Temp & Mask)
 {
 /*Read pixel which is going to be behind cursor*/
*CursorBehindPointer = LCD_GetPixel(X + tmpX, Y + tmpY);
CursorBehindPointer++;
 }






And BehindCursor in Cursor struct is a uint16_t* as well.




Is there anyting illegal going on here? The file is from the ST GUI Library and should work?


I have never had a hard fault exception before and don't know much about how to solve these nasty errors. Any help on where to find information on how to solve this or if you can provide some help yourself would be much appreciated.




Outcomes