-->
Page 1 of 1

using lwip instead of espconn

PostPosted: Tue Oct 21, 2014 8:20 am
by wizhippo
What is needed to use lwip directly instead of espconn?

What version of headers would one need?

As I do not use the VM, is there the lwip code available in case I want to enable other lwip features left out of the sdk version of the lib such as slip/ppp/streams?

Are the timers already setup and I should just start using the raw lwip api?

Is there any example out there that uses just the lwip stack? This would probably be the most useful to everyone.

Re: using lwip instead of espconn

PostPosted: Tue Oct 21, 2014 9:53 am
by 0ff
There is one version of the 0.9.1 IoT Example floating around that includes the lwIP sources.
In fact, espconn is just a thin wrapper around lwIP.

From this example it's rather straightforward to build an own version of lwIP.

Re: using lwip instead of espconn

PostPosted: Tue Oct 21, 2014 9:57 am
by igrr
So far I have used only dns resolver in lwip.
Just copied the dns_gethostbyname function declaration from headers of some (old) version of lwip I had from one of the earlier projects. That's not the best approach ;) , but I guess the function prototypes do not change very often, so it worked (i.e. I was able to get my callbacks called, and some sane arguments were passed in).
You can take a look at the output of "xtensa-lx106-elf-nm liblwip.a" to see what parts of lwip are present in the library from the sdk.

Code: Select all
api_lib.o:

api_msg.o:

autoip.o:

def.o:

dhcp.o:
         U __divsi3
         U __udivsi3
00000768 T dhcp_arp_reply
00000518 T dhcp_cleanup
0000026c T dhcp_coarse_tmr
000002b8 T dhcp_fine_tmr
00000650 T dhcp_inform
0000071c T dhcp_network_changed
00000cf8 T dhcp_release
00000a70 T dhcp_renew
00000000 B dhcp_rx_options_given
00000010 B dhcp_rx_options_val
000004f0 T dhcp_set_struct
00000560 T dhcp_start
00000dd4 T dhcp_stop
         U dns_setserver
         U etharp_query
         U ip_addr_any
         U ip_addr_broadcast
         U memset
         U netif_list
         U netif_set_down
         U netif_set_gw
         U netif_set_ipaddr
         U netif_set_netmask
         U netif_set_up
         U pbuf_alloc
         U pbuf_copy_partial
         U pbuf_free
         U pbuf_realloc
         U pvPortMalloc
         U system_station_got_ip_set
         U udp_bind
         U udp_connect
         U udp_new
         U udp_recv
         U udp_remove
         U udp_sendto_if
         U vPortFree

dhcpserver.o:
00000708 T dhcps_start
         U ets_memcmp
         U ets_memcpy
         U ets_memset
         U ip_addr_any
         U memcpy
         U os_printf
         U pbuf_alloc
         U pbuf_free
00000010 B s
         U udp_bind
         U udp_new
         U udp_recv
         U udp_sendto
         U wifi_softap_free_station_info
         U wifi_softap_get_station_info
         U wifi_softap_set_station_info

dns.o:
000005f8 T dns_gethostbyname
000000c8 T dns_getserver
0000002c T dns_init
00000094 T dns_setserver
00000008 T dns_tmr
         U ets_memcpy
         U ip_addr_any
         U ipaddr_addr
         U memcpy
         U memset
         U pbuf_alloc
         U pbuf_copy_partial
         U pbuf_free
         U pbuf_realloc
         U strlen
         U udp_bind
         U udp_connect
         U udp_new
         U udp_recv
         U udp_sendto

err.o:

espconn.o:
         U __umodsi3
         U dns_gethostbyname
000003f0 T espconn_accept
0000016c T espconn_connect
00000010 T espconn_copy_partial
00000478 T espconn_disconnect
000000e4 T espconn_find_connection
000002d4 T espconn_get_connection_info
000004c0 T espconn_gethostbyname
000000a0 T espconn_list_creat
000000bc T espconn_list_delete
00000010 T espconn_port
00000270 T espconn_regist_connectcb
0000029c T espconn_regist_disconcb
0000028c T espconn_regist_reconcb
00000280 T espconn_regist_recvcb
00000264 T espconn_regist_sentcb
0000042c T espconn_regist_time
0000020c T espconn_sent
         U espconn_tcp_client
         U espconn_tcp_disconnect
         U espconn_tcp_sent
         U espconn_tcp_server
         U espconn_udp_client
         U espconn_udp_disconnect
         U espconn_udp_sent
         U espconn_udp_server
         U ets_memcpy
         U ets_memset
