PIC32MX795 & heap_3.c malloc/free
Posted by Peter
on March 1, 2010
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.
void Task1(void * pvParameters)
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,
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.
Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd..
See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.