I am working with a STMicrolectronics Demo STM3221G-EVA board. This Demo uses on FreeRTOS. I would like to add a GUI Module into this demo. I have followed the documentation UM1550 STM32 Demonstration Builder developer guide, at Chapter 5 Building a Module. Also I have used the template file provided with the Demo, to add this new module and I was successful to include an icon in the right location.
Now, when I click in the icon the code goes to an infinite loop at: (arrowed part)
static void TEMPLATEINFOSwitchPage(GLPageTypeDef* pParent, uint32t PageIndex)
/* Switch to new page, and free previous one. */
GLPage_TypeDef* NextPage = NULL;
vPortFree(pParent); /<--- Code stuck here */
pParent = NULL;
if (PageIndex == PAGEMENU)
This function is referenced in the following function:
static void TEMPLATEINFOStartup (void)
vPortFree is a FreeRTOS function, but it may be a pointer problem where there's no definition of the pointer or something, I don't know. This Demo uses heap_2.c
The original Modules work ok. I am missing something here?
I have no clue about that code, but vPortFree() is a very small function in heap_2.c so you should be able to see where it gets stuck. I think the only place it could get stuck would be in the prvInsertBlockIntoFreeList() function, which would be an indication that the block being freed, or the heap itself, had been corrupted (overwritten) by something.
I just find out that if vPportFree(pParent) is replaced by free(pParent) works ok.
That tells you anything?
As you say you use heap_2 then if the memory was allocated with pvPortMalloc() then it must be freed by vPortFree(). If the memory was allocated by malloc() then it must be freed using free(). How was it allocated? You probably just leaked the memory.
Memory was allocated using malloc. That's why.
Thanks so much.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.