DSPRelated.com
Forums

Initialize large array into SDRAM on startup

Started by martlenn February 7, 2008
Hi everyone! I'm having this problem that I can't really sort out. I
have a selection of large float arrays, ranging from 500 to 5000 which
I want to initialize on startup by including them trough a h-file. In
the configuration, the section const is set to save values in SDRAM,
therefore I assumed this would work:

static const float my_array[5000] = {..,..,..}; //5000 float values

However, the linker keeps complaining. I've also tried to change the
size of the heap in SDRAM, but it didn't seem to help me. Maybe I
didn't make it large enough?

Any suggestions on how to solve this? The DSP I'm using is C6713.

Check Out Industry's First Single-Chip, Multi-Format, Real-Time HD Video Transcoding Solution for Commercial & Consumer End Equipment: www.ti.com/dm6467
martlenn,

A few questions..

--how large is a 'float'?
--what is the complaint from the linker?
--how large is the SDRAM?
--what is the specific content of the linker command file?

R. Williams

---------- Original Message -----------
From: "martlenn"
To: c...
Sent: Thu, 07 Feb 2008 13:30:57 -0000
Subject: [c6x] Initialize large array into SDRAM on startup

> Hi everyone! I'm having this problem that I can't really sort out. I
> have a selection of large float arrays, ranging from 500 to 5000 which
> I want to initialize on startup by including them trough a h-file. In
> the configuration, the section const is set to save values in SDRAM,
> therefore I assumed this would work:
>
> static const float my_array[5000] = {..,..,..}; //5000 float values
>
> However, the linker keeps complaining. I've also tried to change the
> size of the heap in SDRAM, but it didn't seem to help me. Maybe I
> didn't make it large enough?
>
> Any suggestions on how to solve this? The DSP I'm using is C6713.
------- End of Original Message -------

Check Out Industry's First Single-Chip, Multi-Format, Real-Time HD Video Transcoding Solution for Commercial & Consumer End Equipment: www.ti.com/dm6467
Hm, I thought I answered on this, but apparently not.. Awell.

> --how large is a 'float'?

32 bits according to the DSP manual.

> --what is the complaint from the linker?

I don't have access to that computer right now, so I'm not sure. I
_believe_ it was something about the IRAM heap, so that would indicate
the variables aren't loaded into SDRAM after all.

> --how large is the SDRAM?

16Mb.

> --what is the specific content of the linker command file?

The relevant parts of the .cmd-file should be:
/* MODULE MEM */
-stack 0x400
MEMORY {
IRAM : origin = 0x0, len = 0x4000
CACHE_L2 : origin = 0x34000, len = 0xc000
SDRAM : origin = 0x80000000, len = 0x1000000
}

And:

SECTIONS {
.bss: {} > IRAM

.far: {} > IRAM

.data: {} > SDRAM

.const: {} > SDRAM

/*EXCLUDED A LOT OF STUFF HERE THAT SHOULDN'T BE RELEVANT */
}

This file is autogenerated by Code Composer Studio. As far as I've
understood, this should be enough to make const values save into SDRAM
instead of IRAM. Does that assumption seem reasonable?

Check Out Industry's First Single-Chip, Multi-Format, Real-Time HD Video Transcoding Solution for Commercial & Consumer End Equipment: www.ti.com/dm6467
martlenn,

A look through the .map file would tell you the location of all the variables and their actual sizes.

If the linker complaint is that IRAM is not large enough, then move the .bss or .idata or .switch or
.heap or .stack to the SDRAM.

If the linker complaint is that some program segment is not being specifically allocated to a
specific area and so the linker is defaulting that program segment to be allocated in IRAM, that
would be ok.
(though the .cmd file should be updated to allocate all program segments.)

Again, look through the .map file to determine exactly where every program segment is being placed
in the memory map.

R. Williams

---------- Original Message -----------
From: "martlenn"
To: c...
Sent: Thu, 07 Feb 2008 19:48:19 -0000
Subject: [c6x] Re: Initialize large array into SDRAM on startup

> Hm, I thought I answered on this, but apparently not.. Awell.
>
> > --how large is a 'float'?
>
> 32 bits according to the DSP manual.
>
> > --what is the complaint from the linker?
>
> I don't have access to that computer right now, so I'm not sure. I
> _believe_ it was something about the IRAM heap, so that would indicate
> the variables aren't loaded into SDRAM after all.
>
> > --how large is the SDRAM?
>
> 16Mb.
>
> > --what is the specific content of the linker command file?
>
> The relevant parts of the .cmd-file should be:
>
> /* MODULE MEM */
> -stack 0x400
> MEMORY {
> IRAM : origin = 0x0, len = 0x4000
> CACHE_L2 : origin = 0x34000, len = 0xc000
> SDRAM : origin = 0x80000000, len = 0x1000000
> }
>
> And:
>
> SECTIONS {
> .bss: {} > IRAM
>
> .far: {} > IRAM
>
> .data: {} > SDRAM
>
> .const: {} > SDRAM
>
> /*EXCLUDED A LOT OF STUFF HERE THAT SHOULDN'T BE RELEVANT */
> }
>
> This file is autogenerated by Code Composer Studio. As far as I've
> understood, this should be enough to make const values save into SDRAM
> instead of IRAM. Does that assumption seem reasonable?
------- End of Original Message -------

Check Out Industry's First Single-Chip, Multi-Format, Real-Time HD Video Transcoding Solution for Commercial & Consumer End Equipment: www.ti.com/dm6467