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: 
Highlighted
Visitor mobin.seven
Visitor
7,093 Views
Registered: ‎09-13-2013

lwip neif status and link callback : undefined reference

Jump to solution

Hi

I want to set callback functions for Status and link callbacks of a network interface (netif):

my code:

 

#include "lwip/err.h"
#include "lwip/tcp.h"
#include "lwip/netif.h"
#include "lwip/debug.h"
#include "lwip/stats.h"
#include "lwip/timers.h"
#include "netif/xadapter.h"
#include "lwip/inet.h"
#include "lwip/sockets.h"
#include "lwip/sys.h"
...

#define LWIP_NETIF_LINK_CALLBACK 1
#define LWIP_NETIF_STATUS_CALLBACK 1

...

//defining status_callback();

//defining  link_callback();
void fn()
{
...
#if LWIP_NETIF_STATUS_CALLBACK
netif_set_status_callback(&netif, status_callback);
#endif /* LWIP_NETIF_STATUS_CALLBACK */
#if LWIP_NETIF_LINK_CALLBACK
netif_set_link_callback(&netif, link_callback);
#endif /* LWIP_NETIF_LINK_CALLBACK */
}

 

the error I got:

 

undefined reference to `netif_set_link_callback' app.c /proj/src/TCP line 267 C/C++ Problem
undefined reference to `netif_set_status_callback' app.c /proj/src/TCP line 264 C/C++ Problem

0 Kudos
1 Solution

Accepted Solutions
Explorer
Explorer
10,181 Views
Registered: ‎11-24-2013

Re: lwip neif status and link callback : undefined reference

Jump to solution

Ok. I did not have to do this, but there is another copy of "opt.h" in:

 

\microblaze_0\libsrc\lwip(version)\src\lwip(version)\src\include\lwip\opt.h

 

Maybe you need to change this as well. In my case, it was not necessary.

 

Regards,

Ignacio.

 

View solution in original post

Tags (2)
0 Kudos
4 Replies
Explorer
Explorer
7,079 Views
Registered: ‎11-24-2013

Re: lwip neif status and link callback : undefined reference

Jump to solution

Hi, movin,

 

instead of doing

 

...
#define LWIP_NETIF_LINK_CALLBACK 1
#define LWIP_NETIF_STATUS_CALLBACK 1
...

in your code, try to change these definitions to 1 on the file "opt.h". This is the lwIP Options Configuration file, and you will be able to find it in:

 

your_workspace_name\your_bsp_name\microblaze_0\include\lwip\opt.h

 

In this code you will find this by default:

 

/**
 * LWIP_NETIF_STATUS_CALLBACK==1: Support a callback function whenever an interface
 * changes its up/down status (i.e., due to DHCP IP acquistion)
 */
#ifndef LWIP_NETIF_STATUS_CALLBACK
#define LWIP_NETIF_STATUS_CALLBACK      0
#endif

/**
 * LWIP_NETIF_LINK_CALLBACK==1: Support a callback function from an interface
 * whenever the link changes (i.e., link down)
 */
#ifndef LWIP_NETIF_LINK_CALLBACK
#define LWIP_NETIF_LINK_CALLBACK        0
#endi

Change this code, save it an delete the "#define" statements from your code.

 

I got it working by doing this.

 

Regards,

Ignacio Moreno.

 

 

Tags (2)
0 Kudos
Visitor mobin.seven
Visitor
7,076 Views
Registered: ‎09-13-2013

Re: lwip neif status and link callback : undefined reference

Jump to solution

@imgignacio wrote:

Hi, movin,

 

instead of doing

 

...
#define LWIP_NETIF_LINK_CALLBACK 1
#define LWIP_NETIF_STATUS_CALLBACK 1
...

in your code, try to change these definitions to 1 on the file "opt.h". This is the lwIP Options Configuration file, and you will be able to find it in:

 

your_workspace_name\your_bsp_name\microblaze_0\include\lwip\opt.h

 

In this code you will find this by default:

 

/**
 * LWIP_NETIF_STATUS_CALLBACK==1: Support a callback function whenever an interface
 * changes its up/down status (i.e., due to DHCP IP acquistion)
 */
#ifndef LWIP_NETIF_STATUS_CALLBACK
#define LWIP_NETIF_STATUS_CALLBACK      0
#endif

/**
 * LWIP_NETIF_LINK_CALLBACK==1: Support a callback function from an interface
 * whenever the link changes (i.e., link down)
 */
#ifndef LWIP_NETIF_LINK_CALLBACK
#define LWIP_NETIF_LINK_CALLBACK        0
#endi

Change this code, save it an delete the "#define" statements from your code.

 

I got it working by doing this.

 

Regards,

Ignacio Moreno.

 

 


Hello Ignacio 
Thanks lad. I did this. still getting same error , unfortunately .
0 Kudos
Explorer
Explorer
10,182 Views
Registered: ‎11-24-2013

Re: lwip neif status and link callback : undefined reference

Jump to solution

Ok. I did not have to do this, but there is another copy of "opt.h" in:

 

\microblaze_0\libsrc\lwip(version)\src\lwip(version)\src\include\lwip\opt.h

 

Maybe you need to change this as well. In my case, it was not necessary.

 

Regards,

Ignacio.

 

View solution in original post

Tags (2)
0 Kudos
Visitor mobin.seven
Visitor
7,069 Views
Registered: ‎09-13-2013

Re: lwip neif status and link callback : undefined reference

Jump to solution

yes. I had to change main source files. actually they are in:

C:\Xilinx\14.x\ISE_DS\EDK\sw\ThirdParty\sw_services\lwip140_v1_06_a\src\lwip-1.4.0\src\include\lwip\opt.h

 

It's a BUG of course. because SDK first build object files out of defualt sources then give it to us to customize options. AND when you clean your project every option turns to default value! :|

thanks lad ;)

0 Kudos