Forums

Memory Allocation - Absolute Addressing

Started by terzakis June 13, 2006
Hello all.
I am using the c6713 texas instrument dsk and i need to place sections of
code in specific memory locations. I want to do this because i will use
the branch register command. I thaught about making memory sections by
changing the .cmd file, in specific addresses, and then store the code i
want in these sections by using the .sect directive. I use 8 sections. My
cmd file is like the next lines:

--------------------------------------------------------------------------
/*C6713dsk.cmd  Linker command file*/

MEMORY
{
  IVECS:    org=0h,  		len=0x220
  IRAM:		org=0x00000220,	len=0x0002FCBE 	/*internal memory*/
  SDRAM:	org=0x80000000, len=0x00150000 	/*external memory*/
  CHLINE1:	org=0x80150000, len=0x200		/*line change 1*/
  CHFRAME1:	org=0x80150300, len=0x600		/*frame change 1*/
  CHLINE2:	org=0x80150A00, len=0x200		/*line change 2*/
  CHFRAME2:	org=0x80150C00, len=0xF600		/*frame change 2*/
  WAITDATA:	org=0x80160200, len=0x200		/*wait data taking*/
  NP1:		org=0x80160400, len=0x600		/*not possible*/
  TAKEDATA:	org=0x80160A00, len=0x200		/*take data*/
  NP2:		org=0x80160C00, len=0x0FE9F600	/*not possible*/              	
  FLASH:	org=0x90000200, len=0x00010000 	/*flash memory*/                 
  
}

SECTIONS
{
  .EXT_RAM :> SDRAM
  .vectors :> IVECS	/*in vector file*/
  .text    :> IRAM	/*Created by C Compiler*/
  .bss     :> IRAM
  .cinit   :> IRAM
  .stack   :> IRAM
  .sysmem  :> IRAM
  .const   :> IRAM
  .switch  :> IRAM
  .far     :> IRAM
  .cio     :> IRAM
  .csldata :> IRAM
  .chline1 :> CHLINE1
  .chframe1 :> CHFRAME1
  .chline2  :> CHLINE2
  .chframe2 :> CHFRAME2
  .waitdata :> WAITDATA
  .np1       :> NP1
  .takedata :> TAKEDATA
  .np2       :> NP2 	
}
--------------------------------------------------------------------------

The error i am taking from the linker is the following:

--------------------------------------------------------------------------
 error: relocation overflow occured at address 0x00000018 in section
            '.chframe1' of input file 'C:\c6713\myprojects\CMOSWrite
            MemoryLineCheck(v2)\Debug\CMOSWrite MemoryLineCheck(v2).obj'. 
The
            29-bit PC-relative displacement 536527180 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. 
--------------------------------------------------------------------------

Does anybody knows what is wrong?????


terzakis wrote:
> Hello all. > I am using the c6713 texas instrument dsk and i need to place sections of > code in specific memory locations. I want to do this because i will use > the branch register command. I thaught about making memory sections by > changing the .cmd file, in specific addresses, and then store the code i > want in these sections by using the .sect directive. I use 8 sections. My > cmd file is like the next lines: > > -------------------------------------------------------------------------- > /*C6713dsk.cmd Linker command file*/ > > MEMORY > { > IVECS: org=0h, len=0x220 > IRAM: org=0x00000220, len=0x0002FCBE /*internal memory*/ > SDRAM: org=0x80000000, len=0x00150000 /*external memory*/ > CHLINE1: org=0x80150000, len=0x200 /*line change 1*/ > CHFRAME1: org=0x80150300, len=0x600 /*frame change 1*/ > CHLINE2: org=0x80150A00, len=0x200 /*line change 2*/ > CHFRAME2: org=0x80150C00, len=0xF600 /*frame change 2*/ > WAITDATA: org=0x80160200, len=0x200 /*wait data taking*/ > NP1: org=0x80160400, len=0x600 /*not possible*/ > TAKEDATA: org=0x80160A00, len=0x200 /*take data*/ > NP2: org=0x80160C00, len=0x0FE9F600 /*not possible*/ > FLASH: org=0x90000200, len=0x00010000 /*flash memory*/ > > } > > SECTIONS > { > .EXT_RAM :> SDRAM > .vectors :> IVECS /*in vector file*/ > .text :> IRAM /*Created by C Compiler*/ > .bss :> IRAM > .cinit :> IRAM > .stack :> IRAM > .sysmem :> IRAM > .const :> IRAM > .switch :> IRAM > .far :> IRAM > .cio :> IRAM > .csldata :> IRAM > .chline1 :> CHLINE1 > .chframe1 :> CHFRAME1 > .chline2 :> CHLINE2 > .chframe2 :> CHFRAME2 > .waitdata :> WAITDATA > .np1 :> NP1 > .takedata :> TAKEDATA > .np2 :> NP2 > } > -------------------------------------------------------------------------- > > The error i am taking from the linker is the following: > > -------------------------------------------------------------------------- > error: relocation overflow occured at address 0x00000018 in section > '.chframe1' of input file 'C:\c6713\myprojects\CMOSWrite > MemoryLineCheck(v2)\Debug\CMOSWrite MemoryLineCheck(v2).obj'. > The > 29-bit PC-relative displacement 536527180 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. > -------------------------------------------------------------------------- > > Does anybody knows what is wrong?????
Check your memory model under Project | Build Options... | Compiler | Advanced. You probably need a different one (e.g., far). Cheers! --M
>terzakis wrote: >> Hello all. >> I am using the c6713 texas instrument dsk and i need to place sections
of
>> code in specific memory locations. I want to do this because i will
use
>> the branch register command. I thaught about making memory sections by >> changing the .cmd file, in specific addresses, and then store the code
i
>> want in these sections by using the .sect directive. I use 8 sections.
My
>> cmd file is like the next lines: >> >>
--------------------------------------------------------------------------
>> /*C6713dsk.cmd Linker command file*/ >> >> MEMORY >> { >> IVECS: org=0h, len=0x220 >> IRAM: org=0x00000220, len=0x0002FCBE /*internal memory*/ >> SDRAM: org=0x80000000, len=0x00150000 /*external memory*/ >> CHLINE1: org=0x80150000, len=0x200 /*line change 1*/ >> CHFRAME1: org=0x80150300, len=0x600 /*frame change 1*/ >> CHLINE2: org=0x80150A00, len=0x200 /*line change 2*/ >> CHFRAME2: org=0x80150C00, len=0xF600 /*frame change 2*/ >> WAITDATA: org=0x80160200, len=0x200 /*wait data taking*/ >> NP1: org=0x80160400, len=0x600 /*not possible*/ >> TAKEDATA: org=0x80160A00, len=0x200 /*take data*/ >> NP2: org=0x80160C00, len=0x0FE9F600 /*not possible*/ >> FLASH: org=0x90000200, len=0x00010000 /*flash memory*/ >> >> } >> >> SECTIONS >> { >> .EXT_RAM :> SDRAM >> .vectors :> IVECS /*in vector file*/ >> .text :> IRAM /*Created by C Compiler*/ >> .bss :> IRAM >> .cinit :> IRAM >> .stack :> IRAM >> .sysmem :> IRAM >> .const :> IRAM >> .switch :> IRAM >> .far :> IRAM >> .cio :> IRAM >> .csldata :> IRAM >> .chline1 :> CHLINE1 >> .chframe1 :> CHFRAME1 >> .chline2 :> CHLINE2 >> .chframe2 :> CHFRAME2 >> .waitdata :> WAITDATA >> .np1 :> NP1 >> .takedata :> TAKEDATA >> .np2 :> NP2 >> } >>
--------------------------------------------------------------------------
>> >> The error i am taking from the linker is the following: >> >>
--------------------------------------------------------------------------
>> error: relocation overflow occured at address 0x00000018 in section >> '.chframe1' of input file 'C:\c6713\myprojects\CMOSWrite >> MemoryLineCheck(v2)\Debug\CMOSWrite
MemoryLineCheck(v2).obj'.
>> The >> 29-bit PC-relative displacement 536527180 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. >>
--------------------------------------------------------------------------
>> >> Does anybody knows what is wrong????? > >Check your memory model under Project | Build Options... | Compiler | >Advanced. You probably need a different one (e.g., far). > >Cheers! --M > >
Thank you --M, but unfortunately I did what you told me, but I got the same error message, for every memory model. I am taking 5 error messages (as the above) for eachone of the .sect directive I use in my code(.sect ".chframe1" , .sect ".chline2" , .sect ".chframe2" , .sect ".waitdata" , .sect ".takedata"). Any other suggestions???????
terzakis wrote:
>> terzakis wrote: >>> Hello all. >>> I am using the c6713 texas instrument dsk and i need to place sections > of >>> code in specific memory locations. I want to do this because i will > use >>> the branch register command. I thaught about making memory sections by >>> changing the .cmd file, in specific addresses, and then store the code > i >>> want in these sections by using the .sect directive. I use 8 sections. > My >>> cmd file is like the next lines: >>> >>> > -------------------------------------------------------------------------- >>> /*C6713dsk.cmd Linker command file*/ >>> >>> MEMORY >>> { >>> IVECS: org=0h, len=0x220 >>> IRAM: org=0x00000220, len=0x0002FCBE /*internal memory*/ >>> SDRAM: org=0x80000000, len=0x00150000 /*external memory*/ >>> CHLINE1: org=0x80150000, len=0x200 /*line change 1*/ >>> CHFRAME1: org=0x80150300, len=0x600 /*frame change 1*/ >>> CHLINE2: org=0x80150A00, len=0x200 /*line change 2*/ >>> CHFRAME2: org=0x80150C00, len=0xF600 /*frame change 2*/ >>> WAITDATA: org=0x80160200, len=0x200 /*wait data taking*/ >>> NP1: org=0x80160400, len=0x600 /*not possible*/ >>> TAKEDATA: org=0x80160A00, len=0x200 /*take data*/ >>> NP2: org=0x80160C00, len=0x0FE9F600 /*not possible*/ >>> FLASH: org=0x90000200, len=0x00010000 /*flash memory*/ >>> >>> } >>> >>> SECTIONS >>> { >>> .EXT_RAM :> SDRAM >>> .vectors :> IVECS /*in vector file*/ >>> .text :> IRAM /*Created by C Compiler*/ >>> .bss :> IRAM >>> .cinit :> IRAM >>> .stack :> IRAM >>> .sysmem :> IRAM >>> .const :> IRAM >>> .switch :> IRAM >>> .far :> IRAM >>> .cio :> IRAM >>> .csldata :> IRAM >>> .chline1 :> CHLINE1 >>> .chframe1 :> CHFRAME1 >>> .chline2 :> CHLINE2 >>> .chframe2 :> CHFRAME2 >>> .waitdata :> WAITDATA >>> .np1 :> NP1 >>> .takedata :> TAKEDATA >>> .np2 :> NP2 >>> } >>> > -------------------------------------------------------------------------- >>> The error i am taking from the linker is the following: >>> >>> > -------------------------------------------------------------------------- >>> error: relocation overflow occured at address 0x00000018 in section >>> '.chframe1' of input file 'C:\c6713\myprojects\CMOSWrite >>> MemoryLineCheck(v2)\Debug\CMOSWrite > MemoryLineCheck(v2).obj'. >>> The >>> 29-bit PC-relative displacement 536527180 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. >>> > -------------------------------------------------------------------------- >>> Does anybody knows what is wrong????? >> Check your memory model under Project | Build Options... | Compiler | >> Advanced. You probably need a different one (e.g., far). >> >> Cheers! --M >> >> > Thank you --M, but unfortunately I did what you told me, but I got the > same error message, for every memory model. > I am taking 5 error messages (as the above) for eachone of the .sect > directive I use in my code(.sect ".chframe1" , .sect ".chline2" , .sect > ".chframe2" , .sect ".waitdata" , .sect ".takedata"). > Any other suggestions??????? > >
Are you writing assembly code? The option mentioned before applies to C code in which case you would be use pragma DATA_SECTION to specify where to put your data. If you're writing your code in assembly and getting this error then you should change your instruction: b symbol to MVKL symbol, B3 (or some other reg) MVKH symbol, B3 B B3 This would essentially implement the "far" call. Brad
terzakis wrote:
>> terzakis wrote: >>> Hello all. >>> I am using the c6713 texas instrument dsk and i need to place sections > of >>> code in specific memory locations. I want to do this because i will > use >>> the branch register command. I thaught about making memory sections by >>> changing the .cmd file, in specific addresses, and then store the code > i >>> want in these sections by using the .sect directive. I use 8 sections. > My >>> cmd file is like the next lines: >>> >>> > -------------------------------------------------------------------------- >>> /*C6713dsk.cmd Linker command file*/ >>> >>> MEMORY >>> { >>> IVECS: org=0h, len=0x220 >>> IRAM: org=0x00000220, len=0x0002FCBE /*internal memory*/ >>> SDRAM: org=0x80000000, len=0x00150000 /*external memory*/ >>> CHLINE1: org=0x80150000, len=0x200 /*line change 1*/ >>> CHFRAME1: org=0x80150300, len=0x600 /*frame change 1*/ >>> CHLINE2: org=0x80150A00, len=0x200 /*line change 2*/ >>> CHFRAME2: org=0x80150C00, len=0xF600 /*frame change 2*/ >>> WAITDATA: org=0x80160200, len=0x200 /*wait data taking*/ >>> NP1: org=0x80160400, len=0x600 /*not possible*/ >>> TAKEDATA: org=0x80160A00, len=0x200 /*take data*/ >>> NP2: org=0x80160C00, len=0x0FE9F600 /*not possible*/ >>> FLASH: org=0x90000200, len=0x00010000 /*flash memory*/ >>> >>> } >>> >>> SECTIONS >>> { >>> .EXT_RAM :> SDRAM >>> .vectors :> IVECS /*in vector file*/ >>> .text :> IRAM /*Created by C Compiler*/ >>> .bss :> IRAM >>> .cinit :> IRAM >>> .stack :> IRAM >>> .sysmem :> IRAM >>> .const :> IRAM >>> .switch :> IRAM >>> .far :> IRAM >>> .cio :> IRAM >>> .csldata :> IRAM >>> .chline1 :> CHLINE1 >>> .chframe1 :> CHFRAME1 >>> .chline2 :> CHLINE2 >>> .chframe2 :> CHFRAME2 >>> .waitdata :> WAITDATA >>> .np1 :> NP1 >>> .takedata :> TAKEDATA >>> .np2 :> NP2 >>> } >>> > -------------------------------------------------------------------------- >>> The error i am taking from the linker is the following: >>> >>> > -------------------------------------------------------------------------- >>> error: relocation overflow occured at address 0x00000018 in section >>> '.chframe1' of input file 'C:\c6713\myprojects\CMOSWrite >>> MemoryLineCheck(v2)\Debug\CMOSWrite > MemoryLineCheck(v2).obj'. >>> The >>> 29-bit PC-relative displacement 536527180 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. >>> > -------------------------------------------------------------------------- >>> Does anybody knows what is wrong????? >> Check your memory model under Project | Build Options... | Compiler | >> Advanced. You probably need a different one (e.g., far). >> >> Cheers! --M >> >> > Thank you --M, but unfortunately I did what you told me, but I got the > same error message, for every memory model. > I am taking 5 error messages (as the above) for eachone of the .sect > directive I use in my code(.sect ".chframe1" , .sect ".chline2" , .sect > ".chframe2" , .sect ".waitdata" , .sect ".takedata"). > Any other suggestions??????? > >
Are you writing assembly code? The option mentioned before applies to C code in which case you would be use pragma DATA_SECTION to specify where to put your data. If you're writing your code in assembly and getting this error then you should change your instruction: b symbol to MVKL symbol, B3 (or some other reg) MVKH symbol, B3 B B3 This would essentially implement the "far" call. Brad
I believe that I should explain to all of you my problem in order to
understand what I am trying to do.

