Skip to content

Commit

Permalink
[Silabs] Build Openthread from Gecko SDK sources (#24849)
Browse files Browse the repository at this point in the history
* Use GSDK openthread sources

* fix ot cert libs

* Remove recursive flag for efr32 builds

* bypass case sensitivity

* correct path

* fix ot-efr32 path
  • Loading branch information
mkardous-silabs authored and pull[bot] committed Feb 5, 2024
1 parent 4f9562e commit 2553269
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/examples-efr32.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
attempt_limit: 3
attempt_delay: 2000
- name: Checkout submodules
run: scripts/checkout_submodules.py --shallow --recursive --platform efr32
run: scripts/checkout_submodules.py --shallow --platform efr32

# - name: Out of Tree verification
# run: third_party/silabs/out_of_tree_verification.sh
Expand Down
17 changes: 17 additions & 0 deletions build_overrides/ot_efr32.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (c) 2023 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.

declare_args() {
openthread_efr32_root = "//third_party/silabs/gecko_sdk/protocol/openthread/platform-abstraction/efr32"
}
3 changes: 1 addition & 2 deletions examples/build_overrides/ot_efr32.gni
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@
# limitations under the License.

declare_args() {
openthread_efr32_root =
"//third_party/connectedhomeip/third_party/openthread/ot-efr32"
openthread_efr32_root = "//third_party/connectedhomeip/third_party/silabs/gecko_sdk/protocol/openthread/platform-abstraction/efr32"
}
6 changes: 5 additions & 1 deletion examples/platform/silabs/efr32/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,13 @@ See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
#ifndef configTOTAL_HEAP_SIZE
#ifdef SL_WIFI
#define configTOTAL_HEAP_SIZE ((size_t)(34 * 1024))
#else // SL_WIFI
#if SL_CONFIG_OPENTHREAD_LIB == 1
#define configTOTAL_HEAP_SIZE ((size_t)(22 * 1024))
#else
#define configTOTAL_HEAP_SIZE ((size_t)(20 * 1024))
#endif
#endif // SL_CONFIG_OPENTHREAD_LIB
#endif // configTOTAL_HEAP_SIZE
#endif // configTOTAL_HEAP_SIZE

/* Optional functions - most linkers will remove unused functions anyway. */
Expand Down
5 changes: 5 additions & 0 deletions scripts/examples/gn_efr32_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ else
optArgs+="use_silabs_thread_lib=true chip_openthread_target=$SILABS_THREAD_TARGET openthread_external_platform=\"""\" use_thread_coap_lib=true "
shift
;;
# Option not to be used until ot-efr32 github is updated
# --use_ot_github_sources)
# optArgs+="openthread_root=\"//third_party/connectedhomeip/third_party/openthread/ot-efr32/openthread\" openthread_efr32_root=\"//third_party/connectedhomeip/third_party/openthread/ot-efr32/src/src\""
# shift
# ;;
--no-version)
USE_GIT_SHA_FOR_VERSION=false
shift
Expand Down
4 changes: 3 additions & 1 deletion src/platform/silabs/EFR32/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ chip_build_tests = false
# examples/platform/silabs/efr32/EFR32DeviceDataProvider is now used.
chip_use_transitional_commissionable_data_provider = false

openthread_root = "${chip_root}/third_party/openthread/ot-efr32/openthread"
openthread_root =
"${chip_root}/third_party/silabs/gecko_sdk/util/third_party/openthread"

openthread_core_config_platform_check_file =
"openthread-core-efr32-config-check.h"
openthread_project_core_config_file = "OpenThreadConfig.h"
Expand Down
38 changes: 21 additions & 17 deletions third_party/openthread/platforms/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ import("//build_overrides/chip.gni")
import("//build_overrides/efr32_sdk.gni")
import("//build_overrides/openthread.gni")

import("//build_overrides/openthread.gni")
import("//build_overrides/ot_efr32.gni")

import("${efr32_sdk_build_root}/efr32_sdk.gni")
import("${efr32_sdk_build_root}/silabs_board.gni")

openthread_efr32_root = "${chip_root}/third_party/openthread/ot-efr32"

