diff --git a/.github/workflows/examples-efr32.yaml b/.github/workflows/examples-efr32.yaml index 4355dfdcf9a1bd..f9b247af85b5e8 100644 --- a/.github/workflows/examples-efr32.yaml +++ b/.github/workflows/examples-efr32.yaml @@ -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 diff --git a/build_overrides/ot_efr32.gni b/build_overrides/ot_efr32.gni new file mode 100644 index 00000000000000..469c74f34c906a --- /dev/null +++ b/build_overrides/ot_efr32.gni @@ -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" +} diff --git a/examples/build_overrides/ot_efr32.gni b/examples/build_overrides/ot_efr32.gni index d1d64c693b735f..76a68a839eab64 100644 --- a/examples/build_overrides/ot_efr32.gni +++ b/examples/build_overrides/ot_efr32.gni @@ -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" } diff --git a/examples/platform/silabs/efr32/FreeRTOSConfig.h b/examples/platform/silabs/efr32/FreeRTOSConfig.h index 50f4c24ff31679..4c5b6febefb8cf 100644 --- a/examples/platform/silabs/efr32/FreeRTOSConfig.h +++ b/examples/platform/silabs/efr32/FreeRTOSConfig.h @@ -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. */ diff --git a/scripts/examples/gn_efr32_example.sh b/scripts/examples/gn_efr32_example.sh index d577b074539b90..74e44f2adf196f 100755 --- a/scripts/examples/gn_efr32_example.sh +++ b/scripts/examples/gn_efr32_example.sh @@ -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 diff --git a/src/platform/silabs/EFR32/args.gni b/src/platform/silabs/EFR32/args.gni index f09ace86c2b620..abe0aa1870c7c4 100644 --- a/src/platform/silabs/EFR32/args.gni +++ b/src/platform/silabs/EFR32/args.gni @@ -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" diff --git a/third_party/openthread/platforms/efr32/BUILD.gn b/third_party/openthread/platforms/efr32/BUILD.gn index 89546a7f7daf1f..0a48e7c45b22b5 100644 --- a/third_party/openthread/platforms/efr32/BUILD.gn +++ b/third_party/openthread/platforms/efr32/BUILD.gn @@ -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", @@ -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" ] @@ -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", ] diff --git a/third_party/silabs/BUILD.gn b/third_party/silabs/BUILD.gn index 49cd0df756adf2..1d931656eac707 100644 --- a/third_party/silabs/BUILD.gn +++ b/third_party/silabs/BUILD.gn @@ -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") { diff --git a/third_party/silabs/efr32_sdk.gni b/third_party/silabs/efr32_sdk.gni index 99cbca17994d9f..ac2737f8fee378 100644 --- a/third_party/silabs/efr32_sdk.gni +++ b/third_party/silabs/efr32_sdk.gni @@ -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", @@ -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",