This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

multiply defined linker error with TCP IP stack

Hello everyone,

I'm using the TCP/IP stack in a standalone fashion (i.e. without the RTX OS). The code works when I adapted from an example LEDswitch project. However, when I tried to integrated into my existing project, I'm getting linker errors:

Rebuild target 'SAM9G20 Ext SDRAM'
assembling SAM9G20.s...
compiling EMAC_SAM9G20_Micrel.c...
compiling LEDSwitch.c...
compiling Net_Config.c...
compiling Net_Debug.c...
linking...
.\Ext_SDRAM\Blinky.axf: Error: L6200E: Symbol init_TcpNet multiply defined (by at_system.o and at_system.o).
.\Ext_SDRAM\Blinky.axf: Error: L6200E: Symbol main_TcpNet multiply defined (by at_system.o and at_system.o).
.\Ext_SDRAM\Blinky.axf: Error: L6200E: Symbol timer_tick multiply defined (by at_system.o and at_system.o).
.\Ext_SDRAM\Blinky.axf: Error: L6200E: Symbol localm multiply defined (by at_system.o and at_system.o).
.\Ext_SDRAM\Blinky.axf: Error: L6200E: Symbol sys_control multiply defined (by at_system.o and at_system.o).
.\Ext_SDRAM\Blinky.axf: Error: L6200E: Symbol get_rnd32 multiply defined (by at_system.o and at_system.o).
.\Ext_SDRAM\Blinky.axf: Error: L6200E: Symbol __RL_TCP_VER multiply defined (by at_system.o and at_system.o).
.\Ext_SDRAM\Blinky.axf: Error: L6200E: Symbol $$TCPnet$$version multiply defined (by at_system.o and at_system.o).
Target not created

I thought I'm linking the libraries from different places but I can't seem to find where. I'm linking to TCP_ARM_L.lib and TCPD_ARM_L.lib at C:\Keil\ARM\RV31\LIB\ which is the default install directory. I'm including my own copies of Net_Config.c and Net_Debug.c.

My compiler options are set as:

-c --cpu ARM926EJ-S -D__MICROLIB -g -O0 --apcs=interwork -I.\at91lib -I C:\Keil\ARM\RV31\Inc -I C:\Keil\ARM\CMSIS\Include -I C:\Keil\ARM\Inc\Atmel\SAM9G20 -Dkeil -o ".\Ext_SDRAM\*.o" --omf_browse ".\Ext_SDRAM\*.crf" --depend ".\Ext_SDRAM\*.d"

My assembler options are set as:

--cpu ARM926EJ-S -g --apcs=interwork --pd "__MICROLIB SETA 1" -I C:\Keil\ARM\RV31\Inc -I C:\Keil\ARM\CMSIS\Include -I C:\Keil\ARM\Inc\Atmel\SAM9G20 --pd "SIZE_EXT_INFO SETA 1" --pd "NO_EBI_INIT SETA 1" --pd "NO_SDRAM_INIT SETA 1" --pd "NO_PMC_INIT SETA 1" --pd "VEC_TO_RAM SETA 1" -o "*.o" --depend "*.d"

My linker options are set as:

--cpu ARM926EJ-S *.o --library_type=microlib --strict --scatter ".\Ext_SDRAM\Blinky.sct"
--summary_stderr --info summarysizes --map --xref --callgraph --symbols
--info sizes --info totals --info unused --info veneers --list ".\Ext_SDRAM\Blinky.map"
-o .\Ext_SDRAM\Blinky.axf

Does anyone has any insight as to what the problem might be? Thanks!

Lei Zong

  • Two instances of at_system in your project, or libraries.

  • That's my guess as well, but I'm not sure what this library is. I searched for at_system and can't find it included anywhere. I've been working on this project for a while and just started having this problem when I tried to include the TCP/IP stack, and from the look of the symbols reported in the errors, I'm guessing it's related to the TCP_ARM_L.lib and TCPD_ARM_L.lib that I'm including.

    Do you know how I can trace the multiple instances of the at_system library? I tried to use the --verbose option, but didn't get any output.
    I'm using MDK 4.54 with toolchain versions 4.1.0.894.

    Thanks for the quick response.

    Lei

  • "I'm linking to TCP_ARM_L.lib and TCPD_ARM_L.lib"

    Isn't one of these the debug version? Why do you need both?

  • ha! You are right, one of them is the debug version of the TCP/IP stack. I copied it over from the example LEDswitch project since it has a release target and a debug target and didn't realize that I'm including the two variants of the same library. After I removed one instance of the library, it linked fine.

    But then I'm not sure what black magic the example project did to include both libraries...

    Thanks a lot for the pointer!!

    Lei

  • You can set options for individual files - so one file is only used in a specific build. Another only used in a different build.

    Could be release/debug.

    Or could be a hw layer file that depends on if you build for hw 1 or hw 2 or hw2 rev 2.