Reduce lwIP code size[]
Before disabling any of the options below, please take a look at the corresponding description in opt.h to try and understand what you are switching off.
First disable all options you don't need. Some options you can disable are :
MEMP_OVERFLOW_CHECK=0 MEMP_SANITY_CHECK=0 ARP_QUEUEING=0 ETHARP_TRUST_IP_MAC=0 LWIP_NETIF_HOSTNAME=0 LWIP_NETIF_API=0 LWIP_NETIF_STATUS_CALLBACK=0 LWIP_NETIF_LINK_CALLBACK=0 LWIP_NETIF_HWADDRHINT=0
Some others options to disable are dependent of your needs (but most of them are disabled per default):
IP_FRAG=0 IP_REASSEMBLY=0 LWIP_ICMP=0 LWIP_RAW=0 LWIP_DHCP=0 LWIP_AUTOIP=0 LWIP_SNMP=0 LWIP_IGMP=0 LWIP_DNS=0 LWIP_UDP=0 LWIP_TCP=0 LWIP_HAVE_LOOPIF=0 xxx_THREAD_NAME smallest as possible (or NULL if you don't use them) xxx_THREAD_STACKSIZE smallest as possible LWIP_TCPIP_CORE_LOCKING=0 LWIP_NETCONN=0 LWIP_SOCKET=0 LWIP_TCP_KEEPALIVE=0 LWIP_SO_RCVTIMEO=0 LWIP_SO_RCVBUF=0 LWIP_STATS=0 PPP_SUPPORT=0
You can also reduce the code size by using the C runtime memory functions (malloc, free, etc.), which you choose by adding #define MEM_LIBC_MALLOC 1
(typically in your lwipopts.h) This is sensible only if your code is already using the C library memory functions.
Additionally, you can define MEMP_MEM_MALLOC to 1 to disable the memp-pool code and use the heap (lwIP- or C library heap) instead. Of course, this comes at the cost of slower speed (heap is slower than pools).
Finally, if you are absolutely sure your code (and lwIP how you are using it) doesn't have any bugs, you can define LWIP_NOASSERT to prevent assertion code being included