Malloc allocation Failed using Redlib

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Malloc allocation Failed using Redlib

1,088 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by praveen.9123 on Wed Feb 26 05:31:05 MST 2014
Hi,
I am using ngx lpc4330 xplorer board in an LPCExpresso IDE.
Included Redlib library in my Project i have used malloc for allocation of memory.
But Malloc allocation is failing and Returned NULL.
How can i allocate memory using Malloc. 
Labels (1)
0 Kudos
Reply
5 Replies

975 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by praveen.9123 on Thu Feb 27 01:52:11 MST 2014
Hi,
Its working fine with adding that code in the following link.

http://www.lpcware.com/content/faq/malloc-failure-using-freertos-heap3c-lpcxpresso-tool-chain

Thanks for your support.

Regards,
Praveen
0 Kudos
Reply

975 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Wed Feb 26 23:44:39 MST 2014
I imagine that you are encountering something similar to  the issue that the LPCOpen team have described at:

http://www.lpcware.com/content/faq/malloc-failure-using-freertos-heap3c-lpcxpresso-tool-chain

Note that we would recommend that you do not untick the "No startup…" option.

Regards,
LPCXpresso Support
0 Kudos
Reply

975 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by praveen.9123 on Wed Feb 26 22:50:56 MST 2014
Hi,

We are facing the below build error by having stdlib instead of redlib

/usr/local/lpcxpresso_6.1.0_164/lpcxpresso/tools/bin/../lib/gcc/arm-none-eabi/4.6.2/../../../../arm-none-eabi/lib/armv7e-m/libc.a(lib_a-readr.o): In function `_read_r':
readr.c:(.text._read_r+0x10): undefined reference to `_read'

Please help us to rectify the same.

Regards,
Praveen
0 Kudos
Reply

975 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by praveen.9123 on Wed Feb 26 21:55:05 MST 2014
Hi,
As i am using ngx lpc4330 xplorer board. I am using the audio loopback source code from ngx.
I have added the FreeRTOS to that audio loopback and calling a thread then i have included Mp3 decoder to that code and in that decoder there is a malloc for allocation of memory for Decoder headers.
When i am debugging the source i found that memory allocation failed using malloc.

As i have checked for allocating a 4 bytes using malloc it is getting failed. These all are included with Redlib(No host) library.

Later i have excluded the REDLIB then i have using standard library by unmarking in properties of Workspace.
-> c/c++ build -> settings -> tool settings -> MCU Linker -> General -> unmarked (No startup or Default Libraries(-nostdlib)).
Then allocation of memory works fine but it is limited (I have checked up to 2048bytes). There is a problem that getting error
undefined reference to _read;
undefined reference to _lseek; 
0 Kudos
Reply

975 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Wed Feb 26 13:40:00 MST 2014
Please provide more details? mallco() retuning null means that there is no more memory to allocate. So, please explain how you got into this situation.
0 Kudos
Reply