Problem with build in MPC5675k due to linker error.

Forum related to ERIKA Enterprise and RT-Druid version 2

Moderator: paolo.gai

Post Reply
abhishek.iav
Newbie
Posts: 6
Joined: Thu Apr 14, 2016 6:08 pm

Problem with build in MPC5675k due to linker error.

Post by abhishek.iav » Fri Apr 15, 2016 9:29 am

Using codewarrior 2.10 for MPC55xx/MPC56xx
and cygwin environment.
Using RT-Druid 2.3.0

Please find the following below:
Console display, code snipets and please ask me if you need any more details.

In TcpIp.c
extern TcpIp_LocalAddrType TcpIp_LocalAddrTable[TCPIP_LOCAL_ADDR_TABLE_ENTRIES]; // declared prototype and

in TcpIp_CfgTypes.h // has the definition
typedef struct{
TcpIp_DomainType Domain;
TcpIp_AdressType AddressType;
uint8 CtrlId;
TcpIp_AddrAssignment Assignment;
TcpIp_StaticIpAddressConfig StaticAddress;
}TcpIp_LocalAddrType;

//Abhi
TcpIp_LocalAddrType TcpIp_LocalAddrTable[TCPIP_LOCAL_ADDR_TABLE_ENTRIES];


Their is nothing of this structure in files Main.c, task2.c or soad.c

i dont understand why it gives error previously defined in these above mentioned files.

I have rebuilt the index and cleaned the project did every thing.

If you have any solutions or ways to do things differently am happy to try them.

Thank you.


console display

10:19:30 **** Build of configuration Default for project SoAdImplementation ****
"C:\\cygwin\\bin\\make.exe" all
Using erika files in /cygdrive/d/Projekte/VE-D24~2/ABHI_P~1/project/DEPEND~1/RT-DRU~1.0/plugins/COB06B~1.201/ee_files
MAKE_DIRECTORIES
ASM2C ee_boot.S
CC ee_boot_asm.c
CC eecfg.c
CC task1.c
CC SoAd.c
CC task2.c
CC Main.c
CC init.c
CC TcpIp.c
LOC
ASM2C ee_entry.S
CC ee_entry_asm.c
ASM2C ee_oo.S
CC ee_oo_asm.c
ASM2C ee_context.S
CC ee_context_asm.c
CC ee_hal_structs.c
CC ee_context.c
CC ee_e200zx_cpu.c
ASM ee_ivor.S
CC ee_irq.c
CC ee_activate.c
CC ee_schedule.c
CC ee_force_schedule.c
CC ee_gettaskstate.c
CC ee_gettaskid.c
CC ee_terminat.c
CC ee_thendin.c
CC ee_irqendin.c
CC ee_tstub.c
CC ee_tnterm.c
CC ee_lookup.c
CC ee_rq_exchg.c
CC ee_rq_inser.c
CC ee_shtdown.c
CC ee_startos.c
CC ee_chaintas.c
AR libee.a
LD
mwldeppc.exe: multiply-defined: 'TcpIp_LocalAddrTable' in SoAd.o
mwldeppc.exe: Previously defined in task1.o
mwldeppc.exe: multiply-defined: '.dwarf.TcpIp_LocalAddrTable' in SoAd.o
mwldeppc.exe: Previously defined in task1.o
mwldeppc.exe: multiply-defined: 'TcpIp_LocalAddrTable' in task2.o
mwldeppc.exe: Previously defined in SoAd.o
mwldeppc.exe: multiply-defined: '.dwarf.TcpIp_LocalAddrTable' in task2.o
mwldeppc.exe: Previously defined in SoAd.o
mwldeppc.exe: multiply-defined: 'TcpIp_LocalAddrTable' in Main.o
mwldeppc.exe: Previously defined in task2.o
mwldeppc.exe: multiply-defined: '.dwarf.TcpIp_LocalAddrTable' in Main.o
mwldeppc.exe: Previously defined in task2.o
mwldeppc.exe: multiply-defined: 'TcpIp_LocalAddrTable' in TcpIp.o
mwldeppc.exe: Previously defined in Main.o
mwldeppc.exe: multiply-defined: '.dwarf.TcpIp_LocalAddrTable' in TcpIp.o
mwldeppc.exe: Previously defined in Main.o
mwldeppc.exe: undefined: 'udp_bind'
mwldeppc.exe: Referenced from 'TcpIp_Bind' in TcpIp.o
mwldeppc.exe: undefined: 'pbuf_alloc'
mwldeppc.exe: Referenced from 'TcpIp_UdpTransmit' in TcpIp.o
mwldeppc.exe: undefined: 'pbuf_take'
mwldeppc.exe: Referenced from 'TcpIp_UdpTransmit' in TcpIp.o
mwldeppc.exe: undefined: 'udp_connect'
mwldeppc.exe: Referenced from 'TcpIp_UdpTransmit' in TcpIp.o
mwldeppc.exe: undefined: 'udp_send'
mwldeppc.exe: Referenced from 'TcpIp_UdpTransmit' in TcpIp.o
mwldeppc.exe: undefined: 'udp_disconnect'
mwldeppc.exe: Referenced from 'TcpIp_UdpTransmit' in TcpIp.o
mwldeppc.exe: undefined: 'pbuf_free'
mwldeppc.exe: Referenced from 'TcpIp_UdpTransmit' in TcpIp.o
mwldeppc.exe: undefined: 'udp_new'
mwldeppc.exe: Referenced from 'TcpIp_SoAdGetSocket' in TcpIp.o
mwldeppc.exe: undefined: 'SoAd_RxIndication'
mwldeppc.exe: Referenced from 'Receive_Udp_v4' in TcpIp.o
mwldeppc.exe: undefined: 'udp_recv'
mwldeppc.exe: Referenced from 'TcpIp_SoAdGetSocket' in TcpIp.o

mwldeppc.exe: undefined: 'ip_addr_any'
Errors caused tool to abort.
mwldeppc.exe: Referenced from 'SoAd_MainFunction' in SoAd.o
mwldeppc.exe: undefined: 'ip_addr_any'
mwldeppc.exe: Referenced from 'SoAd_MainFunction' in SoAd.o
mwldeppc.exe: undefined: 'udp_remove'
mwldeppc.exe: Referenced from 'TcpIp_Close' in TcpIp.o
mwldeppc.exe: undefined: 'SoAd_TcpIpEvent'
mwldeppc.exe: Referenced from 'TcpIp_Close' in TcpIp.o
mwldeppc.exe: undefined: 'lwip_init'
mwldeppc.exe: Referenced from 'TcpIp_Init' in TcpIp.o
mwldeppc.exe: undefined: 'inet_addr'
mwldeppc.exe: Referenced from 'SoAd_Init' in SoAd.o
mwldeppc.exe: undefined: 'lwip_htons'
mwldeppc.exe: Referenced from 'SoAd_Init' in SoAd.o
mwldeppc.exe: alert: Link failed.
make: *** [ppc.elf] Error 1

10:20:39 Build Finished (took 1m:9s.312ms)

paolo.gai
Administrator
Posts: 875
Joined: Thu Dec 07, 2006 12:11 pm

Re: Problem with build in MPC5675k due to linker error.

Post by paolo.gai » Fri Apr 15, 2016 9:42 am

Hi,

Just looking at the error, it seems you are defining a variable in a H file included by various C files.

It does not seem to be a demo we distribute with ERIKA... Just curious, are you using ERIKA in a product?

