FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [August 2014 Threads]
Hi:
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;
(pParent).ShowPage(pParent, GL_FALSE);
DestroyPage(pParent);
vPortFree(pParent); /<--- Code stuck here */
pParent = NULL;
if (PageIndex == PAGEMENU)
{
GLShowMainMenu();
return;
}
This function is referenced in the following function:
static void TEMPLATEINFOStartup (void)
{
vTaskSuspend(CoreTimeTaskHandle);
TEMPLATEINFOSwitchPage(GLHomePage, TEMPLATEMAINPAGE);
}
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?
Thanks.
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.
Regards.
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.