liblwip: Update to use latest lwIP sources This commit updates the CMakeLists.txt scripts to use the latest lwIP sources instead of the sources bundled with the "library". Also update the lwipopts.h options header and add extra configuration values.
diff --git a/liblwip/CMakeLists.txt b/liblwip/CMakeLists.txt index 8550da4..47ece6a 100644 --- a/liblwip/CMakeLists.txt +++ b/liblwip/CMakeLists.txt
@@ -1,5 +1,5 @@ # -# Copyright 2018, Data61 +# Copyright 2020, Data61 # Commonwealth Scientific and Industrial Research Organisation (CSIRO) # ABN 41 687 119 230. # @@ -11,7 +11,6 @@ # cmake_minimum_required(VERSION 3.8.2) - project(liblwip C) set(configure_string "") @@ -20,14 +19,25 @@ mark_as_advanced(LibLwip) add_config_library(lwip "${configure_string}") if(LibLwip) - add_compile_options(-std=gnu99) + find_file(LWIP_PATH lwip PATHS ${CMAKE_SOURCE_DIR}/projects CMAKE_FIND_ROOT_PATH_BOTH) + mark_as_advanced(FORCE LWIP_PATH) + if("${LWIP_PATH}" STREQUAL "LWIP_PATH-NOTFOUND") + message(FATAL_ERROR "Failed to find lwIP. Consider cmake -DLWIP_PATH=/path/to/lwip") + endif() + + get_property(compile_options DIRECTORY PROPERTY COMPILE_OPTIONS) + separate_arguments(cmake_c_flags_sep NATIVE_COMMAND "${CMAKE_C_FLAGS}") + list(APPEND compile_options "${cmake_c_flags_sep}") + + add_custom_target(get_muslc) + add_dependencies(get_muslc muslc) file( GLOB sources - lwip-1.4.1/src/*/*.c - lwip-1.4.1/src/core/snmp/*.c - lwip-1.4.1/src/core/ipv4/*.c + ${LWIP_PATH}/src/*/*.c + ${LWIP_PATH}/src/core/ipv4/*.c + ${LWIP_PATH}/src/apps/snmp/*.c ) add_library(lwip STATIC EXCLUDE_FROM_ALL ${sources}) @@ -35,12 +45,12 @@ target_include_directories( lwip PUBLIC - lwip-1.4.1/src/include - lwip-1.4.1/src/include/ipv4 - lwip-1.4.1/src/include/netif - include - include/lwip + ${LWIP_PATH}/src/include + # Include the header files in this directory which contain header configs + include include/lwip ) target_link_libraries(lwip muslc) + + target_compile_options(lwip PRIVATE ${compile_options}) endif()
diff --git a/liblwip/include/lwip/lwipopts.h b/liblwip/include/lwip/lwipopts.h index ecb5cba..37a257c 100644 --- a/liblwip/include/lwip/lwipopts.h +++ b/liblwip/include/lwip/lwipopts.h
@@ -34,15 +34,26 @@ /* Prevent having to link sys_arch.c (we don't test the API layers in unit tests) */ #define NO_SYS 1 -#define NO_SYS_NO_TIMERS 1 +#define NO_SYS_NO_TIMERS 0 #define LWIP_NETCONN 0 #define LWIP_SOCKET 0 #define LWIP_IGMP 1 #define LWIP_RAND rand +#define LWIP_DHCP 1 #define MEM_ALIGNMENT 4 -#define MEM_SIZE 16000 +#define MEM_SIZE 0x32000 #define ETHARP_SUPPORT_STATIC_ENTRIES 1 +#define SYS_LIGHTWEIGHT_PROT 0 +#define LWIP_NETIF_STATUS_CALLBACK 1 + +#define TCP_SND_QUEUELEN 2500 +#define MEMP_NUM_TCP_SEG TCP_SND_QUEUELEN +#define TCP_SND_BUF (100 * TCP_MSS) +#define TCP_WND (100 * TCP_MSS) +#define LWIP_WND_SCALE 1 +#define TCP_RCV_SCALE 10 +#define PBUF_POOL_SIZE 1000 #endif /* __LWIPOPTS_H__ */