UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Explorer
Explorer
6,637 Views
Registered: ‎05-28-2014

"multiple definition of" linker error

Hello,

 

I am trying to divide the object files between the 2 internal bram memories, but I get many linker errors of "multiple definition of ...."

 

This is the way I have specified the files:


.text : {
CZ5C2010A_uBlaze_BSP_baseline.o(.text)
CZ5C2010A_uBlaze_POD_baseline.o(.text)
CZ5C2010A_uBlaze_POD_Code\Source\checksum.o(.text)
CZ5C2010A_uBlaze_POD_Code\Source\cibAteMsgSender.o(.text)
CZ5C2010A_uBlaze_POD_Code\Source\cibBitMode.o(.text)
CZ5C2010A_uBlaze_POD_Code\Source\cibDiscreteHandler.o(.text)
CZ5C2010A_uBlaze_POD_Code\Source\cibFlash.o(.text)
CZ5C2010A_uBlaze_POD_Code\Source\cibFlashTest.o(.text)
src\testperiph.o(.text)
src\xintc_tapp_example.o(.text)
src\xtmrctr_intr_example.o(.text)
} > microblaze_i_bram_ctrl_0_microblaze_d_bram_ctrl_0

.text2 : {
CZ5C2010A_uBlaze_POD_Code\Source\cibFwHandle.o(.text)
CZ5C2010A_uBlaze_POD_Code\Source\cibFwUartTest.o(.text)
CZ5C2010A_uBlaze_POD_Code\Source\cibMain.o(.text)
CZ5C2010A_uBlaze_POD_Code\Source\cibMmcMsgRcvHandler.o(.text)
CZ5C2010A_uBlaze_POD_Code\Source\cibMmcMsgSender.o(.text)
CZ5C2010A_uBlaze_POD_Code\Source\cibRtcTest.o(.text)
CZ5C2010A_uBlaze_POD_Code\UART\LLD_COMM_FPGA_COM_CONTROL\Code\Source\comctrldrv.o(.text)
CZ5C2010A_uBlaze_POD_Code\UART\LLD_COMM_FPGA_COM_CONTROL\UnitTest\Code\Source\comCtrlTest.o(.text)
CZ5C2010A_uBlaze_POD_Code\UART\LldCommFpgaUartBravoCore\Code\Source\fpgaUartBravoDrvCore.o(.text)
CZ5C2010A_uBlaze_POD_Code\UART\RTCAR_BasicDefinitions_Common\Source\bscErrorHandle.o(.text)
} > microblaze_i_bram_ctrl_1_microblaze_d_bram_ctrl_1

 

And this is example of the errors (there are many many which are printer right after it)

 

