This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

emWin Configuration with Memory allocation issue

I am trying to write my own LCD driver with emWin, I use the GUIDRV_Template, and GUICC_1 Color conversion. When I called the GUI_DEVICE_CreateAndLink(DISPLAY_DRIVER, COLOR_CONVERSION, 0, 0),
the device get into a dead loop, I checked the assambly code, I find it enter this function
_TestRAM 0x0005e52d Thumb Code 274 gui_alloc.o(i._TestRAM).

I assume the gui_library need memory allocation but I can not get the memory, does anybody can give any advice how to set the heap for emWin library?

Parents
  • It seems you have issues with memory assigned to emWin.

    Memory for emWin is assigned in GUI_X_Config function which is in the GUI configuration file GUIConf.c. This memory is used for all GUI related resources.

    Memory is also tested at run time in _TestRAM function for 32/16/8-bit access.

    emWin will emit an error message via GUI_X_ErrorOut function before it enters a dead loop on critical errors.

    Default implementation of that function is in file GUI_X.c. You can check the error message to get more information.

Reply
  • It seems you have issues with memory assigned to emWin.

    Memory for emWin is assigned in GUI_X_Config function which is in the GUI configuration file GUIConf.c. This memory is used for all GUI related resources.

    Memory is also tested at run time in _TestRAM function for 32/16/8-bit access.

    emWin will emit an error message via GUI_X_ErrorOut function before it enters a dead loop on critical errors.

    Default implementation of that function is in file GUI_X.c. You can check the error message to get more information.

Children
  • After I set the Memory for emWin, I find the code reach a data about exception in GUI_ALLOC_GetFixedBlock, I feel the memory didn't get correct initialized, because in GUI_ALLOC_GetFixedBlock function, the code try to get some data from a buffer (length is 188bytes) in gui_alloc.o, but this data buffer didn't get any initialized before I call GUI_ALLOC_GetFixedBlock.

    I think in emWin, there must a function be called to initialized the memeory heap. It should not be the GUI_ALLOC_AssignMemory, because GUI_ALLOC_AssignMemory only assign the heap memory to a globle variable in different data buffer (differnt from the GUI_ALLOC_GetFixedBlock accessed buffer), I feel there must be a function shuld be called to initialize fixed block.

    Please advise how can I do it?

  • emWin uses a single memory block which is assigned through the GUIL_ALLOC_AssignMemory function and initialized later automatically by the system. There is no explicit user function to initialize the memory system.

    Have you assigned memory with GUI_ALLOC_AssignMemory in GUI_X_Config function?
    Have you checked the error code reported by GUI_X_ErrorOut?

    Take a look also at emWin documentation.

    You can find more information at:
    http://segger.com/emwin.html

    There is also a emWin related forum at:
    http://www.segger2.com/

  • Hi,
    Segger does not support the Keil add-on as per agreement.
    I have a very similar problem.
    STM32F103ZF, Keil, NT7534 Controller (4 line serial), GUIDRV_SPage. I have written the interface function which work. All compiles OK. When I run throught the code, it goes into GUI_Init, then GUI_X_Config, LCD_X_Config and initialises the LCD fine with LCD_X_DisplayDriver. As it exits it runs some code until it get to LCD_FillRec and branches to a bad address (0x00) halfway through. Can anyone help?

    Stefan

  • I found in Keil, you should not select NoInit for RAM memory area, looks emWin reply on compiler to initialize the uninitialized variable to 0. If you select NoInit, the keil not initialize the uninitialized variable for you.

    It is just my guess, but it works for my case.