Forums

Getting my program to load (Code Composer)

Started by Larry Martell February 18, 2005
Hi-

I am using TI's Code Composer Studio version 2.20 with some
TMS320C6701's. I have written a very small test program, but I
cannot get it to load. When I try to build it it fails with this
message:

>> error: can't allocate .bss (sz: 00016dd4 page: 0) in IDRAM (avail:
0000ff04) I've gone into the IDRAM properities, but no matter what I change I can't get the program to build. I've tried making IDRAM larger, but if I make it any larger then 23,000 I get 100's of errors of the type:
>> error: relocation value truncated at 0x14 in section
.text:_SendAdStart, ...
>> error: relocation overflow occured at address 0x00000094 in
section ... If I make the size 23,000 I get:
>> error: can't allocate .IDRAM$heap (sz: 00004000 page: 0) in IDRAM
(avail: 00003d40) I've tried making the heap smaller, and I've tried moving some sections to other memory area, but no matter what it fails in one way or another. What am I doing wrong here or missing? As I said, this is a very small test program - nothing even close to what the real program will be. HELP! -larry
Larry Martell wrote:
> Hi- > > I am using TI's Code Composer Studio version 2.20 with some > TMS320C6701's. I have written a very small test program, but I > cannot get it to load. When I try to build it it fails with this > message: > > >>> error: can't allocate .bss (sz: 00016dd4 page: 0) in IDRAM (avail: > > 0000ff04) > > I've gone into the IDRAM properities, but no matter what I change I > can't get the program to build. I've tried making IDRAM larger, but > if I make it any larger then 23,000 I get 100's of errors of the type: > > >>> error: relocation value truncated at 0x14 in section > > .text:_SendAdStart, ... > >>> error: relocation overflow occured at address 0x00000094 in > > section ... > > If I make the size 23,000 I get: > > >>> error: can't allocate .IDRAM$heap (sz: 00004000 page: 0) in IDRAM > > (avail: 00003d40) > > I've tried making the heap smaller, and I've tried moving some > sections to other memory area, but no matter what it fails in one > way or another. > > What am I doing wrong here or missing? As I said, this is a very small > test program - nothing even close to what the real program will be. > > HELP! > > -larry >
Well, your .bss segment is HUGE. What is your itty bitty test program? If it's a "Hello World" type of thing written in C++ you may be pulling in all the libraries, which would cause you problems. Do you have any arrays defined? Could you have a typo in an array size specifier that might be making it enormous rather than economical? int nice_little_array[BASE_ARRAY_SIZE * 1000]; // like this instead int nice_little_array[BASE_ARRAY_SIZE / 1000]; // of this? -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
Tim Wescott wrote:
> Larry Martell wrote: > > Hi- > > > > I am using TI's Code Composer Studio version 2.20 with some > > TMS320C6701's. I have written a very small test program, but I > > cannot get it to load. When I try to build it it fails with this > > message: > > > > > >>> error: can't allocate .bss (sz: 00016dd4 page: 0) in IDRAM
(avail:
> > > > 0000ff04) > > > > I've gone into the IDRAM properities, but no matter what I change I > > can't get the program to build. I've tried making IDRAM larger, but > > if I make it any larger then 23,000 I get 100's of errors of the
type:
> > > > > >>> error: relocation value truncated at 0x14 in section > > > > .text:_SendAdStart, ... > > > >>> error: relocation overflow occured at address 0x00000094 in > > > > section ... > > > > If I make the size 23,000 I get: > > > > > >>> error: can't allocate .IDRAM$heap (sz: 00004000 page: 0) in
IDRAM
> > > > (avail: 00003d40) > > > > I've tried making the heap smaller, and I've tried moving some > > sections to other memory area, but no matter what it fails in one > > way or another. > > > > What am I doing wrong here or missing? As I said, this is a very
small
> > test program - nothing even close to what the real program will be. > > > > HELP! > > > > -larry > > > Well, your .bss segment is HUGE. What is your itty bitty test
program? I am trying to get some benchmark timing numbers for a piece of code.
> If it's a "Hello World" type of thing written in C++ you may be > pulling in all the libraries, which would cause you problems. Do you
> have any arrays defined? Could you have a typo in an array size > specifier that might be making it enormous rather than economical? > > int nice_little_array[BASE_ARRAY_SIZE * 1000]; // like this instead > int nice_little_array[BASE_ARRAY_SIZE / 1000]; // of this?
I do have a 10,000 element array of structures where the struct contains 2 ints. So that would be over 80K right there. Then I had a few other globals and statics. I planned to time the code I want to benchmark 10,000 times and get an average. But even when I dropped that array down to 1,000 it still failed with:
>> error: can't allocate .IDRAM$heap (sz: 00004000 page: 0) in IDRAM
(avail: 00002678) I found that if I upped the size of the IDRAM to 23,000 (which is the largest I could make it without the link blowing up) and made the array 1,000 then I could link successfully. So now I'm wondering: -How large is IDRAM? -What if I really do want that much global data? What can I do then? -If I were to move segments out of IDRAM, which would be the best ones to move? Thanks! -larry
Larry Martell wrote:

