Quality RTOS & Embedded Software

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


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.

UINT8 recbuf[300];

void Task1(void * pvParameters)
while(1) {

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.

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

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.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists