DSPRelated.com
Forums

program allocation problem - linker command file

Started by markan_b January 30, 2003
Hi everyone,

My cmd-file:
********************************************************************
/*C6xdsk.cmd Generic Linker command file*/

MEMORY
{
VECS: org = 0h, len = 0x220 /* 528 Byte */
IRAM: org = 0x00000220, len = 0x0000FDC0 /* 64k*/
SDRAM: org = 0x80000000, len = 0x01000000 /* 16M*/
FLASH: org = 0x90000000, len = 0x00020000 /*flash 128k*/
}

SECTIONS
{
vectors :> SDRAM
.text :> SDRAM //IRAM
.bss :> IRAM
.cinit :> IRAM
.stack :> IRAM
.sysmem :> SDRAM
.const :> IRAM
.switch :> IRAM
.far :> SDRAM
.cio :> SDRAM
}
**********************************************************************
BACKGROUND:
===========
As my c-code (-> and so .text too) is much larger than 64k -> I have
to put .text into SDRAM, but in this case "vectors" (containing ISR)
cannot remain in IRAM or even VECS ...because of this ERROR-Message:
*******************************************************************
<Linking>
>> error: relocation overflow occured at address 0x00000160 in
section
'vectors' of input file
'C:\ti\myprojects\DA_out_in\Debug\vectors_11.obj'. The
32-bit
PC-relative displacement -536860104 at this location is
too large
to fit into the 21-bit PC-Relative field; the destination
address
is too far away from the instruction. You may need to add
a mask to
the assembly instruction or use other target specific
assembly
features if you really only need the lowest 21 bits of
this symbol.
Please see the section on Relocation in the Assembly
User's Guide.
********************************************************************* My questions:
1. could somebody answer my question, why, in this case,
does "vectors"-section have to be in the same memory like the ".text"-
section ....cause I do not know what this error-message means ???
2. can I expect any speed losings if I let .text and "vectors" in
SDRAM (because it works that way) I thank you in advance,
Marko P.S.: I'am working with:
DSK6711 & CCS 2.10.0



Hi,
Regarding your first question, I guess changing the memory model to large model
( are far : -ml3 option) will help.
Regarding the second question, vectors wont have a great impact on your
application unless of course you are using some HWI.
Placing your code on ISRAM does improve the performance of the application but
depends on the application you are trying to build.
But generally L1P misses are avoided when you place the code on ISRAM.
Hope this helps.
Regards,
Ganesh

----- Original Message -----
From: markan_b <>
To:
Sent: Thursday, January 30, 2003 3:39 PM
Subject: [c6x] program allocation problem - linker command file Hi everyone,

My cmd-file:
********************************************************************
/*C6xdsk.cmd Generic Linker command file*/

MEMORY
{
VECS: org = 0h, len = 0x220 /* 528 Byte */
IRAM: org = 0x00000220, len = 0x0000FDC0 /* 64k*/
SDRAM: org = 0x80000000, len = 0x01000000 /* 16M*/
FLASH: org = 0x90000000, len = 0x00020000 /*flash 128k*/
}

SECTIONS
{
vectors :> SDRAM
.text :> SDRAM //IRAM
.bss :> IRAM
.cinit :> IRAM
.stack :> IRAM
.sysmem :> SDRAM
.const :> IRAM
.switch :> IRAM
.far :> SDRAM
.cio :> SDRAM
}
**********************************************************************
BACKGROUND:
===========
As my c-code (-> and so .text too) is much larger than 64k -> I have
to put .text into SDRAM, but in this case "vectors" (containing ISR)
cannot remain in IRAM or even VECS ...because of this ERROR-Message:
*******************************************************************
<Linking>
>> error: relocation overflow occured at address 0x00000160 in
section
'vectors' of input file
'C:\ti\myprojects\DA_out_in\Debug\vectors_11.obj'. The
32-bit
PC-relative displacement -536860104 at this location is
too large
to fit into the 21-bit PC-Relative field; the destination
address
is too far away from the instruction. You may need to add
a mask to
the assembly instruction or use other target specific
assembly
features if you really only need the lowest 21 bits of
this symbol.
Please see the section on Relocation in the Assembly
User's Guide.
********************************************************************* My questions:
1. could somebody answer my question, why, in this case,
does "vectors"-section have to be in the same memory like the ".text"-
section ....cause I do not know what this error-message means ???
2. can I expect any speed losings if I let .text and "vectors" in
SDRAM (because it works that way) I thank you in advance,
Marko P.S.: I'am working with:
DSK6711 & CCS 2.10.0
_____________________________________
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: Send an email to

To Post: Send an email to

To Leave: Send an email to

Archives: http://www.yahoogroups.com/group/c6x

Other Groups: http://www.dsprelated.com ">http://docs.yahoo.com/info/terms/


Ok,

All instructions on a c6000 DSP are 32 bit, including the
branchinstruction that is in your vector.
Since some of the 32 instruction bits must be used to determin that it
is a branchinstruction and not something else
only 21 bits can be used to tell where to jump. 21 bits is 2097152 and
since all instructions start at even words
the address range that can be described is 8388608 bytes. This is not
all of the existing address range on a c6000.
Therefor the branch is relative to the current address and the 21 bits
are considered a signed offset.

If your branch instruction is at 0x160 and you want to jump to code
located at 0x80000000 as your linker file tells
the linker it wont work out. There are another version of the branch
instruction that jumps to a address in a register:

MVKL 0x80000000,A0
MVKH 0x80000000,A0
B A0

That works for all of the address space and if you put that in the ISR
the linker will be happy.

The external SDRAM are orders of magnitude slower that the internal
memory. You should look into reconfiguring all or part of
the internal memory as cache.

/Regards, P Ligander

markan_b wrote:

>Hi everyone,
>
>My cmd-file:
>********************************************************************
>/*C6xdsk.cmd Generic Linker command file*/
>
>MEMORY
>{
> VECS: org = 0h, len = 0x220 /* 528 Byte */
> IRAM: org = 0x00000220, len = 0x0000FDC0 /* 64k*/
> SDRAM: org = 0x80000000, len = 0x01000000 /* 16M*/
> FLASH: org = 0x90000000, len = 0x00020000 /*flash 128k*/
>}
>
>SECTIONS
>{
> vectors :> SDRAM
> .text :> SDRAM //IRAM
> .bss :> IRAM
> .cinit :> IRAM
> .stack :> IRAM
> .sysmem :> SDRAM
> .const :> IRAM
> .switch :> IRAM
> .far :> SDRAM
> .cio :> SDRAM
>}
>**********************************************************************
>BACKGROUND:
>===========
>As my c-code (-> and so .text too) is much larger than 64k -> I have
>to put .text into SDRAM, but in this case "vectors" (containing ISR)
>cannot remain in IRAM or even VECS ...because of this ERROR-Message:
>*******************************************************************
><Linking >>> error: relocation overflow occured at address 0x00000160 in
>>>
>>>
>section
> 'vectors' of input file
> 'C:\ti\myprojects\DA_out_in\Debug\vectors_11.obj'. The
>32-bit
> PC-relative displacement -536860104 at this location is
>too large
> to fit into the 21-bit PC-Relative field; the destination
>address
> is too far away from the instruction. You may need to add
>a mask to
> the assembly instruction or use other target specific
>assembly
> features if you really only need the lowest 21 bits of
>this symbol.
> Please see the section on Relocation in the Assembly
>User's Guide.
>********************************************************************* >My questions:
>1. could somebody answer my question, why, in this case,
>does "vectors"-section have to be in the same memory like the ".text"-
>section ....cause I do not know what this error-message means ???
>2. can I expect any speed losings if I let .text and "vectors" in
>SDRAM (because it works that way) >I thank you in advance,
>Marko >P.S.: I'am working with:
> DSK6711 & CCS 2.10.0 >
>_____________________________________
>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: Send an email to
>
>To Post: Send an email to
>
>To Leave: Send an email to
>
>Archives: http://www.yahoogroups.com/group/c6x
>
>Other Groups: http://www.dsprelated.com >">http://docs.yahoo.com/info/terms/ >
>




Markan,

The message means that your external memory is beyond the reach of a 21
bit pointer from the internal memory.

It means that you have to change your memory model so that "far"
pointers are used. The downside is that this makes acceses using those
pointers take longer. Take a look at -ml1, from memory I think that's what you need.
Pete Warnes
Technical director
HUNT ENGINEERING (U.K.) Ltd
email
URL http://www.hunteng.co.uk or http://www.hunt-dsp.com
phone +44 (0)1278 760188
direct +44 (0)1278 760966
GSM +44 (0)7711 190099
Fax +44 (0)1278 760199 > -----Original Message-----
> From: markan_b <> [mailto:]
> Sent: Thursday, January 30, 2003 10:10 AM
> To:
> Subject: [c6x] program allocation problem - linker command file > Hi everyone,
>
> My cmd-file:
> ********************************************************************
> /*C6xdsk.cmd Generic Linker command file*/
>
> MEMORY
> {
> VECS: org = 0h, len = 0x220 /* 528 Byte */
> IRAM: org = 0x00000220, len = 0x0000FDC0 /* 64k*/
> SDRAM: org = 0x80000000, len = 0x01000000 /* 16M*/
> FLASH: org = 0x90000000, len = 0x00020000 /*flash 128k*/
> }
>
> SECTIONS
> {
> vectors :> SDRAM
> .text :> SDRAM //IRAM
> .bss :> IRAM
> .cinit :> IRAM
> .stack :> IRAM
> .sysmem :> SDRAM
> .const :> IRAM
> .switch :> IRAM
> .far :> SDRAM
> .cio :> SDRAM
> }
> **********************************************************************
> BACKGROUND:
> ===========
> As my c-code (-> and so .text too) is much larger than 64k -> I have
> to put .text into SDRAM, but in this case "vectors" (containing ISR)
> cannot remain in IRAM or even VECS ...because of this ERROR-Message:
> *******************************************************************
> <Linking>
> >> error: relocation overflow occured at address 0x00000160 in
> section
> 'vectors' of input file
> 'C:\ti\myprojects\DA_out_in\Debug\vectors_11.obj'. The
> 32-bit
> PC-relative displacement -536860104 at this location is
> too large
> to fit into the 21-bit PC-Relative field; the destination
> address
> is too far away from the instruction. You may need to add
> a mask to
> the assembly instruction or use other target specific
> assembly
> features if you really only need the lowest 21 bits of
> this symbol.
> Please see the section on Relocation in the Assembly
> User's Guide.
> ********************************************************************* > My questions:
> 1. could somebody answer my question, why, in this case,
> does "vectors"-section have to be in the same memory like the ".text"-
> section ....cause I do not know what this error-message means ???
> 2. can I expect any speed losings if I let .text and "vectors" in
> SDRAM (because it works that way) > I thank you in advance,
> Marko > P.S.: I'am working with:
> DSK6711 & CCS 2.10.0 >
> _____________________________________
> 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: Send an email to
>
> To Post: Send an email to
>
> To Leave: Send an email to
>
> Archives: http://www.yahoogroups.com/group/c6x
>
> Other Groups: http://www.dsprelated.com > ">http://docs.yahoo.com/info/terms/




P-

That's a great answer. Really clear.

Jeff Brower
DSP sw/hw engineer
Signalogic

> All instructions on a c6000 DSP are 32 bit, including the
> branchinstruction that is in your vector.
> Since some of the 32 instruction bits must be used to determin that it
> is a branchinstruction and not something else
> only 21 bits can be used to tell where to jump. 21 bits is 2097152 and
> since all instructions start at even words
> the address range that can be described is 8388608 bytes. This is not
> all of the existing address range on a c6000.
> Therefor the branch is relative to the current address and the 21 bits
> are considered a signed offset.
>
> If your branch instruction is at 0x160 and you want to jump to code
> located at 0x80000000 as your linker file tells
> the linker it wont work out. There are another version of the branch
> instruction that jumps to a address in a register:
>
> MVKL 0x80000000,A0
> MVKH 0x80000000,A0
> B A0
>
> That works for all of the address space and if you put that in the ISR
> the linker will be happy.
>
> The external SDRAM are orders of magnitude slower that the internal
> memory. You should look into reconfiguring all or part of
> the internal memory as cache.
>
> /Regards, P Ligander
>
> markan_b wrote:
>
> >Hi everyone,
> >
> >My cmd-file:
> >********************************************************************
> >/*C6xdsk.cmd Generic Linker command file*/
> >
> >MEMORY
> >{
> > VECS: org = 0h, len = 0x220 /* 528 Byte */
> > IRAM: org = 0x00000220, len = 0x0000FDC0 /* 64k*/
> > SDRAM: org = 0x80000000, len = 0x01000000 /* 16M*/
> > FLASH: org = 0x90000000, len = 0x00020000 /*flash 128k*/
> >}
> >
> >SECTIONS
> >{
> > vectors :> SDRAM
> > .text :> SDRAM //IRAM
> > .bss :> IRAM
> > .cinit :> IRAM
> > .stack :> IRAM
> > .sysmem :> SDRAM
> > .const :> IRAM
> > .switch :> IRAM
> > .far :> SDRAM
> > .cio :> SDRAM
> >}
> >**********************************************************************
> >BACKGROUND:
> >===========
> >As my c-code (-> and so .text too) is much larger than 64k -> I have
> >to put .text into SDRAM, but in this case "vectors" (containing ISR)
> >cannot remain in IRAM or even VECS ...because of this ERROR-Message:
> >*******************************************************************
> ><Linking>
> >
> >
> >>> error: relocation overflow occured at address 0x00000160 in
> >>>
> >>>
> >section
> > 'vectors' of input file
> > 'C:\ti\myprojects\DA_out_in\Debug\vectors_11.obj'. The
> >32-bit
> > PC-relative displacement -536860104 at this location is
> >too large
> > to fit into the 21-bit PC-Relative field; the destination
> >address
> > is too far away from the instruction. You may need to add
> >a mask to
> > the assembly instruction or use other target specific
> >assembly
> > features if you really only need the lowest 21 bits of
> >this symbol.
> > Please see the section on Relocation in the Assembly
> >User's Guide.
> >*********************************************************************
> >
> >
> >My questions:
> >1. could somebody answer my question, why, in this case,
> >does "vectors"-section have to be in the same memory like the ".text"-
> >section ....cause I do not know what this error-message means ???
> >2. can I expect any speed losings if I let .text and "vectors" in
> >SDRAM (because it works that way)
> >
> >
> >I thank you in advance,
> >Marko
> >
> >
> >P.S.: I'am working with:
> > DSK6711 & CCS 2.10.0