So, I have a register that takes 8 specific values. I want at the same
values of the PC (with the values of the register), to place code
(propably assembly code), in order to jump there by the "branch using a
register" instruction, according to the values of the register.

That is why I am using the .sect directive, in order to place code in
specific addresses of the memory. These addresses, have the same values as
the values that the register may take.

The memory allocation, for the specific addresse values, take place at the
cmd file, as I have written above.

So I believe, that I have placed the code wherever I need, and that I
could do the jump by the
B reg
instruction.

Unfortunatelly, when I am trying, to build the project, I am taking the
error message I wrote above.

I am new with the dsp engineering, so I need help.
Please post me a suggestion.
Thank you all...   
terzakis wrote:
> I believe that I should explain to all of you my problem in order to > understand what I am trying to do. > > So, I have a register that takes 8 specific values. I want at the same > values of the PC (with the values of the register), to place code > (propably assembly code), in order to jump there by the "branch using a > register" instruction, according to the values of the register. > > That is why I am using the .sect directive, in order to place code in > specific addresses of the memory. These addresses, have the same values as > the values that the register may take. > > The memory allocation, for the specific addresse values, take place at the > cmd file, as I have written above. > > So I believe, that I have placed the code wherever I need, and that I > could do the jump by the > B reg > instruction. > > Unfortunatelly, when I am trying, to build the project, I am taking the > error message I wrote above. > > I am new with the dsp engineering, so I need help. > Please post me a suggestion. > Thank you all...
There are two types of branches: ; relative branch b symbol ; absolute branch mvkl #symbol, reg mvkh #symbol, reg b reg The linker error you are getting is referring to the first type of branch, i.e. a relative branch to a symbol. Perhaps you are focused on the wrong bit of code. Somewhere in that file you must be doing a relative branch or else you would not be getting that error. Change the relative branch to an absolute branch or your error will disappear. If you're still having problems then please answer some questions: 1) Is the MemoryLineCheck file written in assembly? 2) If the answer to question 1 is yes, then why are you using assembly? Is the compiler not giving enough optimization? 3) Can you post your current MemoryLineCheck code?