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




Loading

FreeRTOS on NXP LPC1788, malloc() failure with heap_3.c

Posted by jshentu on May 21, 2016

Hello,

I am experiencing failure with malloc() function. Details of the target system is given as below: MCU: LPC1788FBD208 OS: FreeRTOS SDRAM: MT48LC4M16A2 Original Evaluation Kit: UEZGUI-1788-70WVT Sample Project: uEZv2.06SourceForge

I am using the heap_3.c module. Function malloc() is dead at first time when it is called, requiring 76 bytes to be allocated. When I check the configuration of the heap size, it is far bigger than the required size. Could you technical support guys help identify the problem? Thanks in advance.


heap_3 code

~~~ void *pvPortMalloc( size_t xWantedSize ) { void *pvReturn;

vTaskSuspendAll(); { pvReturn = malloc(xWantedSize ); } xTaskResumeAll();

if( configUSEMALLOCFAILED_HOOK == 1 )

{ if( pvReturn == NULL ) { extern void vApplicationMallocFailedHook( void ); vApplicationMallocFailedHook(); } }

endif

return pvReturn; } ~~~


Heap Size defined in FreeRTOSConfig.h

~~~

ifndef configMINIMALSTACKSIZE
define configMINIMALSTACKSIZE ( 128 )
endif
ifndef configTOTALHEAPSIZE
define configTOTALHEAPSIZE ( ( size_t ) (( 32 * 1024 ) - 64))
endif

~~~

I have tried to increase the heap size up to 48k and reduce the heap size to 20k. The malloc dead lock keeps the same. There is no improvement.


FreeRTOS on NXP LPC1788, malloc() failure with heap_3.c

Posted by rtel on May 21, 2016

Sample Project: uEZv2.06SourceForge

That is not a demo we provide ourselves (I don't think?), and as it seems to be a SourceForge project (guessing from FDI) then they will have a support forum too.

I am using the heap_3.c module. Function malloc() is dead at first time when it is called, requiring 76 bytes to be allocated. When I check the configuration of the heap size, it is far bigger than the required size. Could you technical support guys help identify the problem? Thanks in advance.

If you are using heap3 then FreeRTOS is not providing the heap implementation, it is simply wrapping the calls to malloc() to make them thread safe. The heap is provided by your C run time environment, and configTOTALHEAP_SIZE is not being used. See http://www.freertos.org/a00111.html for more information.

Regards.


[ 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