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

[Silabs] Silabs Refactor build system for 917 #26633

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
8 changes: 4 additions & 4 deletions .github/workflows/examples-efr32.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ jobs:
run: |
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
efr32 BRD4187C lighting-app \
out/efr32-brd4187c-light-rpc/chip-efr32-lighting-example.out \
out/efr32-brd4187c-light-rpc/matter-silabs-lighting-example.out \
/tmp/bloat_reports/
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
efr32 BRD4187C window-app \
out/efr32-brd4187c-window-covering-additional_data_advertising/chip-efr32-window-example.out \
out/efr32-brd4187c-window-covering-additional_data_advertising/matter-silabs-window-example.out \
/tmp/bloat_reports/
- name: Clean out build output
run: rm -rf ./out
Expand All @@ -122,15 +122,15 @@ jobs:
run: |
scripts/examples/gn_efr32_example.sh examples/lock-app/silabs/efr32/ out/lock_app_wifi_wf200 BRD4161A is_debug=false chip_logging=false --wifi wf200 --docker
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py efr32 BRD4161A+wf200 lock-app \
out/lock_app_wifi_wf200/BRD4161A/chip-efr32-lock-example.out /tmp/bloat_reports/
out/lock_app_wifi_wf200/BRD4161A/matter-silabs-lock-example.out /tmp/bloat_reports/
- name: Clean out build output
run: rm -rf ./out
- name: Build example EFR32+RS9116 WiFi Lighting app for BRD4161A
timeout-minutes: 15
run: |
scripts/examples/gn_efr32_example.sh examples/lighting-app/silabs/efr32/ out/lighting_app_wifi_rs9116 BRD4161A --wifi rs9116 --docker
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py efr32 BRD4161A+rs9116 lighting-app \
out/lighting_app_wifi_rs9116/BRD4161A/chip-efr32-lighting-example.out /tmp/bloat_reports/
out/lighting_app_wifi_rs9116/BRD4161A/matter-silabs-lighting-example.out /tmp/bloat_reports/
- name: Clean out build output
run: rm -rf ./out
- name: Uploading Size Reports
Expand Down
2 changes: 1 addition & 1 deletion examples/chef/chef.py
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ def main() -> int:
elif (options.build_target == "silabs-thread") or (options.build_target == "silabs-wifi"):
shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}/efr32")
shell.run_cmd(
f"python3 out/{options.sample_device_type_name}/{silabs_board}/chip-efr32-chef-example.flash.py")
f"python3 out/{options.sample_device_type_name}/{silabs_board}/matter-silabs-chef-example.flash.py")

shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}")
elif (options.build_target == "ameba"):
Expand Down
2 changes: 1 addition & 1 deletion examples/chef/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ efr32_sdk("sdk") {
}

