This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

C5535 Linker Error

Dear all,

While I am trying to migrate C54 project to C55 I got some linker errors like below . What may be the reason for these?

***********************Console Output Start******************************

error #10255-D: cannot place data input section "./x2.obj(.data)" in text output section ".data"

error #10255-D: cannot place data input section "./rr2.obj(.data:.text)" in text output section ".data"

error #10255-D: cannot place data input section "./rr1.obj(.data:.text)" in text output section ".data"

error #10255-D: cannot place data input section "./x1.obj(.data)" in text output section ".data"

************************Console Output End*****************************

Here is my .cmd file

************************Cmd File Start*****************************

MEMORY
{
MMR: o = 0x000000 l = 0x0000c0 
DARAM0: o = 0x0000C0 l = 0x001F40 
DARAM1: o = 0x002000 l = 0x002000 
DARAM2: o = 0x004000 l = 0x002000 
SARAM0: o = 0x010000 l = 0x020000 
VECS: o = 0xFFFF00 l = 0x000100 

DARAM4: o = 0x006000 l = 0x00a000 
SARAM1: o = 0x030000 l = 0x020000 

ROM: o = 0xFE0000 l = 0x01FF00 
}

SECTIONS

vectors (NOLOAD) > VECS 
.cinit > DARAM0
.text > SARAM0
.stack > DARAM0
.sysstack > DARAM0
.sysmem > DARAM1
.data > SARAM1
.cio > DARAM0
.bss > DARAM2
.const > DARAM0
}

************************Cmd File End*****************************

x1.asm includes the below lines

************************x1.asm*****************************

.data

coeff .word 011h,022h,033h

.end

************************x1.asm*****************************

thanks and best regards

Ferhat

  • I suspect the problem is with rr1.obj or rr2.obj.  It is very strange to see a section named .data:.text; that implies that there is some executable code in the data section.  Normally this is not possible, especially for C54x.  As a wild guess, you might need to add a line to your linker command file like the following, to keep .data:.text separated from the rest of .data:

    .data:.text > SARAM0
  • Thanks for the answer you provided.

    when i included below lines to .cmd file the errors are resolved. I do not understand why I need to force .data:.data ,x1.obj(.data) and x2.obj(.data) to SARAM1. Do you know why?

    .data: {x1.obj(.data) } >> SARAM1

    .data: {x2.obj(.data) } >> SARAM1

    .data:.text > SARAM0

    Ferhat

  • It's not that you need to force those sections to one memory or the other, it's that you need to keep them from being merged with a similarly-named section.  By adding their own line in the linker command file, you keep them as separate sections.  (Look at the linker map file, generated by using the -m linker option.)  The linker considers it a fatal error to mix sections that contain code and data.  You need to take care that only data goes into .data, and only program code goes into .text.  I suspect the C54x project deliberately put some program code into .data, for what reason I don't know.

  • in order to investigate this linker error I first added new x1.asm file which only includes below data lines (no text section). linker gives error for this data only code and in order to keep .data being merged I add separate line for x1.obj(.data) to same .data section SARAM1

    *********

    .data

    coeff .word 011h,022h,033h

    .end

    *********

     

  • I suspect the problem is with rr1.obj or rr2.obj.  Please run ofd55 on each of rr1.obj and rr2.obj and post the results here.