DSPRelated.com
Forums

cmd file and library problem

Started by opel...@yahoo.de March 7, 2007
Hi guys,

We are working on a prototype platform with an C6414 DSP which has 1MB of heap, and our platform addionally has 16MB of external SDRAM. By now I've written programs which are small enough to fit into the range reserved for the program and I mainly used the SDRAM for swapping in and out of larger memory blocks - that works fine.
Now I want to upload a program which includes two librarys, one with about 450kB and one with about 550kB. The libraries contain moreless arrays of constants which I need for calculations in my program. Because I can afford it to reserve 1MB of my SDRAM for external libraries I have used a special gel-file and I have rewritten my cmd file to contain a 1MB section for the libraries at the end of the SDRAM block. The project compiles correctly without any linker complaints, and when uploading the file, it seems to upload all libraries to the dedicated memory area. Nevertheless, when I try to, lets say, simply printf a single number from these arrays in my main.c it is always zero.

Here is how my cmd file looks like:

/******************************************************/

-stack 0x02000 /* stack */
-heap 0xD0000 /* allocate maximum free memory */
-c
-x

-l dsp64x.lib
-l fastrts64x.lib
-l rts6400.lib
-l img64x.lib
-l dev6400.lib
-l dev.lib /* Generic dev lib */
-l lib1.lib
-l lib2.lib

MEMORY
{
BOOT: org = 0x00000000, len = 0x00000400 /* Bootloader Area */
VECT: org = 0x00000400, len = 0x00000260 /* interrupt vectors */
IRAMP: org = 0x00000660, len = 0x0002F9A0
IRAMD: org = 0x00030000, len = 0x000D0000
SDRAM: org = 0x80000000, len = 0x00F00000 /* SDRAM, 15 MByte */
SDRAMP: org = 0x80F00000, len = 0x00100000 /* External Library Section */
}

SECTIONS
{
/* generic icam v2 sections */
.bootloader > BOOT fill= 0
.vec > VECT fill= 0
.text > IRAMP fill= 0
.bss > IRAMP fill= 0
.data > IRAMP fill= 0
.cinit > IRAMP fill= 0
.stack > IRAMP fill= 0
.sysmem > IRAMD
.const > IRAMP fill= 0
.switch > IRAMP fill= 0
.far > IRAMP fill= 0
.cio > IRAMP fill= 0
.nettextslow > IRAMP fill= 0
.nettextfast > IRAMP fill= 0
.appli > IRAMP fill= 0
.tables > IRAMP fill= 0
.sdram > SDRAM
/* external libraries */
.sdramp > SDRAMP
{
-llib1.lib
-llib2.lib
}

}

/******************************************************/

Any ideas how to correct the problems? I'm stuck and I have no idea how to correct it...

Best Regards
Clemens
Hi Clemens,

did you use the far data memory model for your project and the
libraries? Otherwise the DSP will use near access (+/-32K offset) and read
from the wrong memory location. Since you specified to zero-fill all unused
memory locations, it is quite likely a zero is printed in this case.
The compiler nevertheless should have given a warning like "relocation
value truncated" or similar...

Regards,
Adolf Klemenz, D.SignT
At 01:32 06.03.2007 -0500, o...@yahoo.de wrote:

>Hi guys,
>
>We are working on a prototype platform with an C6414 DSP which has 1MB of
>heap, and our platform addionally has 16MB of external SDRAM. By now I've
>written programs which are small enough to fit into the range reserved for
>the program and I mainly used the SDRAM for swapping in and out of larger
>memory blocks - that works fine.
>Now I want to upload a program which includes two librarys, one with about
>450kB and one with about 550kB. The libraries contain moreless arrays of
>constants which I need for calculations in my program. Because I can
>afford it to reserve 1MB of my SDRAM for external libraries I have used a
>special gel-file and I have rewritten my cmd file to contain a 1MB section
>for the libraries at the end of the SDRAM block. The project compiles
>correctly without any linker complaints, and when uploading the file, it
>seems to upload all libraries to the dedicated memory area. Nevertheless,
>when I try to, lets say, simply printf a single number from these arrays
>in my main.c it is always zero.
>
>Here is how my cmd file looks like:
>
>/******************************************************/
>
>-stack 0x02000 /* stack */
>-heap 0xD0000 /* allocate maximum free memory */
>-c
>-x
>
>-l dsp64x.lib
>-l fastrts64x.lib
>-l rts6400.lib
>-l img64x.lib
>-l dev6400.lib
>-l dev.lib /* Generic dev lib */
>-l lib1.lib
>-l lib2.lib
>
>MEMORY
>{
>BOOT: org = 0x00000000, len = 0x00000400 /* Bootloader Area */
>VECT: org = 0x00000400, len = 0x00000260 /* interrupt vectors */
>IRAMP: org = 0x00000660, len = 0x0002F9A0
>IRAMD: org = 0x00030000, len = 0x000D0000
>SDRAM: org = 0x80000000, len = 0x00F00000 /* SDRAM, 15 MByte */
>SDRAMP: org = 0x80F00000, len = 0x00100000 /* External Library Section */
>}
>
>SECTIONS
>{
>/* generic icam v2 sections */
>.bootloader > BOOT fill= 0
>.vec > VECT fill= 0
>.text > IRAMP fill= 0
>.bss > IRAMP fill= 0
>.data > IRAMP fill= 0
>.cinit > IRAMP fill= 0
>.stack > IRAMP fill= 0
>.sysmem > IRAMD
>.const > IRAMP fill= 0
>.switch > IRAMP fill= 0
>.far > IRAMP fill= 0
>.cio > IRAMP fill= 0
>.nettextslow > IRAMP fill= 0
>.nettextfast > IRAMP fill= 0
>.appli > IRAMP fill= 0
>.tables > IRAMP fill= 0
>.sdram > SDRAM
>/* external libraries */
>.sdramp > SDRAMP
>{
>-llib1.lib
>-llib2.lib
>}
>
>}
>
>/******************************************************/
>
>Any ideas how to correct the problems? I'm stuck and I have no idea how to
>correct it...
>
>Best Regards
>Clemens
>
opel,

