Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

vPortFree on STM32 Demonstration Builder developer guide

Posted by erps on August 15, 2014

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.


vPortFree on STM32 Demonstration Builder developer guide

Posted by rtel on August 15, 2014

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.


vPortFree on STM32 Demonstration Builder developer guide

Posted by erps on August 15, 2014

I just find out that if vPportFree(pParent) is replaced by free(pParent) works ok. That tells you anything?


vPortFree on STM32 Demonstration Builder developer guide

Posted by edwards3 on August 15, 2014

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.


vPortFree on STM32 Demonstration Builder developer guide

Posted by erps on August 15, 2014

Memory was allocated using malloc. That's why. Thanks so much.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS