WORK IN PROGRESS. This is only a draft! PLEASE, help me to write this text :)

Using lwIP in a project is quite simple. These are the basic steps you need to follow:

  1. Download the library from the main site or from the CVS repository, choosing the right version for you (I recommend the last development version for testing or the last stable version for a real project) [insert links]
  1. Copy the “src” folder in you main project folder and rename it “lwIP”
  1. Copy the “/lwIP/include/opt.h” in “/lwIP/” and rename it “lwipopts.h”. Clean this file removing all the sentinels, #include, #ifdef - #else - #endif. At the end, what we do is using the original file (which contains all the possible configuration values) to extract all the name of the #define labels we can change. This step could be long, but it is useful to avoid conflicts between different versions of the lwIP library and the lwipopts.h file. (In fact from one release to another the labels could be renamed). [explain what to change for some typical application]
  1. Include in the project some files related to you architecture: [maybe other files..]
    - “cc.h” [explain]
    - “sys_arch.c” and “sys_arch.h” (if you use an OS) [explain]
    - your specific version of “ethernetif.c”[explain]
  1. For start using the libray you can use this simple code: [improve to work with or without an OS]
#include "lwip/tcpip.h"
#include "lwip/ip.h"
#include "arch/ethernetif.h"

struct netif my_netif;

void init_ethernet(

      /* Network interface variables */

      struct ip_addr ipaddr, netmask, gw;

      /* Set network address variables */

      IP4_ADDR(&gw, 192,168,0,1);                   //ip address of the gateway

      IP4_ADDR(&ipaddr, 192,168,0,2);             //ip address of your device

      IP4_ADDR(&netmask, 255,255,255,0);      //netmask

      tcpip_init(NULL, NULL);                            //call this routine if you use an OS 

      netif_add(&my_netif, &ipaddr, &netmask, &gw, NULL, ethernetif_init, tcpip_input);



Community content is available under CC-BY-SA unless otherwise noted.