Hello,
Recently, I encountered an annoying issue causing freezing.
It seems like dereferencing a null pointer.
Please refer to the image below:
It appears to happen in a call to LCD_INIT->GUI_SelectLayer->GUI_SelectLCD->LCD_UpdateColorIndices->LCD_SetColorIndex.
Within that function r1 is loaded from a location with an offset of 0x3C, so probably a structure member.
The content is loaded in r1, but is zero. The next instruction (see yellow arrow) stores r0 back to location zero and thus overwriting the initial stackpointer.
I checked the soruce code:
void LCD_SetColorIndex(unsigned PixelIndex) {
if (GUI_pContext->DrawMode & LCD_DRAWMODE_REV) {
LCD__SetBkColorIndex(PixelIndex);
} else {
LCD__SetColorIndex(PixelIndex);
}
}
#define LCD__SetBkColorIndex(Index) (*GUI_pContext->LCD_pBkColorIndex = Index)
#define LCD__SetColorIndex(Index) (*GUI_pContext->LCD_pColorIndex = Index)
#define LCD__GetBkColorIndex() (*GUI_pContext->LCD_pBkColorIndex)
#define LCD__GetColorIndex() (*GUI_pContext->LCD_pColorIndex)
From the image, you can get that: the value of GUI_pContext->LCD_pColorIndex is null!
So, any solutions? Please save me!
My project using:
1) i.MX RT1050
2) KEIL RTX OS2
3) emWin v5.48j
PS:
To catch this, I set ITCM read only to MPU.
Thanks,
Kenmux