snip
>> >>Well, your .bss segment is HUGE. What is your itty bitty test > > program? > > I am trying to get some benchmark timing numbers for a piece of code. > > >> If it's a "Hello World" type of thing written in C++ you may be >>pulling in all the libraries, which would cause you problems. Do you > > >>have any arrays defined? Could you have a typo in an array size >>specifier that might be making it enormous rather than economical? >> >>int nice_little_array[BASE_ARRAY_SIZE * 1000]; // like this instead >>int nice_little_array[BASE_ARRAY_SIZE / 1000]; // of this? > > > I do have a 10,000 element array of structures where the struct > contains > 2 ints. So that would be over 80K right there. Then I had a few other > globals and statics. I planned to time the code I want to benchmark > 10,000 times and get an average. But even when I dropped that array > down > to 1,000 it still failed with: > > >>> error: can't allocate .IDRAM$heap (sz: 00004000 page: 0) in IDRAM > > (avail: 00002678) > > I found that if I upped the size of the IDRAM to 23,000 (which is the > largest > I could make it without the link blowing up) and made the array 1,000 > then > I could link successfully. > > So now I'm wondering: > > -How large is IDRAM?
Look in your data sheet -- it'll vary by part. The 23000 is probably the largest that can be addressed ever, not what your particular part has.
> -What if I really do want that much global data? What can I do then?
Get another part, or hook up some external memory and accept the speed hit.
> -If I were to move segments out of IDRAM, which would be the best ones > to > move?
Dunno -- I'm not familiar with the 6000 family.
>
Good luck! -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
Tim Wescott wrote:

(snip)

>> I do have a 10,000 element array of structures where the struct >> contains >> 2 ints. So that would be over 80K right there. Then I had a few other >> globals and statics. I planned to time the code I want to benchmark >> 10,000 times and get an average. But even when I dropped that array >> down to 1,000 it still failed with:
>>>> error: can't allocate .IDRAM$heap (sz: 00004000 page: 0) in IDRAM
Isn't it possible to compute the average on the processor instead of storing all 10000 values? In the days when computer memories were small, many memory efficient algorithms were developed which seem to be going out of use. If you store the sum and sum of squares you can compute mean and standard deviation. If you only have 16 bit arithmetic it will take a little work to do a 32 or 48 bit sum, but it shouldn't be so hard to do. -- glen
glen herrmannsfeldt wrote:
> Tim Wescott wrote: > > (snip) > > >> I do have a 10,000 element array of structures where the struct > >> contains > >> 2 ints. So that would be over 80K right there. Then I had a few
other
> >> globals and statics. I planned to time the code I want to
benchmark
> >> 10,000 times and get an average. But even when I dropped that
array
> >> down to 1,000 it still failed with: > > >>>> error: can't allocate .IDRAM$heap (sz: 00004000 page: 0) in
IDRAM
> > Isn't it possible to compute the average on the processor > instead of storing all 10000 values?
I don't want to slow down any part of the system by doing this. I am also timing some things on the P4 side too. Messages and data are being passed back and forth between the P4 and the DSP and if I stop and do some calculations it will skew the results. Thanks! -larry
Larry Martell wrote:

> I don't want to slow down any part of the system by doing this. I > am also timing some things on the P4 side too. Messages and data are > being passed back and forth between the P4 and the DSP and if I stop > and do some calculations it will skew the results.
Humm, OK. Do you have a spare IO pin? set it high at the start of your time consuming code then low at the end (probably one instruction each). Connect to simple RC lowpass filter and a meter and read off processor load directly (or to a scope if you are looking for exact timing details)! However, the code to compute a load average is not exactly complex and you should not even notice the extra load. It should be less then a page of assembler for anything even halfway reasonable. Regards, Dan.
This problem usually happens when you set the memory models 'near calls
& data' instead of 'far calls & data'. Check your CCS build
options->compiler->advanced

Dan Mills wrote:
> Larry Martell wrote: > > > I don't want to slow down any part of the system by doing this. I > > am also timing some things on the P4 side too. Messages and data
are
> > being passed back and forth between the P4 and the DSP and if I
stop
> > and do some calculations it will skew the results. > > > Humm, OK. > Do you have a spare IO pin? set it high at the start of your time
consuming
> code then low at the end (probably one instruction each). > Connect to simple RC lowpass filter and a meter and read off
processor load
> directly (or to a scope if you are looking for exact timing details)!
At had to smile at this because a EE I work with suggested the same thing. He suggested it to a room full of programmers ... we all looked at each other and smiled. And I said, "Well, that's a EE's solution ..." Thanks! -larry
Garrett wrote:
> This problem usually happens when you set the memory models 'near
calls
> & data' instead of 'far calls & data'. Check your CCS build > options->compiler->advanced
Thanks for the reply. I have solved this - it was 2 different issues: one was (as Tim has pointed out) that I simply had more things going into IDRAM then would fit. When I moved some things around and re-sized some things I got it to fit. The second issue was as you said, that I was using a near memory model, and I was trying to address beyond what that model would support. This experience was very useful to me as I learned a lot about the memory model and mapping of the devices. Thanks to all who replied! -larry