Skip to content

Commit

Permalink
Adds LWIP flag changes to toggle LWIP_IPV4 builds
Browse files Browse the repository at this point in the history
  • Loading branch information
rosahay-silabs committed Oct 11, 2022
1 parent e68ab10 commit eb9b1e1
Show file tree
Hide file tree
Showing 16 changed files with 220 additions and 111 deletions.
31 changes: 23 additions & 8 deletions examples/light-switch-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import("${efr32_sdk_build_root}/efr32_executable.gni")
import("${efr32_sdk_build_root}/efr32_sdk.gni")

import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/platform/EFR32/wifi_args.gni")
import("${chip_root}/src/platform/device.gni")

if (chip_enable_pw_rpc) {
Expand Down Expand Up @@ -92,14 +93,28 @@ if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" ||
if (chip_enable_wifi) {
wifi_sdk_dir = "${chip_root}/src/platform/EFR32/wifi"
efr32_lwip_defs = [ "LWIP_NETIF_API=1" ]
efr32_lwip_defs += [
"LWIP_IPV4=1",
"LWIP_ARP=1",
"LWIP_ICMP=1",
"LWIP_DHCP=1",
"LWIP_IPV6_ND=1",
"LWIP_IGMP=1",
]
if (lwip_ipv4) {
efr32_lwip_defs += [
"LWIP_IPV4=1",

# adds following options to provide
# them to .cpp source files
# flags ported from lwipopts file
# TODO: move lwipopts to one location
"LWIP_ARP=1",
"LWIP_ICMP=1",
"LWIP_IGMP=1",
"LWIP_DHCP=1",
"LWIP_DNS=0",
]
} else {
efr32_lwip_defs += [ "LWIP_IPV4=0" ]
}
if (lwip_ipv6) {
efr32_lwip_defs += [ "LWIP_IPV6=1" ]
} else {
efr32_lwip_defs += [ "LWIP_IPV6=0" ]
}

if (use_rs911x) {
wiseconnect_sdk_root =
Expand Down
31 changes: 23 additions & 8 deletions examples/lighting-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import("${efr32_sdk_build_root}/efr32_executable.gni")
import("${efr32_sdk_build_root}/efr32_sdk.gni")

import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/platform/EFR32/wifi_args.gni")
import("${chip_root}/src/platform/device.gni")

if (chip_enable_pw_rpc) {
Expand Down Expand Up @@ -97,14 +98,28 @@ if (chip_enable_wifi) {
}
wifi_sdk_dir = "${chip_root}/src/platform/EFR32/wifi"
efr32_lwip_defs = [ "LWIP_NETIF_API=1" ]
efr32_lwip_defs += [
"LWIP_IPV4=1",
"LWIP_ARP=1",
"LWIP_ICMP=1",
"LWIP_DHCP=1",
"LWIP_IPV6_ND=1",
"LWIP_IGMP=1",
]
if (lwip_ipv4) {
efr32_lwip_defs += [
"LWIP_IPV4=1",

# adds following options to provide
# them to .cpp source files
# flags ported from lwipopts file
# TODO: move lwipopts to one location
"LWIP_ARP=1",
"LWIP_ICMP=1",
"LWIP_IGMP=1",
"LWIP_DHCP=1",
"LWIP_DNS=0",
]
} else {
efr32_lwip_defs += [ "LWIP_IPV4=0" ]
}
if (lwip_ipv6) {
efr32_lwip_defs += [ "LWIP_IPV6=1" ]
} else {
efr32_lwip_defs += [ "LWIP_IPV6=0" ]
}

if (use_rs911x) {
wiseconnect_sdk_root =
Expand Down
31 changes: 23 additions & 8 deletions examples/lock-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import("${efr32_sdk_build_root}/efr32_executable.gni")
import("${efr32_sdk_build_root}/efr32_sdk.gni")

import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/platform/EFR32/wifi_args.gni")
import("${chip_root}/src/platform/device.gni")

if (chip_enable_pw_rpc) {
Expand Down Expand Up @@ -92,14 +93,28 @@ if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" ||
if (chip_enable_wifi) {
wifi_sdk_dir = "${chip_root}/src/platform/EFR32/wifi"
efr32_lwip_defs = [ "LWIP_NETIF_API=1" ]
efr32_lwip_defs += [
"LWIP_IPV4=1",
"LWIP_ARP=1",
"LWIP_ICMP=1",
"LWIP_DHCP=1",
"LWIP_IPV6_ND=1",
"LWIP_IGMP=1",
]
if (lwip_ipv4) {
efr32_lwip_defs += [
"LWIP_IPV4=1",

# adds following options to provide
# them to .cpp source files
# flags ported from lwipopts file
# TODO: move lwipopts to one location
"LWIP_ARP=1",
"LWIP_ICMP=1",
"LWIP_IGMP=1",
"LWIP_DHCP=1",
"LWIP_DNS=0",
]
} else {
efr32_lwip_defs += [ "LWIP_IPV4=0" ]
}
if (lwip_ipv6) {
efr32_lwip_defs += [ "LWIP_IPV6=1" ]
} else {
efr32_lwip_defs += [ "LWIP_IPV6=0" ]
}

if (use_rs911x) {
wiseconnect_sdk_root =
Expand Down
2 changes: 2 additions & 0 deletions examples/platform/efr32/rs911x/rsi_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,7 @@ void wfx_rsi_task(void * arg)
}
}

#if CHIP_DEVICE_CONFIG_ENABLE_IPV4
/********************************************************************************************
* @fn void wfx_dhcp_got_ipv4(uint32_t ip)
* @brief
Expand All @@ -761,6 +762,7 @@ void wfx_dhcp_got_ipv4(uint32_t ip)
wfx_ip_changed_notify(IP_STATUS_SUCCESS);
wfx_rsi.dev_state |= WFX_RSI_ST_STA_READY;
}
#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */

/*
* WARNING - Taken from RSI and broken up
Expand Down
2 changes: 2 additions & 0 deletions examples/platform/efr32/rs911x/wfx_rsi.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ extern "C" {
void wfx_rsidev_init(void);
void wfx_rsi_task(void * arg);
void efr32Log(const char * aFormat, ...);
#if CHIP_DEVICE_CONFIG_ENABLE_IPV4
void wfx_ip_changed_notify(int got_ip);
#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */
int32_t wfx_rsi_get_ap_info(wfx_wifi_scan_result_t * ap);
int32_t wfx_rsi_get_ap_ext(wfx_wifi_scan_ext_t * extra_info);
int32_t wfx_rsi_reset_count();
Expand Down
3 changes: 2 additions & 1 deletion examples/platform/efr32/rs911x/wfx_rsi_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ sl_status_t wfx_sta_discon(void)
WFX_RSI_LOG("%s: completed.", __func__);
return status;
}

#if CHIP_DEVICE_CONFIG_ENABLE_IPV4
/*********************************************************************
* @fn bool wfx_have_ipv4_addr(sl_wfx_interface_t which_if)
* @brief
Expand All @@ -317,6 +317,7 @@ bool wfx_have_ipv4_addr(sl_wfx_interface_t which_if)
WFX_RSI_LOG("%s: status: %d", __func__, status);
return status;
}
#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */

/*********************************************************************
* @fn bool wfx_have_ipv6_addr(sl_wfx_interface_t which_if)
Expand Down
2 changes: 2 additions & 0 deletions examples/platform/efr32/wf200/host_if.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,7 @@ static void sl_wfx_ap_client_rejected_callback(uint32_t status, uint8_t * mac)
******************************************************************************/
bool wfx_hw_ready(void) { return (wifiContext.state & SL_WFX_STARTED) ? true : false; }

#if CHIP_DEVICE_CONFIG_ENABLE_IPV4
/*****************************************************************************
* @fn void wfx_dhcp_got_ipv4(uint32_t ip)
* @brief
Expand All @@ -1146,6 +1147,7 @@ static void sl_wfx_ap_client_rejected_callback(uint32_t status, uint8_t * mac)
sta_ip = ip;
wfx_ip_changed_notify(IP_STATUS_SUCCESS);
}
#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */

/*****************************************************************************
* @fn wfx_enable_sta_mode(void)
Expand Down
31 changes: 23 additions & 8 deletions examples/thermostat/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import("${efr32_sdk_build_root}/efr32_executable.gni")
import("${efr32_sdk_build_root}/efr32_sdk.gni")

import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/platform/EFR32/wifi_args.gni")
import("${chip_root}/src/platform/device.gni")

if (chip_enable_pw_rpc) {
Expand Down Expand Up @@ -89,14 +90,28 @@ if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" ||
if (chip_enable_wifi) {
wifi_sdk_dir = "${chip_root}/src/platform/EFR32/wifi"
efr32_lwip_defs = [ "LWIP_NETIF_API=1" ]
efr32_lwip_defs += [
"LWIP_IPV4=1",
"LWIP_ARP=1",
"LWIP_ICMP=1",
"LWIP_DHCP=1",
"LWIP_IPV6_ND=1",
"LWIP_IGMP=1",
]
if (lwip_ipv4) {
efr32_lwip_defs += [
"LWIP_IPV4=1",

# adds following options to provide
# them to .cpp source files
# flags ported from lwipopts file
# TODO: move lwipopts to one location
"LWIP_ARP=1",
"LWIP_ICMP=1",
"LWIP_IGMP=1",
"LWIP_DHCP=1",
"LWIP_DNS=0",
]
} else {
efr32_lwip_defs += [ "LWIP_IPV4=0" ]
}
if (lwip_ipv6) {
efr32_lwip_defs += [ "LWIP_IPV6=1" ]
} else {
efr32_lwip_defs += [ "LWIP_IPV6=0" ]
}

if (use_rs911x) {
wiseconnect_sdk_root =
Expand Down
31 changes: 23 additions & 8 deletions examples/window-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import("//build_overrides/efr32_sdk.gni")
import("//build_overrides/pigweed.gni")

import("${build_root}/config/defaults.gni")
import("${chip_root}/src/platform/EFR32/wifi_args.gni")
import("${chip_root}/src/platform/device.gni")
import("${efr32_sdk_build_root}/efr32_executable.gni")
import("${efr32_sdk_build_root}/efr32_sdk.gni")
Expand Down Expand Up @@ -91,14 +92,28 @@ if (chip_enable_wifi) {
}
wifi_sdk_dir = "${chip_root}/src/platform/EFR32/wifi"
efr32_lwip_defs = [ "LWIP_NETIF_API=1" ]
efr32_lwip_defs += [
"LWIP_IPV4=1",
"LWIP_ARP=1",
"LWIP_ICMP=1",
"LWIP_DHCP=1",
"LWIP_IPV6_ND=1",
"LWIP_IGMP=1",
]
if (lwip_ipv4) {
efr32_lwip_defs += [
"LWIP_IPV4=1",

# adds following options to provide
# them to .cpp source files
# flags ported from lwipopts file
# TODO: move lwipopts to one location
"LWIP_ARP=1",
"LWIP_ICMP=1",
"LWIP_IGMP=1",
"LWIP_DHCP=1",
"LWIP_DNS=0",
]
} else {
efr32_lwip_defs += [ "LWIP_IPV4=0" ]
}
if (lwip_ipv6) {
efr32_lwip_defs += [ "LWIP_IPV6=1" ]
} else {
efr32_lwip_defs += [ "LWIP_IPV6=0" ]
}

if (use_rs911x) {
wiseconnect_sdk_root =
Expand Down
Loading

0 comments on commit eb9b1e1

Please sign in to comment.