Skip to content

Commit

Permalink
[EFR32] Adds support to toggle LwIP IPv4 flags (#23106)
Browse files Browse the repository at this point in the history
* Adds LWIP flag changes to toggle LWIP_IPV4 builds

* Adds fix for openthread compilation

* Restyled by whitespace

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Feb 14, 2023
1 parent f6a1d6e commit 1173002
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 @@ -79,6 +79,7 @@ assert(!(use_wf200 && chip_enable_openthread))
if (chip_enable_wifi) {
assert(use_rs911x || use_wf200)
enable_openthread_cli = false
import("${chip_root}/src/platform/EFR32/wifi_args.gni")
}

# ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD)
Expand All @@ -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 @@ -79,6 +79,7 @@ assert(!(use_wf200 && chip_enable_openthread))
if (chip_enable_wifi) {
assert(use_rs911x || use_wf200)
enable_openthread_cli = false
import("${chip_root}/src/platform/EFR32/wifi_args.gni")
}

# ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD)
Expand All @@ -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 @@ -79,6 +79,7 @@ assert(!(use_wf200 && chip_enable_openthread))
if (chip_enable_wifi) {
assert(use_rs911x || use_wf200)
enable_openthread_cli = false
import("${chip_root}/src/platform/EFR32/wifi_args.gni")
}

# ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD)
Expand All @@ -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 @@ -76,6 +76,7 @@ assert(!(use_wf200 && chip_enable_openthread))
if (chip_enable_wifi) {
assert(use_rs911x || use_wf200)
enable_openthread_cli = false
import("${chip_root}/src/platform/EFR32/wifi_args.gni")
}

# ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD)
Expand All @@ -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 @@ -73,6 +73,7 @@ assert(!(use_wf200 && chip_enable_openthread))
if (chip_enable_wifi) {
assert(use_rs911x || use_wf200)
enable_openthread_cli = false
import("${chip_root}/src/platform/EFR32/wifi_args.gni")
}

# ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD)
Expand All @@ -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 1173002

Please sign in to comment.