00000004 B link_timer
         U os_printf
00000000 B plink_active
00000010 B premot
         U system_get_time
         U wifi_get_ip_info
         U wifi_get_opmode

espconn_tcp.o:
         U espconn_copy_partial
         U espconn_get_connection_info
         U espconn_list_creat
         U espconn_list_delete
00000560 T espconn_tcp_client
000001a0 T espconn_tcp_disconnect
00000118 T espconn_tcp_sent
00000a9c T espconn_tcp_server
         U ets_memcpy
         U ets_timer_arm_new
         U ets_timer_disarm
         U ets_timer_setfn
         U ip_addr_any
         U link_timer
         U os_printf
         U pbuf_copy_partial
         U pbuf_free
         U plink_active
         U pvPortZalloc
         U tcp_abandon
         U tcp_accept
         U tcp_arg
         U tcp_bind
         U tcp_close
         U tcp_connect
         U tcp_err
         U tcp_listen_with_backlog
         U tcp_new
         U tcp_output
         U tcp_poll
         U tcp_recv
         U tcp_recved
         U tcp_sent
         U tcp_write
         U vPortFree

espconn_udp.o:
         U espconn_list_creat
         U espconn_list_delete
00000238 T espconn_udp_client
000001c8 T espconn_udp_disconnect
00000048 T espconn_udp_sent
00000304 T espconn_udp_server
         U ets_memcpy
         U ip_addr_any
         U memcpy
         U pbuf_alloc
         U pbuf_copy_partial
         U pbuf_free
         U plink_active
         U pvPortZalloc
         U sys_timeout
         U udp_bind
         U udp_connect
         U udp_disconnect
         U udp_new
         U udp_recv
         U udp_remove
         U udp_send
         U vPortFree

etharp.o:
         U dhcp_arp_reply
00000274 T etharp_cleanup_netif
000002b4 T etharp_find_addr
00000510 T etharp_output
00000620 T etharp_query
00000848 T etharp_request
00000038 T etharp_tmr
00000000 R ethbroadcast
00000878 T ethernet_input
00000006 R ethzero
         U ets_memcpy
         U ip4_addr_isbroadcast
         U ip_input
         U memp_free
         U memp_malloc
         U pbuf_alloc
         U pbuf_copy
         U pbuf_free
         U pbuf_header
         U pbuf_ref

icmp.o:
         U current_iphdr_dest
         U current_iphdr_src
         U ets_memcpy
00000240 T icmp_dest_unreach
00000060 T icmp_input
         U inet_chksum
         U inet_chksum_pbuf
         U ip4_addr_isbroadcast
         U ip_output
         U ip_output_if
         U pbuf_alloc
         U pbuf_copy
         U pbuf_free
         U pbuf_header

igmp.o:

inet_chksum.o:
0000022c T inet_chksum
00000244 T inet_chksum_pbuf
0000007c T inet_chksum_pseudo
00000148 T inet_chksum_pseudo_partial

inet.o:

init.o:
         U dns_init
00000010 T lwip_init
         U memp_init
         U netif_init
         U sys_timeouts_init

ip_addr.o:
         U __udivsi3
         U __umodsi3
00000000 T ip4_addr_isbroadcast
00000034 T ip4_addr_netmask_valid
00000000 R ip_addr_any
00000004 R ip_addr_broadcast
00000078 T ipaddr_addr
0000009c T ipaddr_aton
00000200 T ipaddr_ntoa
0000021c T ipaddr_ntoa_r

ip_frag.o:

ip.o:
0000000c B current_header
00000000 B current_iphdr_dest
00000004 B current_iphdr_src
00000008 B current_netif
         U icmp_dest_unreach
         U icmp_input
         U inet_chksum
         U ip4_addr_isbroadcast
0000014c T ip_input
000004e8 T ip_output
00000388 T ip_output_if
00000010 T ip_route
00000088 T ip_router
         U netif_default
         U netif_list
         U os_printf
         U pbuf_free
         U pbuf_header
         U pbuf_realloc
         U tcp_input
         U udp_input

mem.o:

memp.o:
00000010 D memp_desc
000000c8 T memp_free
00000044 T memp_init
000000a8 T memp_malloc
00000570 B memp_memory_ARP_QUEUE_base
000006f0 B memp_memory_PBUF_POOL_base
00000620 B memp_memory_PBUF_base
000005c0 B memp_memory_SYS_TIMEOUT_base
000003e0 B memp_memory_TCP_PCB_LISTEN_base
00000080 B memp_memory_TCP_PCB_base
00000430 B memp_memory_TCP_SEG_base
00000000 B memp_memory_UDP_PCB_base
00000000 D memp_sizes_test

netbuf.o:

netdb.o:

netifapi.o:

netif.o:
         U dhcp_network_changed
         U etharp_cleanup_netif
         U etharp_request
0000000c T netif_add
00000004 B netif_default
000000dc T netif_find
00000000 T netif_init
00000000 B netif_list
0000008c T netif_remove
00000060 T netif_set_addr
000001ac T netif_set_default
000001e4 T netif_set_down
00000188 T netif_set_gw
00000120 T netif_set_ipaddr
00000250 T netif_set_link_down
00000210 T netif_set_link_up
00000198 T netif_set_netmask
000001b8 T netif_set_up
         U tcp_abort
         U tcp_active_pcbs
         U tcp_listen_pcbs

netio.o:
         U __udivsi3
         U ip_addr_any
00000434 T netio_init
         U pbuf_free
         U pvPortMalloc
         U tcp_accept
         U tcp_arg
         U tcp_bind
         U tcp_close
         U tcp_listen_with_backlog
         U tcp_new
         U tcp_poll
         U tcp_recv
         U tcp_recved
         U tcp_sent
         U tcp_write
         U vPortFree

pbuf.o:
         U ets_memcpy
         U memp_free
         U memp_malloc
00000010 T pbuf_alloc
000002bc T pbuf_cat
000002e8 T pbuf_chain
00000298 T pbuf_clen
000004dc T pbuf_coalesce
00000344 T pbuf_copy
000003ec T pbuf_copy_partial
00000304 T pbuf_dechain
00000218 T pbuf_free
00000510 T pbuf_get_at
0000019c T pbuf_header
0000053c T pbuf_memcmp
000005b4 T pbuf_memfind
00000154 T pbuf_realloc
000002b0 T pbuf_ref
00000614 T pbuf_strstr
00000478 T pbuf_take
         U pvPortMalloc
         U strlen
         U system_pp_recycle_rx_pkt
         U vPortFree

ping.o:

raw.o:

sockets.o:

stats.o:

sys_arch.o:

sys.o:

tcp_in.o:
         U __divsi3
         U current_iphdr_dest
         U current_iphdr_src
         U inet_chksum_pseudo
         U ip4_addr_isbroadcast
         U memp_free
         U pbuf_clen
         U pbuf_free
         U pbuf_header
         U pbuf_realloc
         U tcp_abandon
         U tcp_abort
         U tcp_active_pcbs
         U tcp_alloc
         U tcp_eff_send_mss
         U tcp_enqueue_flags
00000094 T tcp_input
00000030 B tcp_input_pcb
         U tcp_listen_pcbs
         U tcp_output
         U tcp_pcb_purge
         U tcp_pcb_remove
         U tcp_recv_null
         U tcp_rexmit
         U tcp_rexmit_fast
         U tcp_rst
         U tcp_seg_free
         U tcp_send_empty_ack
         U tcp_ticks
         U tcp_timer_needed
         U tcp_tmp_pcb
         U tcp_tw_pcbs
         U tcp_update_rcv_ann_wnd

tcpip.o:

tcp.o:
         U __udivsi3
         U ip_route
         U memcpy
         U memp_free
         U memp_malloc
         U memset
         U pbuf_free
