Skip to content

Commit

Permalink
Provision: GN build.
Browse files Browse the repository at this point in the history
  • Loading branch information
rcasallas-silabs committed Apr 4, 2024
1 parent 5937df0 commit 6ccaf17
Show file tree
Hide file tree
Showing 29 changed files with 420 additions and 712 deletions.
2 changes: 1 addition & 1 deletion build/config/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ config("optimize_zero") {
}

config("optimize_debug") {
cflags = [ "-O${optimize_debug_level}" ]
cflags = [ "-Og" ]
ldflags = cflags
}

Expand Down
2 changes: 1 addition & 1 deletion examples/platform/silabs/MatterConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ class SilabsMatterConfig
{
public:
static CHIP_ERROR InitMatter(const char * appName);
static CHIP_ERROR InitWiFi(void);

private:
static CHIP_ERROR InitOpenThread(void);
static CHIP_ERROR InitWiFi(void);
static void ConnectivityEventCallback(const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t arg);
static void InitOTARequestorHandler(chip::System::Layer * systemLayer, void * appState);
};
20 changes: 17 additions & 3 deletions examples/platform/silabs/provision/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ import("${efr32_sdk_build_root}/silabs_board.gni")

silabs_common_plat_dir = "${chip_root}/examples/platform/silabs"

declare_args() {
silabs_provision_channel = "ble"
}


config("provision-config") {
include_dirs = [ "${chip_root}" ]

defines = [ "CHIP_DEVICE_CONFIG_ENABLE_EXAMPLE_CREDENTIALS=1" ]
if (use_provision_channel) {
if ("" != silabs_provision_channel) {
defines += [ "SL_PROVISION_CHANNEL_ENABLED=1" ]
}
}
Expand Down Expand Up @@ -69,9 +73,14 @@ static_library("provision-efr32") {

sources = [
"${silabs_common_plat_dir}/provision/AttestationKeyPSA.cpp",
"${silabs_common_plat_dir}/provision/ProvisionChannelEFR32BLE.cpp",
"${silabs_common_plat_dir}/provision/ProvisionStorageDefault.cpp",
]
if("ble" == silabs_provision_channel) {
sources += [ "${silabs_common_plat_dir}/provision/ProvisionChannelEFR32BLE.cpp" ]
}
else {
sources += [ "${silabs_common_plat_dir}/provision/ProvisionChannelRTT.cpp" ]
}

public_deps = [ ":provision-common" ]
}
Expand All @@ -81,9 +90,14 @@ static_library("provision-siwx917") {

sources = [
"${silabs_common_plat_dir}/provision/AttestationKeyMbed.cpp",
"${silabs_common_plat_dir}/provision/ProvisionChannelSi917BLE.cpp",
"${silabs_common_plat_dir}/provision/ProvisionStorageDefault.cpp",
]
if("ble" == silabs_provision_channel) {
sources += [ "${silabs_common_plat_dir}/provision/ProvisionChannelSi917BLE.cpp" ]
}
else {
sources += [ "${silabs_common_plat_dir}/provision/ProvisionChannelRTT.cpp" ]
}

public_deps = [ ":provision-common" ]
}
2 changes: 2 additions & 0 deletions examples/platform/silabs/provision/ProvisionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ CHIP_ERROR Manager::Init()
// Disable provision mode for next boot
mStore.SetProvisionRequest(false);
}

ReturnErrorOnFailure(mChannel.Init());
return CHIP_NO_ERROR;
}

Expand Down
1 change: 1 addition & 0 deletions provision/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12.0
5 changes: 3 additions & 2 deletions provision/devices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@ mgm24:
- version: "2.0"
file: "efr32mg24_psa123_nvm3k2.s37"

Si917Commonflash:
si917:
alias: [ siwg917 ]
ram_addr: 0x400
flash_addr: 0x8202000
stack_size: 0x4FC00
firmware:
- version: "1.0"
- version: "1.3"
file: "si917.rps"
- version: "2.0"
file: "si917.rps"
164 changes: 164 additions & 0 deletions provision/generator/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
# 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")
import("//build_overrides/chip.gni")
import("//build_overrides/efr32_sdk.gni")
import("//build_overrides/pigweed.gni")

import("${build_root}/config/defaults.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")

assert(current_os == "freertos")

silabs_project_dir = "${chip_root}/examples/lighting-app/silabs"
examples_common_plat_dir = "${chip_root}/examples/platform/silabs"

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_common_plat_dir}/args.gni")

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

if (slc_generate) {
# Generate Project Specific config (Board, hardware used etc..)
print(exec_script("${chip_root}/third_party/silabs/slc_gen/run_slc.py",
[
rebase_path(chip_root),
"${silabs_board}",
"${disable_lcd}",
"${use_wstk_buttons}",
"${use_wstk_leds}",
"${use_external_flash}",
"${silabs_mcu}",
rebase_path(slc_gen_path),
],
"list lines"))
}

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

include_dirs = [
"${chip_root}/src/platform/silabs/SiWx917",
"${silabs_project_dir}/include",
"${examples_plat_dir}",
"${chip_root}/src/lib",
"${examples_common_plat_dir}",
]

defines = []
}
} else {
efr32_sdk("sdk") {
sources = [
"${examples_common_plat_dir}/FreeRTOSConfig.h",
"${silabs_project_dir}/include/CHIPProjectConfig.h",
]

include_dirs = [
"${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 += [
"${examples_plat_dir}/rs911x",
"${examples_plat_dir}/rs911x/hal",
]
}

defines = []
}
}
silabs_executable("generator") {
output_name = "generator.out"
include_dirs = []
defines = []

if (silabs_board == "BRD2704A") {
defines += [ "SL_STATUS_LED=0" ]
}

sources = [
"main.cpp",
]

deps = [
":sdk",
]

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

ldscript = "${examples_common_plat_dir}/ldscripts/${silabs_family}.ld"

inputs = [ ldscript ]

ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ]

if (chip_print_memory_usage) {
ldflags += [
"-Wl,--print-memory-usage",
"-fstack-usage",
]
}

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

output_dir = root_out_dir
}

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

group("default") {
deps = [ ":silabs" ]
}
65 changes: 0 additions & 65 deletions provision/generator/app.cpp

This file was deleted.

31 changes: 0 additions & 31 deletions provision/generator/app.h

This file was deleted.

28 changes: 28 additions & 0 deletions provision/generator/build_for_wifi_gnfile.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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_enable_wifi = true
import("//wifi.gni")
}
1 change: 1 addition & 0 deletions provision/generator/build_overrides
Loading

0 comments on commit 6ccaf17

Please sign in to comment.