Technical discussions about the TI C55x DSPs (including the c5501, c5502, c5503, c5507, c5509, c5510 and OMAP5910).
Hi all, I am trying to port a project written fully in C54x assembly to C55x processor. After digging through the migration document and changing things that need to be changed, all files have been built without assembly errors. Yet, when I compile the source following error occurs during the link: "error: relocation overflow occured at address 0x00000123 in section '.text' The 17-bit relocated address 0x00001BFF8 is too large to encode in the 16-bit field..." It has something to do with either the 64K page boundry problems or far calls in the C54X assembly code. I set the build options to large memory model, divided the whole memory into 64Kbyte sections and allocated carefully each variable to appropriate section to get around the page boundry problem. I used "MASM55 -ml *.asm" and "cl55 -ml -o *.obj *.asm" before adding the asm files to my project. Yet, everything I have done is hopeless. Do you guys have any idea other than manually replacing each branch instruction to a far call instruction? I am talking about thousands of lines of assembly code. By the way, I could not locate the build option to change the RTS call mode to Far call !!! (I'm using CCS 3.1 with EVM5509A.) any help would be appreciated, TayyaR.
Tayyar-
> I am trying to port a project written fully in C54x assembly to C55x
> processor.
> After digging through the migration document and changing things that
> need to be changed, all files have been built without assembly errors.
>
> Yet, when I compile the source following error occurs during the link:
> "error: relocation overflow occured at address 0x00000123 in section
> '.text' The 17-bit relocated address 0x00001BFF8 is too large to encode
> in the 16-bit field..."
>
> It has something to do with either the 64K page boundry problems or
> far calls in the C54X assembly code.
>
> I set the build options to large memory model, divided the whole
> memory into 64Kbyte sections and allocated carefully each variable to
> appropriate section to get around the page boundry problem. I used
> "MASM55 -ml *.asm" and "cl55 -ml -o *.obj *.asm" before adding the
asm
> files to my project.
>
> Yet, everything I have done is hopeless. Do you guys have any idea
> other than manually replacing each branch instruction to a far call
> instruction? I am talking about thousands of lines of assembly code.
I suggest to use something like a macro include file that translates the 54x name to
correct mnemonic. I included an example below. Yes you have to replace each
instruction with the "xxx_mac" name, but that's an edit-and-replace sweep, not too
bad. Plus you can test it first using 54x mode to make sure you get identical code
build and haven't missed any occurrences or made the wrong replacement.
-Jeff
; far_mode.mac
; macros used to build far-call, far-return .asm files
; Copyright (C) Signalogic, 2001
; created: JUL 2001, JHB
ret_mac .macro
.if ($isdefed("FAR_MODE"))
.if ($isdefed("_ALG_MODE"))
far return
.else
FRET
.endif
.else
.if ($isdefed("_ALG_MODE"))
return
.else
RET
.endif
.endif
.endm
retd_mac .macro
.if ($isdefed("FAR_MODE"))
.if ($isdefed("_ALG_MODE"))
far dreturn
.else
FRETD
.endif
.else
.if ($isdefed("_ALG_MODE"))
dreturn
.else
RETD
.endif
.endif
.endm
call_mac .macro a
.if ($isdefed("FAR_MODE"))
.if ($isdefed("_ALG_MODE"))
far call a
.else
FCALL a
.endif
.else
CALL a
.endif
.endm
calld_mac .macro a
.if ($isdefed("FAR_MODE"))
.if ($isdefed("_ALG_MODE"))
far dcall a
.else
FCALLD a
.endif
.else
.if ($isdefed("_ALG_MODE"))
dcall a
.else
CALLD a
.endif
.endif
.endm
I used your macro and moved the data into the first 64K, then it worked..
all linker errors were vanished..
thanks for the tip..
TayyaR.
Jeff Brower <j...@signalogic.com> wrote:
Tayyar-
> I am trying to port a project written fully in C54x assembly to C55x
> processor.
> After digging through the migration document and changing things that
> need to be changed, all files have been built without assembly errors.
>
> Yet, when I compile the source following error occurs during the link:
> "error: relocation overflow occured at address 0x00000123 in section
> '.text' The 17-bit relocated address 0x00001BFF8 is too large to encode
> in the 16-bit field..."
>
> It has something to do with either the 64K page boundry problems or
> far calls in the C54X assembly code.
>
> I set the build options to large memory model, divided the whole
> memory into 64Kbyte sections and allocated carefully each variable to
> appropriate section to get around the page boundry problem. I used
> "MASM55 -ml *.asm" and "cl55 -ml -o *.obj *.asm" before adding the
asm
> files to my project.
>
> Yet, everything I have done is hopeless. Do you guys have any idea
> other than manually replacing each branch instruction to a far call
> instruction? I am talking about thousands of lines of assembly code.
I suggest to use something like a macro include file that translates the 54x name to
correct mnemonic. I included an example below. Yes you have to replace each
instruction with the "xxx_mac" name, but that's an edit-and-replace sweep, not too
bad. Plus you can test it first using 54x mode to make sure you get identical code
build and haven't missed any occurrences or made the wrong replacement.
-Jeff
; far_mode.mac
; macros used to build far-call, far-return .asm files
; Copyright (C) Signalogic, 2001
; created: JUL 2001, JHB
ret_mac .macro
.if ($isdefed("FAR_MODE"))
.if ($isdefed("_ALG_MODE"))
far return
.else
FRET
.endif
.else
.if ($isdefed("_ALG_MODE"))
return
.else
RET
.endif
.endif
.endm
retd_mac .macro
.if ($isdefed("FAR_MODE"))
.if ($isdefed("_ALG_MODE"))
far dreturn
.else
FRETD
.endif
.else
.if ($isdefed("_ALG_MODE"))
dreturn
.else
RETD
.endif
.endif
.endm
call_mac .macro a
.if ($isdefed("FAR_MODE"))
.if ($isdefed("_ALG_MODE"))
far call a
.else
FCALL a
.endif
.else
CALL a
.endif
.endm
calld_mac .macro a
.if ($isdefed("FAR_MODE"))
.if ($isdefed("_ALG_MODE"))
far dcall a
.else
FCALLD a
.endif
.else
.if ($isdefed("_ALG_MODE"))
dcall a
.else
CALLD a
.endif
.endif
.endm
Tayyar-
> I used your macro and moved the data into the first 64K, then it worked..
> all linker errors were vanished..
>
> thanks for the tip..
Welcome.
-Jeff
> Jeff Brower <j...@signalogic.com> wrote:
> Tayyar-
>
>> I am trying to port a project written fully in C54x assembly to C55x
>> processor.
>> After digging through the migration document and changing things that
>> need to be changed, all files have been built without assembly errors.
>>
>> Yet, when I compile the source following error occurs during the link:
>> "error: relocation overflow occured at address 0x00000123 in section
>> '.text' The 17-bit relocated address 0x00001BFF8 is too large to encode
>> in the 16-bit field..."
>>
>> It has something to do with either the 64K page boundry problems or
>> far calls in the C54X assembly code.
>>
>> I set the build options to large memory model, divided the whole
>> memory into 64Kbyte sections and allocated carefully each variable to
>> appropriate section to get around the page boundry problem. I used
>> "MASM55 -ml *.asm" and "cl55 -ml -o *.obj *.asm" before adding the
asm
>> files to my project.
>>
>> Yet, everything I have done is hopeless. Do you guys have any idea
>> other than manually replacing each branch instruction to a far call
>> instruction? I am talking about thousands of lines of assembly code.
>
> I suggest to use something like a macro include file that translates the
> 54x name to
> correct mnemonic. I included an example below. Yes you have to replace
> each
> instruction with the "xxx_mac" name, but that's an edit-and-replace sweep,
> not too
> bad. Plus you can test it first using 54x mode to make sure you get
> identical code
> build and haven't missed any occurrences or made the wrong replacement.
>
> -Jeff
>
> ; far_mode.mac
> ; macros used to build far-call, far-return .asm files
> ; Copyright (C) Signalogic, 2001
> ; created: JUL 2001, JHB
>
> ret_mac .macro
>
> .if ($isdefed("FAR_MODE"))
> .if ($isdefed("_ALG_MODE"))
> far return
> .else
> FRET
> .endif
> .else
> .if ($isdefed("_ALG_MODE"))
> return
> .else
> RET
> .endif
> .endif
>
> .endm
>
> retd_mac .macro
>
> .if ($isdefed("FAR_MODE"))
> .if ($isdefed("_ALG_MODE"))
> far dreturn
> .else
> FRETD
> .endif
> .else
> .if ($isdefed("_ALG_MODE"))
> dreturn
> .else
> RETD
> .endif
> .endif
>
> .endm
>
> call_mac .macro a
>
> .if ($isdefed("FAR_MODE"))
> .if ($isdefed("_ALG_MODE"))
> far call a
> .else
> FCALL a
> .endif
> .else
> CALL a
> .endif
>
> .endm
>
> calld_mac .macro a
>
> .if ($isdefed("FAR_MODE"))
> .if ($isdefed("_ALG_MODE"))
> far dcall a
> .else
> FCALLD a
> .endif
> .else
> .if ($isdefed("_ALG_MODE"))
> dcall a
> .else
> CALLD a
> .endif
> .endif
>
> .endm