From 8297269d20a37a53219f3d238040adf61b8abe9e Mon Sep 17 00:00:00 2001 From: Junior Martinez <67972863+jmartinez-silabs@users.noreply.github.com> Date: Wed, 7 Dec 2022 21:29:05 -0500 Subject: [PATCH] [Silabs] Format the sw version string with some git repo info (#23877) * Script to format a version string based on the git repo state. set CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING * Rework for the versioning. Format the command at pre-compile time (in scripts) pass it in a gn arg and set to a define * Restyle and add some description for the new parameters * address last comments * fix efr32-brd4161a-light-rpc build/test.py dry run test by using -no-version as using the git formatted version will change for every commit --- examples/light-switch-app/efr32/BUILD.gn | 1 + .../efr32/include/CHIPProjectConfig.h | 11 -------- examples/lighting-app/silabs/SiWx917/BUILD.gn | 1 + examples/lighting-app/silabs/efr32/BUILD.gn | 1 + .../silabs/efr32/include/CHIPProjectConfig.h | 11 -------- examples/lock-app/efr32/BUILD.gn | 1 + .../efr32/include/CHIPProjectConfig.h | 11 -------- .../efr32/include/CHIPProjectConfig.h | 10 ------- .../efr32/include/CHIPProjectConfig.h | 11 -------- .../shell/efr32/include/CHIPProjectConfig.h | 11 -------- examples/thermostat/efr32/BUILD.gn | 1 + .../efr32/include/CHIPProjectConfig.h | 11 -------- examples/window-app/efr32/BUILD.gn | 1 + .../efr32/include/CHIPProjectConfig.h | 11 -------- scripts/build/BUILD.gn | 2 +- scripts/build/build/targets.py | 1 + scripts/build/builders/efr32.py | 10 ++++++- scripts/build/test.py | 2 +- .../build/testdata/all_targets_linux_x64.txt | 2 +- ...n_efr32-brd4161a-light-rpc-no-version.txt} | 8 +++--- scripts/examples/gn_efr32_example.sh | 26 ++++++++++++++++--- src/include/platform/CHIPDeviceConfig.h | 2 +- .../silabs/CHIPDevicePlatformConfig.h | 9 +++++++ .../efr32/include/CHIPProjectConfig.h | 10 ------- third_party/silabs/BUILD.gn | 7 +++++ third_party/silabs/SiWx917_sdk.gni | 16 +++++++++++- 26 files changed, 78 insertions(+), 110 deletions(-) rename scripts/build/testdata/{dry_run_efr32-brd4161a-light-rpc.txt => dry_run_efr32-brd4161a-light-rpc-no-version.txt} (57%) diff --git a/examples/light-switch-app/efr32/BUILD.gn b/examples/light-switch-app/efr32/BUILD.gn index 83704a8fa6cc1b..5c03b769dc964c 100644 --- a/examples/light-switch-app/efr32/BUILD.gn +++ b/examples/light-switch-app/efr32/BUILD.gn @@ -181,6 +181,7 @@ efr32_sdk("sdk") { efr32_executable("light_switch_app") { output_name = "chip-efr32-light-switch-example.out" + public_configs = [ "${efr32_sdk_build_root}:silabs_config" ] include_dirs = [ "include" ] defines = [] diff --git a/examples/light-switch-app/efr32/include/CHIPProjectConfig.h b/examples/light-switch-app/efr32/include/CHIPProjectConfig.h index 94c82dcbb0281d..1b74c802fd4f09 100644 --- a/examples/light-switch-app/efr32/include/CHIPProjectConfig.h +++ b/examples/light-switch-app/efr32/include/CHIPProjectConfig.h @@ -69,17 +69,6 @@ */ #define CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION 1 -/** - * CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING - * - * A string identifying the software version running on the device. - * CHIP service currently expects the software version to be in the format - * {MAJOR_VERSION}.0d{MINOR_VERSION} - */ -#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING -#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "0.1ALPHA" -#endif - /** * CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION * diff --git a/examples/lighting-app/silabs/SiWx917/BUILD.gn b/examples/lighting-app/silabs/SiWx917/BUILD.gn index 61f849a88854f5..dbedc37a233b5c 100644 --- a/examples/lighting-app/silabs/SiWx917/BUILD.gn +++ b/examples/lighting-app/silabs/SiWx917/BUILD.gn @@ -201,6 +201,7 @@ efr32_sdk("sdk") { efr32_executable("lighting_app") { output_name = "chip-efr32-lighting-example.out" + public_configs = [ "${efr32_sdk_build_root}:silabs_config" ] include_dirs = [ "include" ] defines = [] diff --git a/examples/lighting-app/silabs/efr32/BUILD.gn b/examples/lighting-app/silabs/efr32/BUILD.gn index 3a812b966d3361..d2f68f8b44541e 100644 --- a/examples/lighting-app/silabs/efr32/BUILD.gn +++ b/examples/lighting-app/silabs/efr32/BUILD.gn @@ -190,6 +190,7 @@ efr32_sdk("sdk") { efr32_executable("lighting_app") { output_name = "chip-efr32-lighting-example.out" + public_configs = [ "${efr32_sdk_build_root}:silabs_config" ] include_dirs = [ "include" ] defines = [] diff --git a/examples/lighting-app/silabs/efr32/include/CHIPProjectConfig.h b/examples/lighting-app/silabs/efr32/include/CHIPProjectConfig.h index 4b3d8f571c9057..1d3fefcce8232e 100644 --- a/examples/lighting-app/silabs/efr32/include/CHIPProjectConfig.h +++ b/examples/lighting-app/silabs/efr32/include/CHIPProjectConfig.h @@ -69,17 +69,6 @@ */ #define CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION 1 -/** - * CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING - * - * A string identifying the software version running on the device. - * CHIP service currently expects the software version to be in the format - * {MAJOR_VERSION}.0d{MINOR_VERSION} - */ -#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING -#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "0.1ALPHA" -#endif - /** * CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION * diff --git a/examples/lock-app/efr32/BUILD.gn b/examples/lock-app/efr32/BUILD.gn index 8e22a6add4864e..88983a2f058284 100644 --- a/examples/lock-app/efr32/BUILD.gn +++ b/examples/lock-app/efr32/BUILD.gn @@ -180,6 +180,7 @@ efr32_sdk("sdk") { efr32_executable("lock_app") { output_name = "chip-efr32-lock-example.out" + public_configs = [ "${efr32_sdk_build_root}:silabs_config" ] include_dirs = [ "include" ] defines = [] diff --git a/examples/lock-app/efr32/include/CHIPProjectConfig.h b/examples/lock-app/efr32/include/CHIPProjectConfig.h index 6e8342dc0f7a99..9793e98ac9bc0a 100644 --- a/examples/lock-app/efr32/include/CHIPProjectConfig.h +++ b/examples/lock-app/efr32/include/CHIPProjectConfig.h @@ -70,17 +70,6 @@ */ #define CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION 1 -/** - * CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING - * - * A string identifying the software version running on the device. - * CHIP service currently expects the software version to be in the format - * {MAJOR_VERSION}.0d{MINOR_VERSION} - */ -#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING -#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "0.1ALPHA" -#endif - /** * CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION * diff --git a/examples/persistent-storage/efr32/include/CHIPProjectConfig.h b/examples/persistent-storage/efr32/include/CHIPProjectConfig.h index 4502afd537724f..24733d37871d5b 100644 --- a/examples/persistent-storage/efr32/include/CHIPProjectConfig.h +++ b/examples/persistent-storage/efr32/include/CHIPProjectConfig.h @@ -64,16 +64,6 @@ */ #define CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION 1 -/** - * CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING - * - * A string identifying the software version running on the device. - * CHIP service currently expects the software version to be in the format - * {MAJOR_VERSION}.0d{MINOR_VERSION} - */ -#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING -#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "0.1ALPHA" -#endif /** * CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE * diff --git a/examples/pigweed-app/efr32/include/CHIPProjectConfig.h b/examples/pigweed-app/efr32/include/CHIPProjectConfig.h index 9c6a21703649ac..6af96beac88f4a 100644 --- a/examples/pigweed-app/efr32/include/CHIPProjectConfig.h +++ b/examples/pigweed-app/efr32/include/CHIPProjectConfig.h @@ -63,17 +63,6 @@ */ #define CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION 1 -/** - * CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING - * - * A string identifying the software version running on the device. - * CHIP service currently expects the software version to be in the format - * {MAJOR_VERSION}.0d{MINOR_VERSION} - */ -#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING -#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "0.1ALPHA" -#endif - /** * CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION * diff --git a/examples/shell/efr32/include/CHIPProjectConfig.h b/examples/shell/efr32/include/CHIPProjectConfig.h index bd5c6355cae55a..72a56579663289 100644 --- a/examples/shell/efr32/include/CHIPProjectConfig.h +++ b/examples/shell/efr32/include/CHIPProjectConfig.h @@ -66,17 +66,6 @@ */ #define CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION 1 -/** - * CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING - * - * A string identifying the software version running on the device. - * CHIP service currently expects the software version to be in the format - * {MAJOR_VERSION}.0d{MINOR_VERSION} - */ -#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING -#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "0.1ALPHA" -#endif - /** * CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION * diff --git a/examples/thermostat/efr32/BUILD.gn b/examples/thermostat/efr32/BUILD.gn index 1e5deb78ef4f10..2322a2ae887ded 100644 --- a/examples/thermostat/efr32/BUILD.gn +++ b/examples/thermostat/efr32/BUILD.gn @@ -194,6 +194,7 @@ efr32_sdk("sdk") { efr32_executable("thermostat_app") { output_name = "chip-efr32-thermostat-example.out" + public_configs = [ "${efr32_sdk_build_root}:silabs_config" ] include_dirs = [ "include" ] defines = [] diff --git a/examples/thermostat/efr32/include/CHIPProjectConfig.h b/examples/thermostat/efr32/include/CHIPProjectConfig.h index 35f6d54e785c70..526cede60faa2a 100644 --- a/examples/thermostat/efr32/include/CHIPProjectConfig.h +++ b/examples/thermostat/efr32/include/CHIPProjectConfig.h @@ -69,17 +69,6 @@ */ #define CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION 1 -/** - * CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING - * - * A string identifying the software version running on the device. - * CHIP service currently expects the software version to be in the format - * {MAJOR_VERSION}.0d{MINOR_VERSION} - */ -#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING -#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "0.1ALPHA" -#endif - /** * CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION * diff --git a/examples/window-app/efr32/BUILD.gn b/examples/window-app/efr32/BUILD.gn index 142a4dc84146ab..93119f1b263aae 100644 --- a/examples/window-app/efr32/BUILD.gn +++ b/examples/window-app/efr32/BUILD.gn @@ -173,6 +173,7 @@ efr32_sdk("sdk") { efr32_executable("window_app") { output_name = "chip-efr32-window-example.out" + public_configs = [ "${efr32_sdk_build_root}:silabs_config" ] output_dir = root_out_dir include_dirs = [ "include", diff --git a/examples/window-app/efr32/include/CHIPProjectConfig.h b/examples/window-app/efr32/include/CHIPProjectConfig.h index 23c653c12b396e..6a12dbc3794c8f 100644 --- a/examples/window-app/efr32/include/CHIPProjectConfig.h +++ b/examples/window-app/efr32/include/CHIPProjectConfig.h @@ -68,17 +68,6 @@ */ #define CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION 1 -/** - * CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING - * - * A string identifying the software version running on the device. - * CHIP service currently expects the software version to be in the format - * {MAJOR_VERSION}.0d{MINOR_VERSION} - */ -#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING -#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "0.1ALPHA" -#endif - /** * CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION * diff --git a/scripts/build/BUILD.gn b/scripts/build/BUILD.gn index 39580c63f86341..b19ffcd8d78a7f 100644 --- a/scripts/build/BUILD.gn +++ b/scripts/build/BUILD.gn @@ -24,7 +24,7 @@ pw_python_package("build_examples") { # Dependency for the unit test "testdata/all_targets_linux_x64.txt", "testdata/dry_run_android-arm64-chip-tool.txt", - "testdata/dry_run_efr32-brd4161a-light-rpc.txt", + "testdata/dry_run_efr32-brd4161a-light-rpc-no-version.txt", "testdata/dry_run_esp32-devkitc-light-rpc.txt", "testdata/dry_run_esp32-m5stack-all-clusters-minimal-rpc-ipv6only.txt", "testdata/dry_run_linux-arm64-chip-tool-ipv6only-clang.txt", diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py index 68dc45f69e813a..a7d024b643ad8a 100755 --- a/scripts/build/build/targets.py +++ b/scripts/build/build/targets.py @@ -223,6 +223,7 @@ def BuildEfr32Target(): target.AppendModifier('additional_data_advertising', enable_additional_data_advertising=True) target.AppendModifier('use_ot_lib', enable_ot_lib=True).ExceptIfRe('-(wifi|use_ot_coap_lib)') target.AppendModifier('use_ot_coap_lib', enable_ot_coap_lib=True).ExceptIfRe('-(wifi|use_ot_lib)') + target.AppendModifier('no-version', no_version=True) return target diff --git a/scripts/build/builders/efr32.py b/scripts/build/builders/efr32.py index ba807439ed1492..cd99b7a29eab1a 100644 --- a/scripts/build/builders/efr32.py +++ b/scripts/build/builders/efr32.py @@ -15,6 +15,7 @@ import os from enum import Enum, auto import shlex +import subprocess from .gn import GnBuilder @@ -132,7 +133,8 @@ def __init__(self, enable_wifi_ipv4: bool = False, enable_additional_data_advertising: bool = False, enable_ot_lib: bool = False, - enable_ot_coap_lib: bool = False + enable_ot_coap_lib: bool = False, + no_version: bool = False ): super(Efr32Builder, self).__init__( root=app.BuildRoot(root), @@ -200,6 +202,12 @@ def __init__(self, self.extra_gn_options.append( 'use_silabs_thread_lib=true chip_openthread_target="../silabs:ot-efr32-cert" use_thread_coap_lib=true openthread_external_platform=""') + if not no_version: + shortCommitSha = subprocess.check_output(['git', 'describe', '--always', '--dirty']).decode('ascii').strip() + branchName = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD']).decode('ascii').strip() + self.extra_gn_options.append( + 'sl_matter_version_str="v1.0-%s-%s"' % (branchName, shortCommitSha)) + def GnBuildArgs(self): return self.extra_gn_options diff --git a/scripts/build/test.py b/scripts/build/test.py index 85f66535c49106..8cf88b0571c44e 100644 --- a/scripts/build/test.py +++ b/scripts/build/test.py @@ -107,7 +107,7 @@ def test_general_dry_runs(self): 'esp32-m5stack-all-clusters-minimal-rpc-ipv6only', 'android-arm64-chip-tool', 'nrf-nrf52840dk-pump', - 'efr32-brd4161a-light-rpc', + 'efr32-brd4161a-light-rpc-no-version', 'openiotsdk-lock', 'openiotsdk-shell' ] diff --git a/scripts/build/testdata/all_targets_linux_x64.txt b/scripts/build/testdata/all_targets_linux_x64.txt index a5ca0ac89564e7..3bce2a8dd07b14 100644 --- a/scripts/build/testdata/all_targets_linux_x64.txt +++ b/scripts/build/testdata/all_targets_linux_x64.txt @@ -3,7 +3,7 @@ android-{arm,arm64,x86,x64,androidstudio-arm,androidstudio-arm64,androidstudio-x bouffalolab-{bl602-iot-matter-v1,bl602-iot-dvk-3s,bl602-night-light,xt-zb6-devkit,bl706-iot-dvk,bl706-night-light}-light[-shell][-115200][-rpc] cc13x2x7_26x2x7-{all-clusters,all-clusters-minimal,lock,pump,pump-controller,shell}[-ftd][-mtd] cyw30739-cyw930739m2evb_01-{light,lock,ota-requestor}[-no-progress-logging] -efr32-{brd4161a,brd4187c,brd4163a,brd4164a,brd4166a,brd4170a,brd4186a,brd4187a,brd4304a}-{window-covering,switch,unit-test,light,lock}[-rpc][-with-ota-requestor][-sed][-low-power][-shell][-no_logging][-openthread_mtd][-enable_heap_monitoring][-no_openthread_cli][-show_qr_code][-wifi][-rs911x][-wf200][-wifi_ipv4][-additional_data_advertising][-use_ot_lib][-use_ot_coap_lib] +efr32-{brd4161a,brd4187c,brd4163a,brd4164a,brd4166a,brd4170a,brd4186a,brd4187a,brd4304a}-{window-covering,switch,unit-test,light,lock}[-rpc][-with-ota-requestor][-sed][-low-power][-shell][-no_logging][-openthread_mtd][-enable_heap_monitoring][-no_openthread_cli][-show_qr_code][-wifi][-rs911x][-wf200][-wifi_ipv4][-additional_data_advertising][-use_ot_lib][-use_ot_coap_lib][-no-version] esp32-{m5stack,c3devkit,devkitc,qemu}-{all-clusters,all-clusters-minimal,ota-provider,ota-requestor,shell,light,lock,bridge,temperature-measurement,ota-requestor,tests}[-rpc][-ipv6only] genio-lighting-app linux-fake-tests[-mbedtls][-boringssl][-asan][-tsan][-libfuzzer][-coverage][-dmalloc][-clang] diff --git a/scripts/build/testdata/dry_run_efr32-brd4161a-light-rpc.txt b/scripts/build/testdata/dry_run_efr32-brd4161a-light-rpc-no-version.txt similarity index 57% rename from scripts/build/testdata/dry_run_efr32-brd4161a-light-rpc.txt rename to scripts/build/testdata/dry_run_efr32-brd4161a-light-rpc-no-version.txt index 4a241682b02f49..d48088b2048379 100644 --- a/scripts/build/testdata/dry_run_efr32-brd4161a-light-rpc.txt +++ b/scripts/build/testdata/dry_run_efr32-brd4161a-light-rpc-no-version.txt @@ -1,8 +1,8 @@ # Commands will be run in CHIP project root. cd "{root}" -# Generating efr32-brd4161a-light-rpc -gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/silabs/efr32 '--args=silabs_board="BRD4161A" is_debug=false import("//with_pw_rpc.gni")' {out}/efr32-brd4161a-light-rpc +# Generating efr32-brd4161a-light-rpc-no-version +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/silabs/efr32 '--args=silabs_board="BRD4161A" is_debug=false import("//with_pw_rpc.gni")' {out}/efr32-brd4161a-light-rpc-no-version -# Building efr32-brd4161a-light-rpc -ninja -C {out}/efr32-brd4161a-light-rpc +# Building efr32-brd4161a-light-rpc-no-version +ninja -C {out}/efr32-brd4161a-light-rpc-no-version diff --git a/scripts/examples/gn_efr32_example.sh b/scripts/examples/gn_efr32_example.sh index 2062c079ac391c..d577b074539b90 100755 --- a/scripts/examples/gn_efr32_example.sh +++ b/scripts/examples/gn_efr32_example.sh @@ -16,7 +16,7 @@ # limitations under the License. # -# Build script for GN EFT32 examples GitHub workflow. +# Build script for GN EFR32 examples GitHub workflow. set -e @@ -33,6 +33,7 @@ source "$CHIP_ROOT/scripts/activate.sh" set -x env USE_WIFI=false +USE_GIT_SHA_FOR_VERSION=true SILABS_THREAD_TARGET=\""../silabs:ot-efr32-cert"\" USAGE="./scripts/examples/gn_efr32_example.sh []" @@ -81,6 +82,10 @@ if [ "$#" == "0" ]; then enable_sleepy_device Enable Sleepy end device. (Default false) Must also set chip_openthread_ftd=false + sl_matter_version_str + Set a Matter sotfware version string for the Silabs examples + Used and formatted by default in this script. + To skip that formatting or use your own version string use --no-version use_rs911x Build wifi example with extension board rs911x. (Default false) use_wf200 @@ -104,6 +109,9 @@ if [ "$#" == "0" ]; then enable Addition data advertissing and rotating device ID --use_ot_lib use the silabs openthread library + --no-version + Skip the silabs formating for the Matter software version string + Currently : v1.0-- " elif [ "$#" -lt "2" ]; then echo "Invalid number of arguments @@ -128,9 +136,9 @@ else exit 1 fi if [ "$2" = "rs911x" ]; then - optArgs+="use_rs911x=true" + optArgs+="use_rs911x=true " elif [ "$2" = "wf200" ]; then - optArgs+="use_wf200=true" + optArgs+="use_wf200=true " else echo "Wifi usage: --wifi rs911x|wf200" exit 1 @@ -163,6 +171,10 @@ else optArgs+="use_silabs_thread_lib=true chip_openthread_target=$SILABS_THREAD_TARGET openthread_external_platform=\"""\" use_thread_coap_lib=true " shift ;; + --no-version) + USE_GIT_SHA_FOR_VERSION=false + shift + ;; *) if [ "$1" =~ *"use_rs911x=true"* ] || [ "$1" =~ *"use_wf200=true"* ]; then USE_WIFI=true @@ -179,6 +191,14 @@ else exit 1 fi + if [ "$USE_GIT_SHA_FOR_VERSION" == true ]; then + { + ShortCommitSha=$(git describe --always --dirty) + branchName=$(git rev-parse --abbrev-ref HEAD) + optArgs+="sl_matter_version_str=\"v1.0-$branchName-$ShortCommitSha\" " + } &>/dev/null + fi + BUILD_DIR=$OUTDIR/$SILABS_BOARD echo BUILD_DIR="$BUILD_DIR" if [ "$USE_WIFI" == true ]; then diff --git a/src/include/platform/CHIPDeviceConfig.h b/src/include/platform/CHIPDeviceConfig.h index 5dfc6fcf9ba258..05065105d207f4 100644 --- a/src/include/platform/CHIPDeviceConfig.h +++ b/src/include/platform/CHIPDeviceConfig.h @@ -200,7 +200,7 @@ * A string identifying the software version running on the device. */ #ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING -#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "prerelease" +#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "1.0" #endif /** diff --git a/src/platform/silabs/CHIPDevicePlatformConfig.h b/src/platform/silabs/CHIPDevicePlatformConfig.h index 4852dc97c63cb6..30cfcf437f5b13 100644 --- a/src/platform/silabs/CHIPDevicePlatformConfig.h +++ b/src/platform/silabs/CHIPDevicePlatformConfig.h @@ -31,6 +31,15 @@ #define CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP 0 +/** + * CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING + * + * A string identifying the software version running on the device. + */ +#ifdef SL_MATTER_VERSION_STRING +#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING SL_MATTER_VERSION_STRING +#endif + #if defined(SL_WIFI) #define CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION 1 #else diff --git a/src/test_driver/efr32/include/CHIPProjectConfig.h b/src/test_driver/efr32/include/CHIPProjectConfig.h index 04b0577e94ced3..451292ff519b7b 100644 --- a/src/test_driver/efr32/include/CHIPProjectConfig.h +++ b/src/test_driver/efr32/include/CHIPProjectConfig.h @@ -65,16 +65,6 @@ */ #define CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION 1 -/** - * CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING - * - * A string identifying the software version running on the device. - * CHIP service currently expects the software version to be in the format - * {MAJOR_VERSION}.0d{MINOR_VERSION} - */ -#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING -#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "0.1ALPHA" -#endif /** * CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE * diff --git a/third_party/silabs/BUILD.gn b/third_party/silabs/BUILD.gn index 9c59de25de7056..9ef1251fd88f31 100644 --- a/third_party/silabs/BUILD.gn +++ b/third_party/silabs/BUILD.gn @@ -30,10 +30,17 @@ declare_args() { sl_ot_efr32_root = "${chip_root}/third_party/openthread/ot-efr32" sl_openthread_root = "${chip_root}/third_party/openthread/ot-efr32/openthread" use_thread_coap_lib = false + sl_matter_version_str = "" } assert(efr32_sdk_target != "", "efr32_sdk_target must be specified") +config("silabs_config") { + if (sl_matter_version_str != "") { + defines = [ "SL_MATTER_VERSION_STRING=\"${sl_matter_version_str}\"" ] + } +} + group("efr32_sdk") { public_deps = [ efr32_sdk_target ] } diff --git a/third_party/silabs/SiWx917_sdk.gni b/third_party/silabs/SiWx917_sdk.gni index 5d6a857916320f..a60d443f7ed2c0 100644 --- a/third_party/silabs/SiWx917_sdk.gni +++ b/third_party/silabs/SiWx917_sdk.gni @@ -10,7 +10,7 @@ # 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. +# limitations under the License. import("//build_overrides/chip.gni") import("//build_overrides/efr32_sdk.gni") @@ -37,6 +37,9 @@ declare_args() { # Use Silabs factory data provider example. # Users can implement their own. use_efr32_factory_data_provider = true + + # Enable Segger System View + use_system_view = false } # Explorer Kit and MGM240L do not have external flash @@ -138,6 +141,17 @@ template("efr32_sdk") { "RS91X_BLE_ENABLE=1", ] + if (use_system_view) { + _include_dirs += [ + "${efr32_sdk_root}/util/third_party/segger/systemview/SEGGER", + "${efr32_sdk_root}/util/third_party/segger/systemview/Sample/FreeRTOSV10/Config/Cortex-M", + "${efr32_sdk_root}/util/third_party/segger/systemview/Sample/FreeRTOSV10", + "${efr32_sdk_root}/util/third_party/segger/systemview/Config/", + ] + + defines += [ "SL_SYSTEM_VIEW=1" ] + } + defines += board_defines if (defined(invoker.enable_sleepy_device)) {