What does the 'main' look like?
does the linker build options indicate the 'large memory model'?

have you defined the data as 'far'?

R. Williams

---------- Original Message -----------
From: o...@yahoo.de
To: c...
Sent: Tue, 06 Mar 2007 01:32:54 -0500
Subject: [c6x] cmd file and library problem

> Hi guys,
>
> We are working on a prototype platform with an C6414 DSP which has
> 1MB of heap, and our platform addionally has 16MB of external SDRAM.
> By now I've written programs which are small enough to fit into the
> range reserved for the program and I mainly used the SDRAM for
> swapping in and out of larger memory blocks - that works fine. Now I
> want to upload a program which includes two librarys, one with about
> 450kB and one with about 550kB. The libraries contain moreless
> arrays of constants which I need for calculations in my program.
> Because I can afford it to reserve 1MB of my SDRAM for external
> libraries I have used a special gel-file and I have rewritten my cmd
> file to contain a 1MB section for the libraries at the end of the
> SDRAM block. The project compiles correctly without any linker
> complaints, and when uploading the file, it seems to upload all
> libraries to the dedicated memory area. Nevertheless, when I try to,
> lets say, simply printf a single number from these arrays in my
> main.c it is always zero.
>
> Here is how my cmd file looks like:
>
> /******************************************************/
>
> -stack 0x02000 /* stack */
> -heap 0xD0000 /* allocate maximum free memory */
> -c
> -x
>
> -l dsp64x.lib
> -l fastrts64x.lib
> -l rts6400.lib
> -l img64x.lib
> -l dev6400.lib
> -l dev.lib /* Generic dev lib */
> -l lib1.lib
> -l lib2.lib
>
> MEMORY
> {
> BOOT: org = 0x00000000, len = 0x00000400 /* Bootloader
> Area */ VECT: org = 0x00000400, len = 0x00000260 /*
> interrupt vectors */ IRAMP: org = 0x00000660, len = 0x0002F9A0
> IRAMD: org = 0x00030000, len = 0x000D0000
> SDRAM: org = 0x80000000, len > 0x00F00000 /* SDRAM, 15 MByte */ SDRAMP: org = 0x80F00000,
> len = 0x00100000 /* External Library Section */ }
>
> SECTIONS
> {
> /* generic icam v2 sections */
> .bootloader > BOOT fill= 0
> .vec > VECT fill= 0
> .text > IRAMP fill= 0
> .bss > IRAMP fill= 0
> .data > IRAMP fill= 0
> .cinit > IRAMP fill= 0
> .stack > IRAMP fill= 0
> .sysmem > IRAMD
> .const > IRAMP fill= 0
> .switch > IRAMP fill= 0
> .far > IRAMP fill= 0
> .cio > IRAMP fill= 0
> .nettextslow > IRAMP fill= 0
> .nettextfast > IRAMP fill= 0
> .appli > IRAMP fill= 0
> .tables > IRAMP fill= 0
> .sdram > SDRAM
> /* external libraries */
> .sdramp > SDRAMP
> {
> -llib1.lib
> -llib2.lib
> }
>
> }
>
> /******************************************************/
>
> Any ideas how to correct the problems? I'm stuck and I have no idea
> how to correct it...
>
> Best Regards
> Clemens
------- End of Original Message -------