DSPRelated.com
Forums

Program jump to funny location - Creating Linker Command File

Started by #JONATHAN SANITO# January 22, 2003
Hi,

I am using TMS320C6000, C6711 DSK, with CCS v2.0

I am Writing a program that used some C library functions (fopen/fclose, etc)

I've experienced my program just jump to a funny location with NOPs. Does anyone
experienced it before? A friend (Rajeev) suggest the .cmd file to be changed. Is
there any constraint when creating this .cmd file? I am not too sure how to
create this .cmd file will makes the program run well, and not just jump to
somewhere. Anyone could highlight?

here is my .cmd file, took from one of the textbook I read.

MEMORY
{
PMEM : origin = 0x00000000, len = 0x00010000
EXT2 : origin = 0x02000000, len = 0x01000000
EXT3 : origin = 0x03000000, len = 0x01000000
DMEM : origin = 0x80000000, len = 0x00010000
}

SECTIONS
{
.vectors > PMEM
.text > PMEM

.bss > DMEM
.cinit > DMEM
.const > DMEM
.far > EXT2
.stack > DMEM
.cio > DMEM
.sysmem > DMEM
.mydata > EXT3
}

Thanks n regards,

Jonathan



Hi Jonathan,
Do the following changes, It will work. I feel there
is wrong memory allocation to the section .cinit as it
contains startup code to initialise the c envirnment.
change this in the cmd file.
.cinit > DMEM
to
.cinit > PMEM
Then compile and run

Amaresh --- #JONATHAN SANITO# <>
wrote:
> Hi,
>
> I am using TMS320C6000, C6711 DSK, with CCS v2.0
>
> I am Writing a program that used some C library
> functions (fopen/fclose, etc)
>
> I've experienced my program just jump to a funny
> location with NOPs. Does anyone experienced it
> before? A friend (Rajeev) suggest the .cmd file to
> be changed. Is there any constraint when creating
> this .cmd file? I am not too sure how to create this
> .cmd file will makes the program run well, and not
> just jump to somewhere. Anyone could highlight?
>
> here is my .cmd file, took from one of the textbook
> I read.
>
> MEMORY
> {
> PMEM : origin = 0x00000000, len =
> 0x00010000
> EXT2 : origin = 0x02000000, len =
> 0x01000000
> EXT3 : origin = 0x03000000, len =
> 0x01000000
> DMEM : origin = 0x80000000, len =
> 0x00010000
> }
>
> SECTIONS
> {
> .vectors > PMEM
> .text > PMEM
>
> .bss > DMEM
> .cinit > DMEM
> .const > DMEM
> .far > EXT2
> .stack > DMEM
> .cio > DMEM
> .sysmem > DMEM
> .mydata > EXT3
> }
>
> Thanks n regards,
>
> Jonathan >
>


__________________________________________________


Hi,

I have traced my program. It turns out the one that creates my program jumps to
funny location was this "printf" statement. It was my 2nd "printf" of the
program. The 1st printf works perfectly, but the 2nd "printf" as I traced out it
goes to undefined memory location after sometime.

If anyone have suggestions please help me on this.

Thanks n regards,

Jonathan

-----Original Message-----
From: #JONATHAN SANITO#
Sent: Wed 1/22/2003 12:47 PM
To:
Cc:
Subject: Program jump to funny location - Creating Linker Command File
Hi,

I am using TMS320C6000, C6711 DSK, with CCS v2.0

I am Writing a program that used some C library functions (fopen/fclose, etc)

I've experienced my program just jump to a funny location with NOPs. Does
anyone experienced it before? A friend (Rajeev) suggest the .cmd file to be
changed. Is there any constraint when creating this .cmd file? I am not too sure
how to create this .cmd file will makes the program run well, and not just jump
to somewhere. Anyone could highlight?

here is my .cmd file, took from one of the textbook I read.

MEMORY
{
PMEM : origin = 0x00000000, len = 0x00010000
EXT2 : origin = 0x02000000, len = 0x01000000
EXT3 : origin = 0x03000000, len = 0x01000000
DMEM : origin = 0x80000000, len = 0x00010000
}

SECTIONS
{
.vectors > PMEM
.text > PMEM

.bss > DMEM
.cinit > DMEM
.const > DMEM
.far > EXT2
.stack > DMEM
.cio > DMEM
.sysmem > DMEM
.mydata > EXT3
}

Thanks n regards,

Jonathan



If you are using the correct GEL file before
loading the OUT, DSK's SDRAM should be correctly
initialized so placing .cinit in external memory
is not a problem.

If you don't use the GEL, then SDRAM is not working
but then you will get error messages when loading.

Are you sure that the cache is not enabled ?

By the way, it seems to me that you are using
a CMD file for a 6201/6701 and not for a 6211/6711.
A 6x01 have 64KB internal PMEM (program) and 64 KB
internal DMEM (data memory).
The 6x11 doesn't have this. It have only 64KB IRAM (internal)
which can be used both for program and memory. Moreover,
on the DSK you get around 16MB of SDRAM at 0x80000000.

the MEMORY section for DSK is more generally as follow :

MEMORY
{
vecs: o = 00000000h l = 00000200h
IRAM: o = 00000200h l = 0000FE00h
SDRAM: o = 80000000h l = 01000000h
}

By the way, to conclude on 6x01 you cannot place
.cinit in PMEM, only in DMEM or external memory. Jean-Michel MERCIER

