Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EFR32] Add comments to examples BUILD.gn #16575

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 72 additions & 51 deletions examples/light-switch-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ declare_args() {
show_qr_code = true
}

# Sanity check
assert(!(chip_enable_wifi && chip_enable_openthread))
assert(!(use_rs911x && chip_enable_openthread))
assert(!(use_wf200 && chip_enable_openthread))
if (chip_enable_wifi) {
assert(use_rs911x || use_wf200)
}

# BRD4166A --> ThunderBoard Sense 2 (No LCD)
if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") {
show_qr_code = false
Expand All @@ -70,17 +78,10 @@ if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") {
# Enables LCD on supported devices
lcd_on = show_qr_code

if (use_rs911x || use_wf200) {
# WiFi settings
if (chip_enable_wifi) {
wifi_sdk_dir = "${chip_root}/third_party/efr32_sdk/repo/matter/wifi"
if (use_rs911x) {
wiseconnect_sdk_root = "${chip_root}/third_party/wiseconnect-wifi-bt-sdk"
import("${wifi_sdk_dir}/rs911x/rs911x.gni")
} else {
import("${wifi_sdk_dir}/wf200/wf200.gni")
}
}
efr32_lwip_defs = [ "LWIP_NETIF_API=1" ]
if (use_rs911x || use_wf200) {
efr32_lwip_defs = [ "LWIP_NETIF_API=1" ]
efr32_lwip_defs += [
"LWIP_IPV4=1",
"LWIP_ARP=1",
Expand All @@ -89,6 +90,13 @@ if (use_rs911x || use_wf200) {
"LWIP_IPV6_ND=1",
"LWIP_IGMP=1",
]

if (use_rs911x) {
wiseconnect_sdk_root = "${chip_root}/third_party/wiseconnect-wifi-bt-sdk"
import("${wifi_sdk_dir}/rs911x/rs911x.gni")
} else {
import("${wifi_sdk_dir}/wf200/wf200.gni")
}
}

efr32_sdk("sdk") {
Expand Down Expand Up @@ -117,25 +125,25 @@ efr32_sdk("sdk") {
"PW_RPC_ENABLED",
]
}
if (use_rs911x) {
defines += rs911x_defs
include_dirs += rs911x_plat_incs
} else if (use_wf200) {
defines += wf200_defs
include_dirs += wf200_plat_incs
}

if (use_rs911x_sockets) {
include_dirs += [ "${examples_plat_dir}/wifi/rsi-sockets" ]
defines += rs911x_sock_defs
} else {
# Using LWIP instead of the native TCP/IP stack
# Thread also uses LWIP
#
defines += efr32_lwip_defs
}
# WiFi Settings
if (chip_enable_wifi) {
if (use_rs911x) {
defines += rs911x_defs
include_dirs += rs911x_plat_incs
} else if (use_wf200) {
defines += wf200_defs
include_dirs += wf200_plat_incs
}

if (use_rs911x_sockets) {
include_dirs += [ "${examples_plat_dir}/wifi/rsi-sockets" ]
defines += rs911x_sock_defs
} else {
# Using LWIP instead of the native TCP/IP stack
defines += efr32_lwip_defs
}

if (use_rs911x || use_wf200) {
if (sl_wfx_config_softap) {
defines += [ "SL_WFX_CONFIG_SOFTAP" ]
}
Expand Down Expand Up @@ -171,7 +179,9 @@ efr32_executable("light_switch_app") {
"${chip_root}/src/lib",
"${chip_root}/src/setup_payload",
]
if (!use_rs911x && !use_wf200) {

# OpenThread Settings
if (chip_enable_openthread) {
deps += [
"${chip_root}/third_party/openthread/platforms:libopenthread-platform",
"${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils",
Expand All @@ -195,30 +205,33 @@ efr32_executable("light_switch_app") {
sources += [ "${examples_plat_dir}/OTAConfig.cpp" ]
}

if (use_rs911x) {
sources += rs911x_src_plat

# All the stuff from wiseconnect
sources += rs911x_src_sapi

# Apparently - the rsi library needs this (though we may not use use it)
sources += rs911x_src_sock
include_dirs += rs911x_inc_plat

if (use_rs911x_sockets) {
#
# Using native sockets inside RS911x
#
include_dirs += rs911x_sock_inc
} else {
#
# We use LWIP - not built-in sockets
#
sources += rs911x_src_lwip
# WiFi Settings
if (chip_enable_wifi) {
if (use_rs911x) {
sources += rs911x_src_plat

# All the stuff from wiseconnect
sources += rs911x_src_sapi

# Apparently - the rsi library needs this (though we may not use use it)
sources += rs911x_src_sock
include_dirs += rs911x_inc_plat

if (use_rs911x_sockets) {
#
# Using native sockets inside RS911x
#
include_dirs += rs911x_sock_inc
} else {
#
# We use LWIP - not built-in sockets
#
sources += rs911x_src_lwip
}
} else if (use_wf200) {
sources += wf200_plat_src
include_dirs += wf200_plat_incs
}
} else if (use_wf200) {
sources += wf200_plat_src
include_dirs += wf200_plat_incs
}

if (lcd_on) {
Expand Down Expand Up @@ -285,6 +298,14 @@ efr32_executable("light_switch_app") {
]
}

# WiFi Settings
if (chip_enable_wifi) {
ldflags += [
"-Wl,--defsym",
"-Wl,SILABS_WIFI=1",
]
}

output_dir = root_out_dir
}

Expand Down
120 changes: 68 additions & 52 deletions examples/lighting-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ declare_args() {
show_qr_code = true
}

# Sanity check
assert(!(chip_enable_wifi && chip_enable_openthread))
assert(!(use_rs911x && chip_enable_openthread))
assert(!(use_wf200 && chip_enable_openthread))
if (chip_enable_wifi) {
assert(use_rs911x || use_wf200)
}

# BRD4166A --> ThunderBoard Sense 2 (No LCD)
if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") {
show_qr_code = false
Expand All @@ -70,17 +78,10 @@ if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") {
# Enables LCD on supported devices
lcd_on = show_qr_code

if (use_rs911x || use_wf200) {
# WiFi settings
if (chip_enable_wifi) {
wifi_sdk_dir = "${chip_root}/third_party/efr32_sdk/repo/matter/wifi"
if (use_rs911x) {
wiseconnect_sdk_root = "${chip_root}/third_party/wiseconnect-wifi-bt-sdk"
import("${wifi_sdk_dir}/rs911x/rs911x.gni")
} else {
import("${wifi_sdk_dir}/wf200/wf200.gni")
}
}
efr32_lwip_defs = [ "LWIP_NETIF_API=1" ]
if (use_rs911x || use_wf200) {
efr32_lwip_defs = [ "LWIP_NETIF_API=1" ]
efr32_lwip_defs += [
"LWIP_IPV4=1",
"LWIP_ARP=1",
Expand All @@ -89,6 +90,13 @@ if (use_rs911x || use_wf200) {
"LWIP_IPV6_ND=1",
"LWIP_IGMP=1",
]

if (use_rs911x) {
wiseconnect_sdk_root = "${chip_root}/third_party/wiseconnect-wifi-bt-sdk"
import("${wifi_sdk_dir}/rs911x/rs911x.gni")
} else {
import("${wifi_sdk_dir}/wf200/wf200.gni")
}
}

efr32_sdk("sdk") {
Expand Down Expand Up @@ -117,24 +125,25 @@ efr32_sdk("sdk") {
"PW_RPC_ENABLED",
]
}
if (use_rs911x) {
defines += rs911x_defs
include_dirs += rs911x_plat_incs
} else if (use_wf200) {
defines += wf200_defs
include_dirs += wf200_plat_incs
}

if (use_rs911x_sockets) {
include_dirs += [ "${examples_plat_dir}/wifi/rsi-sockets" ]
defines += rs911x_sock_defs
} else {
# Using LWIP instead of the native TCP/IP stack
# Thread also uses LWIP
#
defines += efr32_lwip_defs
}
if (use_rs911x || use_wf200) {
# WiFi Settings
if (chip_enable_wifi) {
if (use_rs911x) {
defines += rs911x_defs
include_dirs += rs911x_plat_incs
} else if (use_wf200) {
defines += wf200_defs
include_dirs += wf200_plat_incs
}

if (use_rs911x_sockets) {
include_dirs += [ "${examples_plat_dir}/wifi/rsi-sockets" ]
defines += rs911x_sock_defs
} else {
# Using LWIP instead of the native TCP/IP stack
defines += efr32_lwip_defs
}

if (sl_wfx_config_softap) {
defines += [ "SL_WFX_CONFIG_SOFTAP" ]
}
Expand Down Expand Up @@ -169,7 +178,9 @@ efr32_executable("lighting_app") {
"${chip_root}/src/lib",
"${chip_root}/src/setup_payload",
]
if (!use_rs911x && !use_wf200) {

# OpenThread Settings
if (chip_enable_openthread) {
deps += [
"${chip_root}/third_party/openthread/platforms:libopenthread-platform",
"${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils",
Expand All @@ -193,30 +204,33 @@ efr32_executable("lighting_app") {
sources += [ "${examples_plat_dir}/OTAConfig.cpp" ]
}

if (use_rs911x) {
sources += rs911x_src_plat

# All the stuff from wiseconnect
sources += rs911x_src_sapi

# Apparently - the rsi library needs this (though we may not use use it)
sources += rs911x_src_sock
include_dirs += rs911x_inc_plat

if (use_rs911x_sockets) {
#
# Using native sockets inside RS911x
#
include_dirs += rs911x_sock_inc
} else {
#
# We use LWIP - not built-in sockets
#
sources += rs911x_src_lwip
# WiFi Settings
if (chip_enable_wifi) {
if (use_rs911x) {
sources += rs911x_src_plat

# All the stuff from wiseconnect
sources += rs911x_src_sapi

# Apparently - the rsi library needs this (though we may not use use it)
sources += rs911x_src_sock
include_dirs += rs911x_inc_plat

if (use_rs911x_sockets) {
#
# Using native sockets inside RS911x
#
include_dirs += rs911x_sock_inc
} else {
#
# We use LWIP - not built-in sockets
#
sources += rs911x_src_lwip
}
} else if (use_wf200) {
sources += wf200_plat_src
include_dirs += wf200_plat_incs
}
} else if (use_wf200) {
sources += wf200_plat_src
include_dirs += wf200_plat_incs
}

if (lcd_on) {
Expand Down Expand Up @@ -287,7 +301,9 @@ efr32_executable("lighting_app") {
"-fstack-usage",
]
}
if (use_rs911x || use_wf200) {

# WiFi Settings
if (chip_enable_wifi) {
ldflags += [
"-Wl,--defsym",
"-Wl,SILABS_WIFI=1",
Expand Down
Loading