DSPRelated.com
Forums

memory allocation problem

Started by Simone Winkler January 26, 2005
Hello,

I'm trying to statically allocate a matrix in an external SDRAM. I'm using 
the C6713 processor.

when I insert the following lines into my code:

 #pragma DATA_SECTION(a, ".userdef");
 float a[M][M];

with M as big as 375 and userdef defined as SDRAM in a separate cmd-file,
everything seems to be fine for the start address of the matrix. But when I 
look at the lines for exampe a[1], it gets an address of 0x55555555, same 
for all the lines of the matrix.

What can be the problem?

Before, I tried to solve everything by malloc() (respectively MEM_alloc), 
but somehow I got some lines addressed to 0xAAAAAAAA (it was the lines 
250-260 or something like that), while the others seemed to point to the 
right address.

Can you help me?

Thank you,
Simone 


Simone Winkler schrieb:
> Hello, > > I'm trying to statically allocate a matrix in an external SDRAM. I'm using > the C6713 processor. > > when I insert the following lines into my code: > > #pragma DATA_SECTION(a, ".userdef"); > float a[M][M]; > > with M as big as 375 and userdef defined as SDRAM in a separate cmd-file, > everything seems to be fine for the start address of the matrix. But when I > look at the lines for exampe a[1], it gets an address of 0x55555555, same > for all the lines of the matrix. > > What can be the problem? > > Before, I tried to solve everything by malloc() (respectively MEM_alloc), > but somehow I got some lines addressed to 0xAAAAAAAA (it was the lines > 250-260 or something like that), while the others seemed to point to the > right address. > > Can you help me? > > Thank you, > Simone > >
Hallo Simone, I am not familiar with TI DSP's but you could try to do the following: Check your map-file for the location of '.userdef' and the location of a. You may have to enable an "xref" option to get the location of every variable. If this result is reasonable write a small function like void memtest (void) { float t; t = a[0][0]; t = t + 1.0; a[0][1] = t; } compile it and look at the assembly. You should be able to locate a memory read with the base address of 'a' and a subsequent write with an offset of 4. If these addresses are in your SDRAM and it still does not work your problems are not related to the compiler or linker - more likely the SDRAM-controller or the external bus interface. Regards Markus