--
dsp & imaging - www.ateme.com
ATEME - 26 Burospace - 91573 BIEVRES
Tel : +33 (0)1 69 35 89 73 (direct)
Fax : +33 (0)1 60 19 13 95


 RE: [code-comp] Program jump to funny location - Creating Linker Command File
#JONATHAN SANITO#  wrote :
> However I've tried to correct my linker command as you've suggested, but the problem still persists. 
> The program just jump to nowhere, right after 'printf' statement. It is the 2nd printf statement of my program. 
> The 1st printf do prints the statement correctly. If I commented all my printfs, my program will run Ok, 
> until it met fopen statement. This fopen will leads the program to nowhere as well. 
 
I believe that you have some king of map problem.
 
Check the mat file provided by CCS linker (you may have to activate
this feature by changing linker options).
Look for sections that could be mapped at a bad place.
 
printf and fopen both use a section called .CIO
Try to place it in internal memory. It may helps.
 
 Best regards,

        Jean-Michel MERCIER

--
dsp & imaging - www.ateme.com
ATEME - 26 Burospace - 91573 BIEVRES
Tel : +33 (0)1 69 35 89 73 (direct)
Fax : +33 (0)1 60 19 13 95

 
Do you have any suggestions?
 
Thanks in advance,
 
Jonathan
-----Original Message-----
From: Jean-Michel MERCIER [mailto:j...@ateme.fr]
Sent: Thu 1/23/2003 4:57 PM
To: #JONATHAN SANITO#
Cc:
Subject: RE: [code-comp] Program jump to funny location - Creating Linker Command File


If you are using the correct GEL file before
loading the OUT, DSK's SDRAM should be correctly
initialized so placing .cinit in external memory
is not a problem.

If you don't use the GEL, then SDRAM is not working
but then you will get error messages when loading.

Are you sure that the cache is not enabled ?

By the way, it seems to me that you are using
a CMD file for a 6201/6701 and not for a 6211/6711.
A 6x01 have 64KB internal PMEM (program) and 64 KB
internal DMEM (data memory).
The 6x11 doesn't have this. It have only 64KB IRAM (internal)
which can be used both for program and memory. Moreover,
on the DSK you get around 16MB of SDRAM at 0x80000000.

the MEMORY section for DSK is more generally as follow :
 
MEMORY
{
    vecs:   o = 00000000h  l = 00000200h
    IRAM:   o = 00000200h  l = 0000FE00h                          
    SDRAM:  o = 80000000h  l = 01000000h
}

By the way, to conclude on 6x01 you cannot place
.cinit in PMEM, only in DMEM or external memory.        Jean-Michel MERCIER

--
dsp & imaging - www.ateme.com
ATEME - 26 Burospace - 91573 BIEVRES
Tel : +33 (0)1 69 35 89 73 (direct)
Fax : +33 (0)1 60 19 13 95



Attachment (not stored)
winmail.dat
Type: application/ms-tnef

Jonathan-

Is your 2nd printf() located in an ISR? What is the difference between what our
code
is doing when the 1st one is called, and the 2nd one?

Jeff Brower
DSP sw/hw engineer
Signalogic #JONATHAN SANITO# wrote:
>
> Hi,
>
> I have traced my program. It turns out the one that creates my program jumps
to funny location was this "printf" statement. It was my 2nd "printf" of the
program. The 1st printf works perfectly, but the 2nd "printf" as I traced out it
goes to undefined memory location after sometime.
>
> If anyone have suggestions please help me on this.
>
> Thanks n regards,
>
> Jonathan
>
> -----Original Message-----
> From: #JONATHAN SANITO#
> Sent: Wed 1/22/2003 12:47 PM
> To:
> Cc:
> Subject: Program jump to funny location - Creating Linker Command File >
> Hi,
>
> I am using TMS320C6000, C6711 DSK, with CCS v2.0
>
> I am Writing a program that used some C library functions
(fopen/fclose, etc)
>
> I've experienced my program just jump to a funny location with NOPs.
Does anyone experienced it before? A friend (Rajeev) suggest the .cmd file to be
changed. Is there any constraint when creating this .cmd file? I am not too sure
how to create this .cmd file will makes the program run well, and not just jump
to somewhere. Anyone could highlight?
>
> here is my .cmd file, took from one of the textbook I read.
>
> MEMORY
> {
> PMEM : origin = 0x00000000, len = 0x00010000
> EXT2 : origin = 0x02000000, len = 0x01000000
> EXT3 : origin = 0x03000000, len = 0x01000000
> DMEM : origin = 0x80000000, len = 0x00010000
> }
>
> SECTIONS
> {
> .vectors > PMEM
> .text > PMEM
>
> .bss > DMEM
> .cinit > DMEM
> .const > DMEM
> .far > EXT2
> .stack > DMEM
> .cio > DMEM
> .sysmem > DMEM
> .mydata > EXT3
> }
>
> Thanks n regards,
>
> Jonathan >
> _____________________________________
> Note: If you do a simple "reply" with your email client, only the author of
this message will receive your answer. You need to do a "reply all" if you want
your answer to be distributed to the entire group.
>
> _____________________________________
> About this discussion group:
>
> To Join:
>
> To Post:
>
> To Leave:
>
> Archives: http://www.yahoogroups.com/group/code-comp
>
> More Groups: http://www.dsprelated.com > ">http://docs.yahoo.com/info/terms/