./src/testperiph.o: In function `main':

D:\MicroBlaze\App\CZ5C2010A_uBlaze_POD_APP\CZ5C2010A_uBlaze_POD\UnitTest\Workspace\Debug/../src/testperiph.c:61: multiple definition of `main'
src\testperiph.o:D:\MicroBlaze\App\CZ5C2010A_uBlaze_POD_APP\CZ5C2010A_uBlaze_POD\UnitTest\Workspace\Debug/../src/testperiph.c:61: first defined here
./src/xintc_tapp_example.o: In function `IntcSelfTestExample':

........

 

Please advise,

Ran

0 Kudos
6 Replies
Moderator
Moderator
6,609 Views
Registered: ‎04-17-2011

Re: "multiple definition of" linker error

I think you should have a look at this Answer Record which does a similar thing: http://www.xilinx.com/support/answers/21639.html

Happy Holidays!
Regards,
Debraj
----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------
0 Kudos
Explorer
Explorer
6,601 Views
Registered: ‎05-28-2014

Re: "multiple definition of" linker error

Hi Debra,

 

Thank you very much for the link.

I am familiar with this link, and it helped me in understanding what should be done.

But on trying to do it in practise, I got many linker error which start with " "multiple definition of ....", so I don't understand why it happens (you can notice that no same object file is repeated in bram0 nor bram1.

If you have any more idea please tell me.

 

Happy Holidays ,

Ran

0 Kudos
Explorer
Explorer
6,583 Views
Registered: ‎05-28-2014

Re: "multiple definition of" linker error

Hi Debra,

 

Even when I put in ls script only one file with one routine, I keeup getting the loader error. 


.text : { CZ5C2010A_uBlaze_POD_Code\Source\checksum.o(.text) } > microblaze_i_bram_ctrl_0_microblaze_d_bram_ctrl_0

 

Can anyone please try this ?


'Building target: CZ5C2010A_uBlaze_POD.elf'
'Invoking: MicroBlaze gcc linker'
mb-gcc -Wl,-T -Wl,../src/lscript.ld -LD:/MicroBlaze/App/CZ5C2010A_uBlaze_POD_APP/CZ5C2010A_uBlaze_BSP/microblaze_0/lib -mlittle-endian -mcpu=v8.50.c -mxl-soft-mul -Wl,--no-relax -Wl,--gc-sections -o "CZ5C2010A_uBlaze_POD.elf" ./src/testperiph.o ./src/xintc_tapp_example.o ./src/xtmrctr_intr_example.o ./CZ5C2010A_uBlaze_POD_Code/UART/RTCAR_BasicDefinitions_Common/Source/bscErrorHandle.o ./CZ5C2010A_uBlaze_POD_Code/UART/LldCommFpgaUartBravoCore/Code/Source/fpgaUartBravoDrvCore.o ./CZ5C2010A_uBlaze_POD_Code/UART/LLD_COMM_FPGA_COM_CONTROL/Unittest/Code/Source/comCtrlTest.o ./CZ5C2010A_uBlaze_POD_Code/UART/LLD_COMM_FPGA_COM_CONTROL/Code/Source/comctrldrv.o ./CZ5C2010A_uBlaze_POD_Code/Source/checksum.o ./CZ5C2010A_uBlaze_POD_Code/Source/cibAteMsgSender.o ./CZ5C2010A_uBlaze_POD_Code/Source/cibBitMode.o ./CZ5C2010A_uBlaze_POD_Code/Source/cibDiscreteHandler.o ./CZ5C2010A_uBlaze_POD_Code/Source/cibFlash.o ./CZ5C2010A_uBlaze_POD_Code/Source/cibFwHandle.o ./CZ5C2010A_uBlaze_POD_Code/Source/cibMain.o ./CZ5C2010A_uBlaze_POD_Code/Source/cibMmcMsgRcvHandler.o ./CZ5C2010A_uBlaze_POD_Code/Source/cibMmcMsgSender.o ./CZ5C2010A_uBlaze_POD_Code/Source/cibRtcTest.o ./CZ5C2010A_uBlaze_BSP_baseline.o ./CZ5C2010A_uBlaze_POD_baseline.o -Wl,--start-group,-lxil,-lgcc,-lc,--end-group -lxilflash
./CZ5C2010A_uBlaze_POD_Code/Source/checksum.o: In function `crc32':
D:/MicroBlaze/App/CZ5C2010A_uBlaze_POD_APP/CZ5C2010A_uBlaze_POD/Code/Source/checksum.c:16: multiple definition of `crc32'
CZ5C2010A_uBlaze_POD_Code\Source\checksum.o:D:/MicroBlaze/App/CZ5C2010A_uBlaze_POD_APP/CZ5C2010A_uBlaze_POD/Code/Source/checksum.c:16: first defined here
collect2: ld returned 1 exit status
make: *** [CZ5C2010A_uBlaze_POD.elf] 1 הלקת

0 Kudos
Explorer
Explorer
6,554 Views
Registered: ‎05-28-2014

Re: "multiple definition of" linker error

Can anyone help with this please ?
0 Kudos
Adventurer
Adventurer
6,498 Views
Registered: ‎10-23-2014

Re: "multiple definition of" linker error

Rather than dividing text and keeping them in two seperated BRAM Blocks, i suggest you try to combine the two BRAM blocks and place the entire section in the combined block and see if it works.

 

If you do not know who to combine two BRAM blocks then follow the steps below about it.

 

-> Open the linker script file lscript.ld, in your project.

-> If two BRAM blocks have address this way as below.

 

Name                                                                                                 Base address                         size

microblaze_i_bram_ctrl_0_microblaze_d_bram_ctrl_0        0x00000050                        0x0000FFB0

microblaze_i_bram_ctrl_1_microblaze_d_bram_ctrl_1        0x00010000                        0x00010000

 

Change the size of first BRAM to the size of combining both the BRAM's as show below.

 

Name                                                                                                 Base address                         size

microblaze_i_bram_ctrl_0_microblaze_d_bram_ctrl_0        0x00000050                        0x0001FFB0

microblaze_i_bram_ctrl_1_microblaze_d_bram_ctrl_1        0x00010000                        0x00010000

 

-> Now use your whole section in "microblaze_i_bram_ctrl_0_microblaze_d_bram_ctrl_0" itself.

 

Try it.!! Let us know if it works..!

0 Kudos
624 Views
Registered: ‎01-03-2019

Re: "multiple definition of" linker error

Hi, first of all thank you for your reply. I found this thread after trying to accomplish a similar thing as the original poster was -- splitting my .text section from the linker script into two different sections (.text and .text1) and then placing each of those .text sections into different block RAM spaces -- "i_bram_block_combined" and "d_bram_block_combined". 

 

I'm having trouble undersanding your reply to the post, however, as I don't understand how you were able to simply change the size of the first allocated block without changing any other aspects of the design, if that makes sense. Here is the situation I am in;

 

in my MEMORY section of my linker script, I have the following:

i_bram_block_combined : ORIGIN = 0x00000050, LENGTH = 0x0000FFAF
  d_bram_block_combined : ORIGIN = 0x90000000, LENGTH = 0x0000FFAA

This matches the system design from the .bmm file that I have, and there is otherwise no issues with this layout. If I'm understanding your reply correctly, what you suggested  -- overlapping the memory regions by increasing the size of the first block such that it overlaps with the second and simply treat it as one larger contigous block of memory -- is not possible in the situation I am in, where the two address spaces are severly discontigious. 

 

What is the correct course of action in this case? I have already conferred with the Answer Record #21639 that you provided, but employing that approach gives me the same "multiple defintions of..." error that the original poster is getting.

0 Kudos