Emwin Memory GUI_NUMBYTES usage

  • Hi,

    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?

    Thanks
    Regards,

    Anuj

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

    C
    void GUI_X_Config(void)
    {
        /* Assign work memory area to emWin */
        GUI_ALLOC_AssignMemory((void *)GUI_MEMORY_ADDR, GUI_NUMBYTES);
    ...
  • 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:

    Windows
    Widgets
    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).

    Regards,
    Sven

    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: https://www.segger.com/ticket/

    Or you can contact us via e-mail.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!