000000d0 T tcp_abandon
00000170 T tcp_abort
00000a18 T tcp_accept
00000004 B tcp_active_pcbs
00000928 T tcp_alloc
000009fc T tcp_arg
00000020 R tcp_backoff
00000198 T tcp_bind
00000010 B tcp_bound_pcbs
00000028 T tcp_close
000003a0 T tcp_connect
00000b30 T tcp_debug_state_str
00000af8 T tcp_eff_send_mss
         U tcp_enqueue_flags
00000a10 T tcp_err
00000778 T tcp_fasttmr
         U tcp_keepalive
00000014 B tcp_listen_pcbs
0000023c T tcp_listen_with_backlog
000009e8 T tcp_new
00000ae4 T tcp_next_iss
         U tcp_output
00000000 R tcp_pcb_lists
00000a28 T tcp_pcb_purge
00000a78 T tcp_pcb_remove
00000010 R tcp_persist_backoff
00000a1c T tcp_poll
00000a00 T tcp_recv
0000084c T tcp_recv_null
00000334 T tcp_recved
         U tcp_rexmit_rto
         U tcp_rst
00000818 T tcp_seg_free
000007f4 T tcp_segs_free
         U tcp_send_fin
00000a08 T tcp_sent
00000840 T tcp_setprio
00000054 T tcp_shutdown
000004f0 T tcp_slowtmr
00000030 R tcp_state_str
00000018 B tcp_ticks
         U tcp_timer_needed
00000008 B tcp_tmp_pcb
00000004 T tcp_tmr
0000000c B tcp_tw_pcbs
000002f0 T tcp_update_rcv_ann_wnd
         U tcp_zero_window_probe

tcp_out.o:
         U ets_memcpy
         U inet_chksum_pseudo
         U ip_output
         U ip_route
         U memp_malloc
         U pbuf_alloc
         U pbuf_cat
         U pbuf_clen
         U pbuf_copy_partial
         U pbuf_free
         U pbuf_header
000006b0 T tcp_enqueue_flags
         U tcp_input_pcb
00000de4 T tcp_keepalive
0000084c T tcp_output
00000cd0 T tcp_rexmit
00000d7c T tcp_rexmit_fast
00000c90 T tcp_rexmit_rto
00000b64 T tcp_rst
         U tcp_seg_free
         U tcp_segs_free
000007a4 T tcp_send_empty_ack
0000010c T tcp_send_fin
         U tcp_ticks
00000354 T tcp_write
00000e7c T tcp_zero_window_probe

timers.o:
         U __udivsi3
         U dhcp_coarse_tmr
         U dhcp_fine_tmr
         U dns_tmr
         U etharp_tmr
         U memp_free
         U memp_malloc
00000258 T sys_check_timeouts
00000318 T sys_restart_timeouts
00000168 T sys_timeout
00000110 T sys_timeouts_init
000001e4 T sys_untimeout
         U tcp_active_pcbs
00000060 T tcp_timer_needed
         U tcp_tmr
         U tcp_tw_pcbs
         U timer2_ms_flag

udp.o:
         U current_iphdr_dest
         U current_iphdr_src
         U icmp_dest_unreach
         U inet_chksum_pseudo
         U ip4_addr_isbroadcast
         U ip_output_if
         U ip_route
         U memp_free
         U memp_malloc
         U memset
         U pbuf_alloc
         U pbuf_chain
         U pbuf_free
         U pbuf_header
00000434 T udp_bind
000004b4 T udp_connect
00000510 T udp_disconnect
00000054 T udp_input
00000578 T udp_new
00000000 B udp_pcbs
00000528 T udp_recv
00000538 T udp_remove
00000280 T udp_send
0000029c T udp_sendto
000002f4 T udp_sendto_if



Edit: didn't know the IoT SDK had lwip sources, googling for that now.

Re: using lwip instead of espconn

PostPosted: Tue Oct 21, 2014 11:51 am
by tinhead
yes it does, the liblwip, libjson, libupgrade (well, and libupgrade_ssl when one build with ssl) and libssl are available as sources. The libjson need to be compiled with -DJSON_FORMAT to enable all functions which currenlty enabled in the complied (distributed) version of that lib. Defines for other libs are properly predefined in included makefile.