Quality RTOS & Embedded Software

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




Loading

PIC32MX795 & heap_3.c malloc/free

Posted by Peter on March 1, 2010
Hello,

i have two issues:

Issue 1: I've experiencing a strange issue when using heap_3.c. I've decided to use heap_3.c for being compatible with the USB Stack provided by Microchip. For testing i have create one task which just shows the current tasks defined in the system and also created a vApplicationMallocFailedHook() function to see if iam running out of available memory. My application task and the idle task will be created without any problems and even the scheduler runs as expected. But the sprintf() function used in vTaskList just returns an empty string. I have reserved 40kB heap memory by the linker and 0 bytes for the stack (as done in the demo application provided with FreeRTOS). Both tasks do not use more than 4 kBytes.

UINT8 recbuf[300];

void Task1(void * pvParameters)
{
while(1) {
vTaskList(&recbuf[0]);
vTaskDelay(1000);
}
}

If iam using heap_1.c or heap_2.c sprintf is working as expected. Does someone has an idea what iam doing wrong?

Issue 2: If other functions use malloc/free (like the USB stack from Microchip). And if this stack is running within a task, shall i replace the malloc()/free() function by the thread safe functions pvPortMalloc/vPortFree?!

Thanks in advance for the help,
Peter

RE: PIC32MX795 & heap_3.c malloc/free

Posted by MEdwards on March 1, 2010
Cant help with your first problem, but for the second I would say yes if the functions are called from more than one task then convert to use pvPortMalloc and vPortFree. I think microchip have an application note on integrating their software with FreeRTOS that goes through these things.


[ 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