Skip to content

Commit

Permalink
Rebase silabs to csa master and update build.gn of silabs_examples to…
Browse files Browse the repository at this point in the history
… keep up with upstream changes
  • Loading branch information
jmartinez-silabs committed Oct 7, 2022
1 parent c2eb624 commit c84abce
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 91 deletions.
38 changes: 21 additions & 17 deletions silabs_examples/lighting-lite-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ declare_args() {
# Dump memory usage at link time.
chip_print_memory_usage = false

# PIN code for PASE session establishment.
setupPinCode = 20202021
setupDiscriminator = 3840

# Monitor & log memory usage at runtime.
enable_heap_monitoring = false

Expand Down Expand Up @@ -83,23 +79,24 @@ assert(!(use_rs911x && chip_enable_openthread))
assert(!(use_wf200 && chip_enable_openthread))
if (chip_enable_wifi) {
assert(use_rs911x || use_wf200)
enable_openthread_cli = false
}

# ThunderBoards and Explorer Kit (No LCD)
if (efr32_board == "BRD4166A" || efr32_board == "BRD2601B" ||
efr32_board == "BRD2703A") {
# ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD)
if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" ||
silabs_board == "BRD2703A" || silabs_board == "BRD4319A") {
show_qr_code = false
disable_lcd = true
}

# WiFi settings
if (chip_enable_wifi) {
# disabling LCD for MG24 for wifi
if (efr32_board == "BRD4186A" || efr32_board == "BRD4187A") {
if (silabs_board == "BRD4186A" || silabs_board == "BRD4187A") {
show_qr_code = false
disable_lcd = true
}
wifi_sdk_dir = "${chip_root}/third_party/silabs/matter_support/matter/wifi"
wifi_sdk_dir = "${chip_root}/src/platform/EFR32/wifi"
efr32_lwip_defs = [ "LWIP_NETIF_API=1" ]
efr32_lwip_defs += [
"LWIP_IPV4=1",
Expand All @@ -113,9 +110,9 @@ if (chip_enable_wifi) {
if (use_rs911x) {
wiseconnect_sdk_root =
"${chip_root}/third_party/silabs/wiseconnect-wifi-bt-sdk"
import("${wifi_sdk_dir}/rs911x/rs911x.gni")
import("${examples_plat_dir}/rs911x/rs911x.gni")
} else {
import("${wifi_sdk_dir}/wf200/wf200.gni")
import("${examples_plat_dir}/wf200/wf200.gni")
}
}

Expand All @@ -133,9 +130,7 @@ efr32_sdk("sdk") {
]

defines = [
"BOARD_ID=${efr32_board}",
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}",
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setupDiscriminator}",
"BOARD_ID=${silabs_board}",
"OTA_PERIODIC_TIMEOUT=${OTA_periodic_query_timeout}",
]

Expand Down Expand Up @@ -180,7 +175,6 @@ efr32_executable("lighting-lite_app") {

sources = [
"${examples_plat_dir}/BaseApplication.cpp",
"${examples_plat_dir}/LEDWidget.cpp",
"${examples_plat_dir}/efr32_utils.cpp",
"${examples_plat_dir}/heap_4_silabs.c",
"${examples_plat_dir}/init_efrPlatform.cpp",
Expand All @@ -191,7 +185,12 @@ efr32_executable("lighting-lite_app") {
"src/main.cpp",
]

if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli) {
if (use_wstk_leds) {
sources += [ "${examples_plat_dir}/LEDWidget.cpp" ]
}

if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli ||
use_wf200 || use_rs911x) {
sources += [ "${examples_plat_dir}/uart.cpp" ]
}

Expand Down Expand Up @@ -323,7 +322,7 @@ efr32_executable("lighting-lite_app") {
defines += [ "HEAP_MONITORING" ]
}

ldscript = "${examples_plat_dir}/ldscripts/${efr32_family}.ld"
ldscript = "${examples_plat_dir}/ldscripts/${silabs_family}.ld"

inputs = [ ldscript ]

Expand All @@ -349,6 +348,11 @@ efr32_executable("lighting-lite_app") {
deps += [ "${examples_plat_dir}:efr32-attestation-credentials" ]
}

# Factory Data Provider
if (use_efr32_factory_data_provider) {
deps += [ "${examples_plat_dir}:efr32-factory-data-provider" ]
}

output_dir = root_out_dir
}

Expand Down
28 changes: 15 additions & 13 deletions silabs_examples/onoff-plug-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ declare_args() {
# Dump memory usage at link time.
chip_print_memory_usage = false

# PIN code for PASE session establishment.
setupPinCode = 20202021
setupDiscriminator = 3840

# Monitor & log memory usage at runtime.
enable_heap_monitoring = false

Expand Down Expand Up @@ -85,9 +81,9 @@ if (chip_enable_wifi) {
enable_openthread_cli = false
}

# ThunderBoards and Explorer Kit (No LCD)
# ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD)
if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" ||
silabs_board == "BRD2703A") {
silabs_board == "BRD2703A" || silabs_board == "BRD4319A") {
show_qr_code = false
disable_lcd = true
}
Expand All @@ -99,7 +95,7 @@ if (chip_enable_wifi) {
show_qr_code = false
disable_lcd = true
}
wifi_sdk_dir = "${chip_root}/third_party/silabs/matter_support/matter/wifi"
wifi_sdk_dir = "${chip_root}/src/platform/EFR32/wifi"
efr32_lwip_defs = [ "LWIP_NETIF_API=1" ]
efr32_lwip_defs += [
"LWIP_IPV4=1",
Expand All @@ -113,9 +109,9 @@ if (chip_enable_wifi) {
if (use_rs911x) {
wiseconnect_sdk_root =
"${chip_root}/third_party/silabs/wiseconnect-wifi-bt-sdk"
import("${wifi_sdk_dir}/rs911x/rs911x.gni")
import("${examples_plat_dir}/rs911x/rs911x.gni")
} else {
import("${wifi_sdk_dir}/wf200/wf200.gni")
import("${examples_plat_dir}/wf200/wf200.gni")
}
}

Expand All @@ -134,8 +130,6 @@ efr32_sdk("sdk") {

defines = [
"BOARD_ID=${silabs_board}",
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}",
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setupDiscriminator}",
"OTA_PERIODIC_TIMEOUT=${OTA_periodic_query_timeout}",
]

Expand Down Expand Up @@ -180,7 +174,6 @@ efr32_executable("onoff_plug_app") {

sources = [
"${examples_plat_dir}/BaseApplication.cpp",
"${examples_plat_dir}/LEDWidget.cpp",
"${examples_plat_dir}/efr32_utils.cpp",
"${examples_plat_dir}/heap_4_silabs.c",
"${examples_plat_dir}/init_efrPlatform.cpp",
Expand All @@ -191,8 +184,12 @@ efr32_executable("onoff_plug_app") {
"src/main.cpp",
]

if (use_wstk_leds) {
sources += [ "${examples_plat_dir}/LEDWidget.cpp" ]
}

if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli ||
use_wf200) {
use_wf200 || use_rs911x) {
sources += [ "${examples_plat_dir}/uart.cpp" ]
}

Expand Down Expand Up @@ -350,6 +347,11 @@ efr32_executable("onoff_plug_app") {
deps += [ "${examples_plat_dir}:efr32-attestation-credentials" ]
}

# Factory Data Provider
if (use_efr32_factory_data_provider) {
deps += [ "${examples_plat_dir}:efr32-factory-data-provider" ]
}

output_dir = root_out_dir
}

Expand Down
81 changes: 51 additions & 30 deletions silabs_examples/sl-newLight/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ declare_args() {
# Dump memory usage at link time.
chip_print_memory_usage = false

# PIN code for PASE session establishment.
setupPinCode = 20202021
setupDiscriminator = 3840

# Monitor & log memory usage at runtime.
enable_heap_monitoring = false

Expand All @@ -58,24 +54,41 @@ declare_args() {
sl_wfx_config_softap = false
sl_wfx_config_scan = true

# Enables LCD Qr Code on supported devices
show_qr_code = true
# Disable LCD on supported devices
disable_lcd = false

# Argument to Disable IPv4 for wifi(rs911)
chip_enable_wifi_ipv4 = false

# Argument to force enable WPA3 security on rs91x
rs91x_wpa3_only = false

# Enables RGB LEDs on supported devices
rgb_led = false
}

declare_args() {
# Enables LCD Qr Code on supported devices
show_qr_code = !disable_lcd
}

# qr code cannot be true if lcd is disabled
assert(!(disable_lcd && show_qr_code))

# 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)
enable_openthread_cli = false
}

# BRD4166A --> ThunderBoard Sense 2 (No LCD)
if (silabs_board == "BRD4166A" || silabs_board == "BRD4180A") {
# ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD)
if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" ||
silabs_board == "BRD2703A" || silabs_board == "BRD4319A") {
show_qr_code = false
disable_lcd = true
}

if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B") {
Expand All @@ -90,7 +103,12 @@ rgb_on = rgb_led

# WiFi settings
if (chip_enable_wifi) {
wifi_sdk_dir = "${chip_root}/third_party/efr32_sdk/repo/matter/wifi"
# disabling LCD for MG24 for wifi
if (silabs_board == "BRD4186A" || silabs_board == "BRD4187A") {
show_qr_code = false
disable_lcd = true
}
wifi_sdk_dir = "${chip_root}/src/platform/EFR32/wifi"
efr32_lwip_defs = [ "LWIP_NETIF_API=1" ]
efr32_lwip_defs += [
"LWIP_IPV4=1",
Expand All @@ -103,10 +121,10 @@ if (chip_enable_wifi) {

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

Expand All @@ -126,8 +144,6 @@ efr32_sdk("sdk") {

defines = [
"BOARD_ID=${silabs_board}",
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}",
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setupDiscriminator}",
"OTA_PERIODIC_TIMEOUT=${OTA_periodic_query_timeout}",
]

Expand Down Expand Up @@ -172,7 +188,6 @@ efr32_executable("newLight_app") {

sources = [
"${examples_plat_dir}/BaseApplication.cpp",
"${examples_plat_dir}/LEDWidget.cpp",
"${examples_plat_dir}/efr32_utils.cpp",
"${examples_plat_dir}/heap_4_silabs.c",
"${examples_plat_dir}/init_efrPlatform.cpp",
Expand All @@ -183,7 +198,12 @@ efr32_executable("newLight_app") {
"src/main.cpp",
]

if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli) {
if (use_wstk_leds) {
sources += [ "${examples_plat_dir}/LEDWidget.cpp" ]
}

if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli ||
use_wf200 || use_rs911x) {
sources += [ "${examples_plat_dir}/uart.cpp" ]
}

Expand All @@ -202,18 +222,6 @@ efr32_executable("newLight_app") {
"${chip_root}/third_party/openthread:openthread-platform",
"${examples_plat_dir}:efr-matter-shell",
]
if (chip_openthread_ftd) {
deps += [
"${chip_root}/third_party/openthread:openthread",
"${chip_root}/third_party/openthread:openthread-platform",
"${examples_plat_dir}:efr-matter-shell",
]
} else {
deps += [
"${chip_root}/third_party/openthread/repo:libopenthread-cli-mtd",
"${chip_root}/third_party/openthread/repo:libopenthread-mtd",
]
}
}

if (chip_enable_ota_requestor) {
Expand Down Expand Up @@ -248,9 +256,18 @@ efr32_executable("newLight_app") {
sources += wf200_plat_src
include_dirs += wf200_plat_incs
}

if (chip_enable_wifi_ipv4) {
defines += [ "CHIP_DEVICE_CONFIG_ENABLE_IPV4" ]
}

if (rs91x_wpa3_only) {
# TODO: Change this macro once WF200 support is provided
defines += [ "WIFI_ENABLE_SECURITY_WPA3=1" ]
}
}

if (lcd_on) {
if (!disable_lcd) {
sources += [
"${examples_plat_dir}/display/demo-ui.c",
"${examples_plat_dir}/display/lcd.cpp",
Expand Down Expand Up @@ -345,11 +362,15 @@ efr32_executable("newLight_app") {
}

# Attestation Credentials

if (chip_build_platform_attestation_credentials_provider) {
deps += [ "${examples_plat_dir}:efr32-attestation-credentials" ]
}

# Factory Data Provider
if (use_efr32_factory_data_provider) {
deps += [ "${examples_plat_dir}:efr32-factory-data-provider" ]
}

output_dir = root_out_dir
}

Expand Down
Loading

0 comments on commit c84abce

Please sign in to comment.