embOS OS_malloc and memory usage... where's it come from?

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

  • embOS OS_malloc and memory usage... where's it come from?

    I have a question on "third party" packages using malloc(). I am using an external RAM chip on an Infineon CPU, using embOS and emWin on a new product. I believe that emWin needs to allocate memory within a call. For instance when creating a Sprite, some memory needs to be available. The question is how do I tell emWin or embOS which and where the RAM is located in the address space?
  • Hi,
    emWin does not allocate dynamic memory from the heap.
    A heap is not required and malloc() is not used.
    emWin comes with it's own memory management module.
    The "dynamic" memory used by emWin can be configured using the GUI_ALLOC_* functions.
    In our samples, we use the GUI_X_Init() function to allocate the memory:
    #define GUI_NUMBYTES 0x100000
    #define GUI_BLOCKSIZE 128

    void GUI_X_Config(void) {
    static U32 aMemory[GUI_NUMBYTES >> 2];
    GUI_ALLOC_AssignMemory(aMemory, GUI_NUMBYTES);
    The GUI_ALLOC_AssignMemory() function takes a pointer to the base address of the memory pool.
    There is no need to use a variable.
    Using a variable has the advantage, that the linker controls the size and address of the memory and it can not be used twice.