I would suggest in any case:
- to update to the latest version of ERIKA Enterprise
- if the problem is still there, provide more information (but this is a typical thing we handle with commercial support, so please write to info "at" evidence.eu.com

Ciao,

PJ

abhishek.iav
Newbie
Posts: 6
Joined: Thu Apr 14, 2016 6:08 pm

Re: Problem with build in MPC5675k due to linker error.

Post by abhishek.iav » Fri Apr 15, 2016 1:33 pm

No not using ERIKA in a product,

Am just trying to get the ethernet packets from socket adaptor in the autosar stack and I have included the lwip and tcpip over it and SoAd on the top of this. I just want two tasks running cyclically with transmit function in one of them.

The problem is if i define this variable "extern TcpIp_LocalAddrType TcpIp_LocalAddrTable[TCPIP_LOCAL_ADDR_TABLE_ENTRIES];"
only in TcpIp_CfgTypes.h it will show error some thing like this below

"undefined: 'udp_bind'
mwldeppc.exe: Referenced from 'TcpIp_Bind' in TcpIp.o"

if i define this variable "extern TcpIp_LocalAddrType TcpIp_LocalAddrTable[TCPIP_LOCAL_ADDR_TABLE_ENTRIES];"
in both files TcpIp.c(declared as extern TcpIp_LocalAddrType TcpIp_LocalAddrTable[TCPIP_LOCAL_ADDR_TABLE_ENTRIES];")
and TcpIp_CfgTypes.h (TcpIp_LocalAddrType TcpIp_LocalAddrTable[TCPIP_LOCAL_ADDR_TABLE_ENTRIES];")

i am getting error something like this below:
multiply-defined: '.dwarf.TcpIp_LocalAddrTable' in TcpIp.o
mwldeppc.exe: Previously defined in Main.o

but the thing is am not using or declaring or defining variable " TcpIp_LocalAddrTable " in any of Main task1 or task2 files at all

-->Do i need to configure this lwip as library in the oil file or just including it as below is ok.


CPU test_application {

OS EE {
EE_OPT = "DEBUG";
//EE_OPT = "__E200ZX_EXECUTE_FROM_RAM__";
EE_OPT = "__CODEWARRIOR__";
EE_OPT = "EE_ISR_DYNAMIC_TABLE";
EE_OPT = "GENERATE_S_RECORD";
//EE_OPT = "VERBOSE";
EE_OPT = "__EE_USE_MMU__";
EE_OPT = "__EE_CRT0_INIT_MMU__";
//EE_OPT = "__BUILD_LIBS__";

//LIB = ENABLE { NAME = " libee "; };

CFLAGS = "-I../src/include -I../src/SoAd -I../src/TcpIp -I../lwip/src/include/lwip -I../lwip/src/include/ipv4/lwip -I../lwip/src/include/ipv6/lwip";
ASFLAGS = "";
LDFLAGS = "";

CPU_DATA = PPCE200ZX {
COMPILER_TYPE = CODEWARRIOR;
MODEL = E200Z7;
APP_SRC = "src/Main.c src/SoAd/SoAd.c src/init.c src/TcpIp/TcpIp.c ";//src//SoAd/SoAd_Cfg.c src/SoAd/SoAd_Cbk.c src/TcpIp/TcpIp.c src/TcpIp/TcpIp_Cfg.c
MULTI_STACK = TRUE;
VLE = TRUE;
};

MCU_DATA = PPCE200ZX {
MODEL = MPC5675K;
};

STATUS = EXTENDED;
STARTUPHOOK = FALSE;
ERRORHOOK = FALSE;
SHUTDOWNHOOK = FALSE;
PRETASKHOOK = FALSE;
POSTTASKHOOK = FALSE;
USEGETSERVICEID = FALSE;
USEPARAMETERACCESS = FALSE;
USERESSCHEDULER = FALSE;
ORTI_SECTIONS = ALL;
};


/**/
// TASK OsIdle {
// PRIORITY = 0x01; /* Low priority when it is 0x01 */
// AUTOSTART = FALSE;
// STACK = SHARED;
// ACTIVATION = 1; /* only one pending activation */
// APP_SRC="Test/src/task1.c Test/src/Client.c";
// };

TASK MainLWIPTask {
PRIORITY = 0x01; /* High priority */
SCHEDULE = FULL;
AUTOSTART = TRUE;
STACK = SHARED;
APP_SRC="src/task1.c src/SoAd/SoAd.c";
};


TASK OsBswServiceTask {
PRIORITY = 0x03; /* High priority */
SCHEDULE = FULL;
AUTOSTART = TRUE;
STACK = SHARED;
APP_SRC="src/task2.c src/SoAd/SoAd.c";
};

OS EE { KERNEL_TYPE = BCC1;EE_OPT = "__OO_STARTOS_OLD__";};
// TASK OsIdle { SCHEDULE = FULL; };
TASK MainLWIPTask { ACTIVATION = 1; };
TASK OsBswServiceTask { SCHEDULE = FULL; };

Post Reply