STemwin run into HardFault_Handler when GUI_CreateDialogBox()

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • STemwin run into HardFault_Handler when GUI_CreateDialogBox()

      I use Cubemx to generate an LCD+SDRAM+STemwin project and run it on my STM32F429II board. In this project, when the code run into GUI_CreateDialogBox(), it jumps to HardFault_Handler() automatically. I read the stack and find the caller of HardFault_Handler() is _RemoveHoles() from GUI_Alloc. I repeated this several times and every time the caller is the same.

      To debug this issue I have done following steps but can't solve the problem.

      1. set the stack and heap size to 0xf000(very large)
      2. verify SDRAM driver by copying image data into SDRAM in this project with my code, the correct image can be seen.
      3. trace the line where HardFault_Handler is triggered
      Can someone give me some idea or solution about this issue? Thank you.

      C Source Code

      1. WM_HWIN CreateWindow(void);
      2. WM_HWIN CreateWindow(void) {
      3. WM_HWIN hWin;
      4. hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0); //This line
      5. return hWin;
      6. }
    • Hi Sven,
      Thanks for reply. I've deleted some codes that are not related with STemwin and run the project again. This time, the HardFault is still triggered but with different callers. However, I've tested several times and found the callers are all belongs to GUI_Alloc.

      The attachment is the STemwin folder in this project.In this project, both the video memory and GUI memory are all at SDRAM. The SDRAM is 32M byte with 16bit data width. The SDRAM space start from 0xC0000000. The video memory start from 0xC0000000. The GUI memory start from 0xC0600000.

      Source Code

      1. #define GUI_NUMBYTES (1024*1024*8)
      2. void GUI_X_Config(void)
      3. {
      4. // GUI_ALLOC_AssignMemory(extMem, GUI_NUMBYTES);
      5. U32 *aMemory = mymalloc(1,GUI_NUMBYTES/4);
      6. GUI_ALLOC_AssignMemory((void*)aMemory, GUI_NUMBYTES);
      7. GUI_ALLOC_SetAvBlockSize(GUI_BLOCKSIZE);
      8. GUI_SetDefaultFont(GUI_FONT_6X8);
      9. }
      10. void *mymalloc(u8 memx,u32 size)
      11. {
      12. return (void*)(0xC0600000);
      13. }
      Display All
      This is the debug information:

        (24.42 kB, downloaded 152 times, last: )