STemWin memory usage, aMemory

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

  • STemWin memory usage, aMemory

    I am currently working on a project on ST microcontroller. My GUIConf.c file is as follows. I really want to minimize the size of the memory since I am having an issue with the other part of my program. I really couldn't understand why emWin need this all size of memory for Text Widgets, Images and Text only. Can anyone help me with this issue, please?



    #define GUI_NUMBYTES (1024 * 110)


    void GUI_X_Config(void) {
    static U32 aMemory[GUI_NUMBYTES / 4];
    GUI_ALLOC_AssignMemory(aMemory, GUI_NUMBYTES);
    GUI_SetDefaultFont(GUI_FONT_6X8);
    }
  • Hi,

    How much memory emWin requires depends pretty much on your the application. You can call GUI_ALLOC_GetNumUsedBytes() and/or GUI_ALLOC_GetNumFreeBytes() to find out how much memory emWin is using at a specific point in your application.

    Depending on what you want to do, you can try to write the application without any widgets and the window manager, this will save some memory, too. Avoid using memory devices (do not call WM_SetCreateFlags(WM_CF_MEMDEV)), memory devices will allocate memory from the GUI memory.

    With emWin as source code it would also be possible to reconfigure emWin with preprocessor switches which will help to keep the amount of required memory low. Of course, this is not possible with the precompiled libraries.

    I don't know which driver you are using but if you are using a driver with an indirect interface (like GUIDRV_FlexColor) you might want to use a non cached version. This can be chosen in the LCDConf.c when calling GUIDRV_FlexColor_SetFunc(). The digit marked red enables (if 1) or disables (0) the cache:

    GUIDRV_FlexColor_SetFunc(pDevice, &PortAPI, GUIDRV_FLEXCOLOR_F66720, GUIDRV_FLEXCOLOR_M24C0B8);

    This not only true for the GUIDRV_FlexColor driver, but alos for other dirvers.

    If you take care about what you are doing in your application it is possible to have emWin running with about 5k of memory. As already said this depends highly on your application.

    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: segger.com/ticket/

    Or you can contact us via e-mail.