Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
18 years ago

Lwip basic question

Hi all,

I'm starting with lwip, but have some problems with functions calling. I`m trying to create a simple UDP connection, the code is as follows:

#include <stdio.h># include "lwip/api.h"
int main()
{
  struct netconn *conn;
  conn = netconn_new(NETCONN_UDP);
    
}  

But seems like I&#39;m doing something wrong, because it&#39;s giving me this error:

" undefined reference to `netconn_new&#39; "

I&#39;ve tryied with all the connection types with the same result, and seems like they are all defined in "lwip/api.h". Don&#39;t know what I&#39;m doing wrong, can someone help me???

Thanks!!!!!

15 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Hi, thanks for answer.

    In LwIP 1.3.1, it seems to lack some file like :
    • lwipopts.h to Define# define NO_SYS 1, etc

    • arch/cc.h to Define generic types used in lwIP

    --- Quote End ---

    These are user supplied files - copy and past opts.h into lwipopts.h and make change as necessary for your system (depends on amount of memory and other lwIP features that you require). cc.h is your platform dependent include file - start with another from the contrib folder as a starting point for yours.

    --- Quote Start ---

    That answers to my "syntax errors".I look for examples like lwIPv1_1.zip in niosforum.com http://www.niosforum.com/pages/project_details.php?p_id=68&t_id=17 which provides a few answers.

    I am new to IP stacks and have a very light knowledge of all about networking.

    I had hoped that it must be simple because Ethernet is wiiiiiiiiiiiiiiidely used. As for SD cards.

    --- Quote End ---

    You don't need to know about networking to bring lwIP up - but you must get an ethernet driver working. The Altera tse driver is a start and it's not super hard to get that talking through lwIP's low_level_input and low_level_output.

    If you want a standalone working stack already for NIOS II like Interniche is - that's only possible if you find someone who can provide a working build of everything. One issue I don't know about is if someone has an lwIP ethernet driver based on the Interniche/Altera code (most of the code is altera's), what can be redistributed without violating licenses?

    --- Quote Start ---

    I look at LwIP wiki, go to "get started" and wasted :huh:.

    --- Quote End ---

    Yeah, it could be better.

    --- Quote Start ---

    You have succeeded in make LWIP working.

    Could you suggest me/us some good documents, please ? in order to start with a good point.

    --- Quote End ---

    The lwIP Wiki and the mailing lists documented here is a start: http://www.nongnu.org/lwip/

    I will see if I can throw together a "bridge" file from the Altera driver to lwIP's ethernetif interface. No promises...

    Bill A.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Great thanks !

    --- Quote Start ---

    cc.h is your platform dependent include file - start with another from the contrib folder as a starting point for yours.

    --- Quote End ---

    I found http://cvs.savannah.gnu.org/viewvc/contrib/ports/?root=lwip

    is there a nios ii port ? All I have found is that Altera don't use LwIP anymore.

    For cc.h, we have just to typedef
    u8_t;
    s8_t;
    u16_t;
    s16_t;
    u32_t;
    s32_t;
    # define BYTE_ORDER LITTLE_ENDIAN

    You mentioned Altera TSE driver, but it is "designed" for InterNiche stack and ucOS II. Not simple.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    You mentioned Altera TSE driver, but it is "designed" for InterNiche stack and ucOS II. Not simple.

    --- Quote End ---

    Are looking for a driver for lwip for an Altera 10/100MbS MAC or one for the Altera TSE (100/1000MbS) MAC? I see another post of yours that mentions 10/100.

    Bill
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi, I xas looking a LWIP driver for Opencores Ethernet MAC. Not TSE MAC, neither LAN91c911.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Ok, well I did the port for the TSE since I didn't see the OpenCores Ethernet MAC mentioned in an early post. The TSE does work in 10/100 mode (I'm not positive about the 10MbS support).

    Bill