Emwin Memory GUI_NUMBYTES usage

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

    • Emwin Memory GUI_NUMBYTES usage


      I wanted to know exactly what GUI_NUMBYTES memory is used for.
      If i have multiple windows and respective widgets and i always have to increase the memory if any new window is added.

      Is there any way to avoid this?


    • I beleive it is the ram size reserved for EmWin. the size and address are given in the init GUI_X_Config

      C Source Code

      1. void GUI_X_Config(void)
      2. {
      3. /* Assign work memory area to emWin */
      4. GUI_ALLOC_AssignMemory((void *)GUI_MEMORY_ADDR, GUI_NUMBYTES);
      5. ...
    • Hi,

      The memory allocated with the function GUI_ALLOC_AssignMemory() in GUI_X_Config() is used to allocate memory for anything emWin needs memory for.

      This can be:

      Memory Devices
      Driver memory (except the frame buffer of GUIDRV_Lin)
      Driver context structure
      QR codes
      Any special devices (Rotation, Alpha, ...)

      I'm pretty sure I have forgot something but it should give you an idea about which things need memory from this memory pool.

      You could increase the memory that everything is running properly. Once finished you can call GUI_ALLOC_GetMaxUsedBytes() and play with your application. After some time set a breakpoint on this function call and check the return value. This will be the maximum number of bytes used by your application. Now you can reduce teh memory allocated for emWin to the functions return value (plus some addition bytes to be on the save side).