silabs_executable("chef_app") {
output_name = "chip-efr32-chef-example.out"
output_name = "matter-silabs-chef-example.out"
include_dirs = [ "include" ]
defines = []

Expand Down
2 changes: 1 addition & 1 deletion examples/chef/efr32/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import("//build_overrides/chip.gni")
import("${chip_root}/config/standalone/args.gni")
import("${chip_root}/src/platform/efr32/args.gni")

efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain")
silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain")

chip_enable_ota_requestor = true
chip_enable_openthread = true
Expand Down
4 changes: 2 additions & 2 deletions examples/chef/efr32/build_for_wifi_args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# limitations under the License.
import("//build_overrides/chip.gni")

efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain")
silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain")
chip_enable_openthread = false
import("${chip_root}/src/platform/efr32/wifi_args.gni")
import("${chip_root}/src/platform/silabs/wifi_args.gni")

chip_enable_ota_requestor = true
2 changes: 1 addition & 1 deletion examples/chef/efr32/with_pw_rpc.gni
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import("//build_overrides/chip.gni")
import("${chip_root}/config/efr32/lib/pw_rpc/pw_rpc.gni")
import("${chip_root}/examples/platform/efr32/args.gni")

efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain")
silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain")

chip_enable_pw_rpc = true
chip_enable_openthread = true
Expand Down
4 changes: 2 additions & 2 deletions examples/light-switch-app/silabs/SiWx917/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

import("//build_overrides/chip.gni")
import("${chip_root}/config/standalone/args.gni")
import("${chip_root}/src/platform/silabs/SiWx917/args.gni")
import("${chip_root}/src/platform/silabs/args.gni")

siwx917_sdk_target = get_label_info(":sdk", "label_no_toolchain")
silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain")

app_data_model = "${chip_root}/examples/light-switch-app/light-switch-common"
chip_enable_ota_requestor = true
2 changes: 1 addition & 1 deletion examples/light-switch-app/silabs/efr32/.gn
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ default_args = {
target_os = "freertos"
chip_openthread_ftd = true

import("//args.gni")
import("//openthread.gni")
}
124 changes: 83 additions & 41 deletions examples/light-switch-app/silabs/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ import("//build_overrides/efr32_sdk.gni")
import("//build_overrides/pigweed.gni")

import("${build_root}/config/defaults.gni")
import("${efr32_sdk_build_root}/efr32_sdk.gni")
import("${efr32_sdk_build_root}/silabs_executable.gni")

import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/platform/device.gni")
import("${chip_root}/third_party/silabs/silabs_board.gni")

if (chip_enable_pw_rpc) {
import("//build_overrides/pigweed.gni")
Expand All @@ -31,61 +31,93 @@ if (chip_enable_pw_rpc) {

assert(current_os == "freertos")

efr32_project_dir = "${chip_root}/examples/light-switch-app/silabs/efr32"
examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
silabs_project_dir = "${chip_root}/examples/light-switch-app/silabs/efr32"
examples_common_plat_dir = "${chip_root}/examples/platform/silabs"
if (chip_enable_ble_rs911x) {
src_plat_dir = "${chip_root}/src/platform/silabs/efr32"

if (wifi_soc) {
import("${chip_root}/third_party/silabs/SiWx917_sdk.gni")
examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917"
} else {
import("${efr32_sdk_build_root}/efr32_sdk.gni")
examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
}

import("${examples_plat_dir}/args.gni")
import("${examples_common_plat_dir}/args.gni")

declare_args() {
# Dump memory usage at link time.
chip_print_memory_usage = false
}

efr32_sdk("sdk") {
sources = [
"${efr32_project_dir}/include/CHIPProjectConfig.h",
"${examples_plat_dir}/FreeRTOSConfig.h",
]
if (wifi_soc) {
siwx917_sdk("sdk") {
sources = [
"${examples_plat_dir}/FreeRTOSConfig.h",
"${silabs_project_dir}/include/CHIPProjectConfig.h",
]

include_dirs = [
"${chip_root}/examples/light-switch-app/silabs/common",
"${chip_root}/src/platform/silabs/efr32",
"${efr32_project_dir}/include",
"${examples_plat_dir}",
"${chip_root}/src/lib",
"${examples_common_plat_dir}",
]
include_dirs = [
"${chip_root}/src/platform/silabs/SiWx917",
"${silabs_project_dir}/include",
"${examples_plat_dir}",
"${chip_root}/src/lib",
"${examples_common_plat_dir}",
]

if (use_wf200) {
# TODO efr32_sdk should not need a header from this location
include_dirs += [ "${examples_plat_dir}/wf200" ]
defines = []
if (chip_enable_pw_rpc) {
defines += [
"HAL_VCOM_ENABLE=1",
"PW_RPC_ENABLED",
]
}
}

if (chip_enable_ble_rs911x) {
# TODO efr32_sdk should not need a header from this location
include_dirs += [
"${src_plat_dir}/rs911x",
"${examples_plat_dir}/rs911x",
"${examples_plat_dir}/rs911x/hal",
} else {
efr32_sdk("sdk") {
sources = [
"${examples_plat_dir}/FreeRTOSConfig.h",
"${silabs_project_dir}/include/CHIPProjectConfig.h",
]
}

defines = []
if (chip_enable_pw_rpc) {
defines += [
"HAL_VCOM_ENABLE=1",
"PW_RPC_ENABLED",
include_dirs = [
"${chip_root}/examples/light-switch-app/silabs/common",
"${chip_root}/src/platform/silabs/efr32",
"${silabs_project_dir}/include",
"${examples_plat_dir}",
"${chip_root}/src/lib",
"${examples_common_plat_dir}",
]

if (use_wf200) {
# TODO efr32_sdk should not need a header from this location
include_dirs += [ "${examples_plat_dir}/wf200" ]
}

if (chip_enable_ble_rs911x) {
# TODO efr32_sdk should not need a header from this location
include_dirs += [
"${chip_root}/src/platform/silabs/efr32/rs911x",
"${examples_plat_dir}/rs911x",
"${examples_plat_dir}/rs911x/hal",
]
}

defines = []
if (chip_enable_pw_rpc) {
defines += [
"HAL_VCOM_ENABLE=1",
"PW_RPC_ENABLED",
]
}
}
}

silabs_executable("light_switch_app") {
output_name = "chip-efr32-light-switch-example.out"
include_dirs = [ "include" ]
output_name = "matter-silabs-light-switch-example.out"
include_dirs = [
"include",
"${chip_root}/examples/light-switch-app/silabs/common/",
]
defines = []

sources = [
Expand All @@ -98,10 +130,15 @@ silabs_executable("light_switch_app") {

deps = [
":sdk",
"${examples_plat_dir}:efr32-common",
app_data_model,
]

if (wifi_soc) {
deps += [ "${examples_plat_dir}:siwx917-common" ]
} else {
deps += [ "${examples_plat_dir}:efr32-common" ]
}

if (chip_build_libshell) {
sources += [
"${chip_root}/examples/light-switch-app/silabs/common/ShellCommands.cpp",
Expand Down Expand Up @@ -134,9 +171,14 @@ silabs_executable("light_switch_app") {
"${chip_root}/examples/common/pigweed:descriptor_service.nanopb_rpc",
"${chip_root}/examples/common/pigweed:device_service.nanopb_rpc",
"${chip_root}/examples/common/pigweed:lighting_service.nanopb_rpc",
"${examples_plat_dir}/pw_sys_io:pw_sys_io_efr32",
]

if (wifi_soc) {
deps += [ "${examples_plat_dir}/pw_sys_io:pw_sys_io_siwx917" ]
} else {
deps += [ "${examples_plat_dir}/pw_sys_io:pw_sys_io_efr32" ]
}

deps += pw_build_LINK_DEPS

include_dirs += [
Expand Down Expand Up @@ -169,10 +211,10 @@ silabs_executable("light_switch_app") {
output_dir = root_out_dir
}

group("efr32") {
group("silabs") {
deps = [ ":light_switch_app" ]
}

group("default") {
deps = [ ":efr32" ]
deps = [ ":silabs" ]
}
2 changes: 1 addition & 1 deletion examples/light-switch-app/silabs/efr32/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ arguments
- On the command line:

$ cd ~/connectedhomeip/examples/light-switch-app/silabs/efr32
$ python3 out/debug/chip-efr32-light-switch-example.flash.py
$ python3 out/debug/matter-silabs-light-switch-example.flash.py

- Or with the Ozone debugger, just load the .out file.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
import("//build_overrides/chip.gni")
import("${chip_root}/config/standalone/args.gni")

efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain")
silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain")
chip_enable_openthread = false
import("${chip_root}/src/platform/silabs/efr32/wifi_args.gni")
import("${chip_root}/src/platform/silabs/wifi_args.gni")

chip_enable_ota_requestor = true
app_data_model = "${chip_root}/examples/light-switch-app/light-switch-common"
29 changes: 29 additions & 0 deletions examples/light-switch-app/silabs/efr32/openthread.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright (c) 2020 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("//build_overrides/build.gni")

# The location of the build configuration file.
buildconfig = "${build_root}/config/BUILDCONFIG.gn"

# CHIP uses angle bracket includes.
check_system_includes = true

default_args = {
target_cpu = "arm"
target_os = "freertos"
chip_openthread_ftd = true

import("//openthread.gni")
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ import("//build_overrides/chip.gni")
import("${chip_root}/config/standalone/args.gni")
import("${chip_root}/src/platform/silabs/efr32/args.gni")

efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain")
silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain")

app_data_model = "${chip_root}/examples/light-switch-app/light-switch-common"
chip_enable_ota_requestor = true
chip_enable_openthread = true

openthread_external_platform =
"${chip_root}/third_party/openthread/platforms/efr32:libopenthread-efr32"
4 changes: 2 additions & 2 deletions examples/lighting-app/silabs/SiWx917/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import("//build_overrides/chip.gni")
import("${chip_root}/config/standalone/args.gni")

siwx917_sdk_target = get_label_info(":sdk", "label_no_toolchain")
import("${chip_root}/src/platform/silabs/SiWx917/args.gni")
silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain")
import("${chip_root}/src/platform/silabs/args.gni")

app_data_model = "${chip_root}/examples/lighting-app/silabs/SiWx917/data_model:silabs-lighting"
chip_enable_ota_requestor = true
2 changes: 1 addition & 1 deletion examples/lighting-app/silabs/SiWx917/with_pw_rpc.gni
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import("//build_overrides/chip.gni")
import("${chip_root}/config/efr32/lib/pw_rpc/pw_rpc.gni")
import("${chip_root}/examples/platform/silabs/SiWx917/args.gni")

siwx917_sdk_target = get_label_info(":sdk", "label_no_toolchain")
silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain")

app_data_model = "${chip_root}/examples/lighting-app/lighting-common"
chip_enable_pw_rpc = true
Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/silabs/efr32/.gn
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ default_args = {
target_os = "freertos"
chip_openthread_ftd = true

import("//args.gni")
import("//openthread.gni")
}
Loading