config("openthread_efr32_config") {
defines = [
"RADIO_CONFIG_DMP_SUPPORT=1",
Expand All @@ -31,15 +32,18 @@ config("openthread_efr32_config") {
include_dirs = [
"${chip_root}/examples/platform/efr32",
"${sdk_support_root}/matter/efr32/${silabs_family}/${silabs_board}",
"${openthread_efr32_root}/src/src",
"${openthread_efr32_root}",
]

# temporarily disable check until gsdk pulls in a more recent version of openthread
cflags = [ "-Wno-format-nonliteral" ]
}

source_set("openthread_core_config_efr32") {
sources = [
"${openthread_efr32_root}/openthread/src/cli/cli_config.h",
"${openthread_efr32_root}/src/src/openthread-core-efr32-config-check.h",
"${openthread_efr32_root}/src/src/openthread-core-efr32-config.h",
"${openthread_efr32_root}/openthread-core-efr32-config-check.h",
"${openthread_efr32_root}/openthread-core-efr32-config.h",
"${openthread_root}/src/cli/cli_config.h",
]

public_deps = [ "${efr32_sdk_build_root}:efr32_sdk" ]
Expand All @@ -49,21 +53,21 @@ source_set("openthread_core_config_efr32") {

source_set("libopenthread-efr32") {
sources = [
"${openthread_efr32_root}/openthread/examples/apps/cli/cli_uart.cpp",
"${openthread_efr32_root}/src/src/alarm.c",
"${openthread_efr32_root}/src/src/crypto.c",
"${openthread_efr32_root}/src/src/entropy.c",
"${openthread_efr32_root}/src/src/flash.c",
"${openthread_efr32_root}/src/src/misc.c",
"${openthread_efr32_root}/src/src/radio.c",
"${openthread_efr32_root}/src/src/security_manager.c",
"${openthread_efr32_root}/src/src/sleep.c",
"${openthread_efr32_root}/src/src/system.c",
"${openthread_efr32_root}/alarm.c",
"${openthread_efr32_root}/crypto.c",
"${openthread_efr32_root}/entropy.c",
"${openthread_efr32_root}/flash.c",
"${openthread_efr32_root}/ieee802154-packet-utils.cpp",
"${openthread_efr32_root}/misc.c",
"${openthread_efr32_root}/radio.c",
"${openthread_efr32_root}/sleep.c",
"${openthread_efr32_root}/system.c",
"${openthread_root}/examples/apps/cli/cli_uart.cpp",
]

public_deps = [
":openthread_core_config_efr32",
"${openthread_efr32_root}/openthread/src/core:libopenthread_core_headers",
"${openthread_root}/src/core:libopenthread_core_headers",
"..:libopenthread-platform",
"..:libopenthread-platform-utils",
]
Expand Down
3 changes: 3 additions & 0 deletions third_party/silabs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,12 @@ group("efr32_sdk") {
public_deps = [ efr32_sdk_target ]
}

# Openthread GSDK libraries configurations
if (use_silabs_thread_lib) {
config("libopenthread-platform_config") {
include_dirs = [ "${sl_openthread_root}/examples/platforms" ]

defines = [ "SL_CONFIG_OPENTHREAD_LIB=1" ]
}

copy("copy_openthread_system") {
Expand Down
2 changes: 2 additions & 0 deletions third_party/silabs/efr32_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ template("efr32_sdk") {
# Treat these includes as system includes, so warnings in them are not fatal.
_include_dirs = [
"${efr32_sdk_root}",
"${efr32_sdk_root}/util/plugin/security_manager/",
"${efr32_sdk_root}/hardware/kit/common/bsp",
"${efr32_sdk_root}/app/common/util/app_assert/",
"${efr32_sdk_root}/hardware/board/inc",
Expand Down Expand Up @@ -544,6 +545,7 @@ template("efr32_sdk") {
"${efr32_sdk_root}/protocol/bluetooth/src/sl_bt_stack_init.c",
"${efr32_sdk_root}/protocol/bluetooth/src/sli_bt_advertiser_config.c",
"${efr32_sdk_root}/protocol/bluetooth/src/sli_bt_connection_config.c",
"${efr32_sdk_root}/util/plugin/security_manager/security_manager.c",
"${efr32_sdk_root}/util/silicon_labs/silabs_core/memory_manager/sl_malloc.c",
"${efr32_sdk_root}/util/third_party/freertos/cmsis/Source/cmsis_os2.c",
"${efr32_sdk_root}/util/third_party/freertos/kernel/croutine.c",
Expand Down

0 comments on commit 2553269

Please sign in to comment.