DSPRelated.com
Forums

Memory allocation issues

Started by thed...@yahoo.com July 26, 2008
I am using the PEP5416 with code composer v3.1, and am having problems with memory allocation.

In my code, I use the malloc() command multiple times, though after awhile, the program starts to return null pointers, indicating that I cannot allocate any more memory. The problem I'm having is that I have no idea where this memory is being allocated.

I've been making changes using DSP/BIOS and the "build options" configurations, and ended up getting the program to allocate more memory when I changed the heap size in the IDATA section from 0x0200 to 0x0800. Unfortunately, I occasionally get problems running the code, where the program load starts to fail, and requires me to close code composer and re-power everything.

Can anyone help me out on this one? Where is this memory being allocated, and how can I make the necessary changes to properly allocate memory in the correct locations (preferably using DSP/BIOS and the configuration tool). Thanks.
Hello,

malloc() function allocates chunk of memory on the heap which is assigned to data memory. Check whether you have given the proper size for heap memory in linker command file. Send me the command linker file which you are using, so that I will modify accordingly and return back to you.

Regards
Sridhar. A

----- Original Message ----
From: "t...@yahoo.com"
To: c...
Sent: Saturday, 26 July, 2008 9:45:50 PM
Subject: [c54x] Memory allocation issues
I am using the PEP5416 with code composer v3.1, and am having problems with memory allocation.

In my code, I use the malloc() command multiple times, though after awhile, the program starts to return null pointers, indicating that I cannot allocate any more memory. The problem I'm having is that I have no idea where this memory is being allocated.

I've been making changes using DSP/BIOS and the "build options" configurations, and ended up getting the program to allocate more memory when I changed the heap size in the IDATA section from 0x0200 to 0x0800. Unfortunately, I occasionally get problems running the code, where the program load starts to fail, and requires me to close code composer and re-power everything.

Can anyone help me out on this one? Where is this memory being allocated, and how can I make the necessary changes to properly allocate memory in the correct locations (preferably using DSP/BIOS and the configuration tool). Thanks.
Thanks for sending the new linker file. The one problem I'm having is including it in the project. If I modify the linker command file and rebuild the project, it overwrites my changes. Do you know if I can change the linker command file without having DSP/BIOS change it upon rebuilding the project? Thanks.
--- In c..., thedoctor152003@... wrote:
>
> Thanks for sending the new linker file. The one problem I'm having is including it in the
project. If I modify the linker command file and rebuild the project, it overwrites my
changes. Do you know if I can change the linker command file without having DSP/BIOS
change it upon rebuilding the project? Thanks.
>

One way is to rename your new linker file and then include the DSP/BIOS one in yours. Don't
forget to change CCS to include your new linker file name. Not my favorite way to get the job
done, but it works.

Another way is to use both files in your CCS project after you rename your file. The only
issue I've had here is getting the files to link in the order you want if you have the need for it
to do so.

Regards,
-Aaron
AS-

> --- In c..., thedoctor152003@... wrote:
> >
> > Thanks for sending the new linker file. The one problem I'm having is including it in the
> project. If I modify the linker command file and rebuild the project, it overwrites my
> changes. Do you know if I can change the linker command file without having DSP/BIOS
> change it upon rebuilding the project? Thanks.
> > One way is to rename your new linker file and then include the DSP/BIOS one in yours. Don't
> forget to change CCS to include your new linker file name. Not my favorite way to get the job
> done, but it works.
>
> Another way is to use both files in your CCS project after you rename your file. The only
> issue I've had here is getting the files to link in the order you want if you have the need for it
> to do so.

In CCS the "multiple .cmd file link-order issue" can sorta be solved by naming the
command files alphabetically:

A_thisonefirst.cmd
B_someotherone.cmd

Not great, but usable.

-Jeff