From 07843c0d742e35efa23ec169b47f9dfcf934a6b2 Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs Date: Wed, 13 Sep 2023 17:17:51 -0400 Subject: [PATCH 1/6] Added a way of activating the report on active mode from icd manager with build flags --- scripts/examples/gn_silabs_example.sh | 214 +++++++++++++------------- src/app/icd/BUILD.gn | 2 + src/app/icd/ICDManager.cpp | 1 + src/app/icd/icd.gni | 3 + 4 files changed, 115 insertions(+), 105 deletions(-) diff --git a/scripts/examples/gn_silabs_example.sh b/scripts/examples/gn_silabs_example.sh index fbf89284e09686..30f7a43c5bfb1a 100755 --- a/scripts/examples/gn_silabs_example.sh +++ b/scripts/examples/gn_silabs_example.sh @@ -157,112 +157,116 @@ else shift while [ $# -gt 0 ]; do case $1 in - --clean) - DIR_CLEAN=true - shift - ;; - --wifi) - if [ -z "$2" ]; then - echo "--wifi requires rs9116 or SiWx917 or wf200" - exit 1 - fi - if [ "$2" = "rs9116" ]; then - optArgs+="use_rs9116=true " - elif [ "$2" = "SiWx917" ]; then - optArgs+="use_SiWx917=true " - elif [ "$2" = "wf200" ]; then - optArgs+="use_wf200=true " - else - echo "Wifi usage: --wifi rs9116|SiWx917|wf200" - exit 1 - fi + --clean) + DIR_CLEAN=true + shift + ;; + --wifi) + if [ -z "$2" ]; then + echo "--wifi requires rs9116 or SiWx917 or wf200" + exit 1 + fi + if [ "$2" = "rs9116" ]; then + optArgs+="use_rs9116=true " + elif [ "$2" = "SiWx917" ]; then + optArgs+="use_SiWx917=true " + elif [ "$2" = "wf200" ]; then + optArgs+="use_wf200=true " + else + echo "Wifi usage: --wifi rs9116|SiWx917|wf200" + exit 1 + fi + USE_WIFI=true + optArgs+="chip_device_platform =\"efr32\" " + shift + shift + ;; + --icd) + optArgs+="chip_enable_icd_server=true chip_openthread_ftd=false " + shift + ;; + --low-power) + optArgs+="chip_build_libshell=false enable_openthread_cli=false show_qr_code=false disable_lcd=true " + shift + ;; + --chip_enable_wifi_ipv4) + optArgs="chip_enable_wifi_ipv4=true chip_inet_config_enable_ipv4=true " + shift + ;; + --additional_data_advertising) + optArgs+="chip_enable_additional_data_advertising=true chip_enable_rotating_device_id=true " + shift + ;; + --use_ot_lib) + optArgs+="use_silabs_thread_lib=true chip_openthread_target=$SILABS_THREAD_TARGET openthread_external_platform=\"""\" " + shift + ;; + --use_ot_coap_lib) + optArgs+="use_silabs_thread_lib=true chip_openthread_target=$SILABS_THREAD_TARGET openthread_external_platform=\"""\" use_thread_coap_lib=true " + shift + ;; + --use_chip_lwip_lib) + optArgs+="lwip_root=\""//third_party/connectedhomeip/third_party/lwip"\" " + 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 + # ;; + --report_on_active) + optArgs+="chip_report_on_active_mode=true " + shift + ;; + --release) + optArgs+="is_debug=false disable_lcd=true chip_build_libshell=false enable_openthread_cli=false use_external_flash=false chip_logging=false silabs_log_enabled=false " + shift + ;; + --docker) + optArgs+="efr32_sdk_root=\"$GSDK_ROOT\" " + USE_DOCKER=true + shift + ;; + --uart_log) + optArgs+="sl_uart_log_output=true " + shift + ;; + + --slc_generate) + optArgs+="slc_generate=true " + USE_SLC=true + shift + ;; + --slc_reuse_files) + optArgs+="slc_reuse_files=true " + USE_SLC=true + shift + ;; + --gn_path) + if [ -z "$2" ]; then + echo "--gn_path requires a path to GN" + exit 1 + else + GN_PATH="$2" + fi + GN_PATH_PROVIDED=true + shift + shift + ;; + *"sl_matter_version_str="*) + optArgs+="$1 " + USE_GIT_SHA_FOR_VERSION=false + shift + ;; + *) + if [ "$1" =~ *"use_rs9116=true"* ] || [ "$1" =~ *"use_SiWx917=true"* ] || [ "$1" =~ *"use_wf200=true"* ]; then USE_WIFI=true + # NCP Mode so base MCU is an EFR32 optArgs+="chip_device_platform =\"efr32\" " - shift - shift - ;; - --icd) - optArgs+="chip_enable_icd_server=true chip_openthread_ftd=false " - shift - ;; - --low-power) - optArgs+="chip_build_libshell=false enable_openthread_cli=false show_qr_code=false disable_lcd=true " - shift - ;; - --chip_enable_wifi_ipv4) - optArgs="chip_enable_wifi_ipv4=true chip_inet_config_enable_ipv4=true " - shift - ;; - --additional_data_advertising) - optArgs+="chip_enable_additional_data_advertising=true chip_enable_rotating_device_id=true " - shift - ;; - --use_ot_lib) - optArgs+="use_silabs_thread_lib=true chip_openthread_target=$SILABS_THREAD_TARGET openthread_external_platform=\"""\" " - shift - ;; - --use_ot_coap_lib) - optArgs+="use_silabs_thread_lib=true chip_openthread_target=$SILABS_THREAD_TARGET openthread_external_platform=\"""\" use_thread_coap_lib=true " - shift - ;; - --use_chip_lwip_lib) - optArgs+="lwip_root=\""//third_party/connectedhomeip/third_party/lwip"\" " - 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 - # ;; - --release) - optArgs+="is_debug=false disable_lcd=true chip_build_libshell=false enable_openthread_cli=false use_external_flash=false chip_logging=false silabs_log_enabled=false " - shift - ;; - --docker) - optArgs+="efr32_sdk_root=\"$GSDK_ROOT\" " - USE_DOCKER=true - shift - ;; - --uart_log) - optArgs+="sl_uart_log_output=true " - shift - ;; - - --slc_generate) - optArgs+="slc_generate=true " - USE_SLC=true - shift - ;; - --slc_reuse_files) - optArgs+="slc_reuse_files=true " - USE_SLC=true - shift - ;; - --gn_path) - if [ -z "$2" ]; then - echo "--gn_path requires a path to GN" - exit 1 - else - GN_PATH="$2" - fi - GN_PATH_PROVIDED=true - shift - shift - ;; - *"sl_matter_version_str="*) - optArgs+="$1 " - USE_GIT_SHA_FOR_VERSION=false - shift - ;; - *) - if [ "$1" =~ *"use_rs9116=true"* ] || [ "$1" =~ *"use_SiWx917=true"* ] || [ "$1" =~ *"use_wf200=true"* ]; then - USE_WIFI=true - # NCP Mode so base MCU is an EFR32 - optArgs+="chip_device_platform =\"efr32\" " - fi - optArgs+=$1" " - shift - ;; + fi + optArgs+=$1" " + shift + ;; esac done @@ -323,7 +327,7 @@ else source "$CHIP_ROOT/scripts/activate.sh" fi - ninja -v -C "$BUILD_DIR"/ + ninja -C "$BUILD_DIR"/ #print stats arm-none-eabi-size -A "$BUILD_DIR"/*.out diff --git a/src/app/icd/BUILD.gn b/src/app/icd/BUILD.gn index c0034a88e7b9b8..7bd057bd930813 100644 --- a/src/app/icd/BUILD.gn +++ b/src/app/icd/BUILD.gn @@ -34,6 +34,8 @@ source_set("manager-srcs") { ":observer-srcs", "${chip_root}/src/credentials:credentials", ] + + defines = [ "ICD_REPORT_ON_ENTER_ACTIVE_MODE=${chip_report_on_active_mode}" ] } # ICD management cluster source-set is broken out of the main source-set to enable unit tests diff --git a/src/app/icd/ICDManager.cpp b/src/app/icd/ICDManager.cpp index 91f12c23035361..5fa3466f0dc490 100644 --- a/src/app/icd/ICDManager.cpp +++ b/src/app/icd/ICDManager.cpp @@ -33,6 +33,7 @@ #define ICD_ENFORCE_SIT_SLOW_POLL_LIMIT 0 #endif +// This can be enable by adding report_on_active to your build arguments #ifndef ICD_REPORT_ON_ENTER_ACTIVE_MODE // Enabling this makes the device emit subscription reports when transitioning from idle to active mode. #define ICD_REPORT_ON_ENTER_ACTIVE_MODE 0 diff --git a/src/app/icd/icd.gni b/src/app/icd/icd.gni index 4d1dfac7eeb2f3..a576c8303c4fd6 100644 --- a/src/app/icd/icd.gni +++ b/src/app/icd/icd.gni @@ -20,4 +20,7 @@ declare_args() { # Matter SDK Configuration flag to enable ICD client functionality # TODO - Add Specifics when the design is refined chip_enable_icd_client = false + + # Matter SDK Configuration flag to make the ICD manager emit a report on entering active mode + chip_report_on_active_mode = false } From 0690f552a72b6c1250758305d3a52c4c9adaead1 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Wed, 13 Sep 2023 21:22:04 +0000 Subject: [PATCH 2/6] Restyled by shfmt --- scripts/examples/gn_silabs_example.sh | 216 +++++++++++++------------- 1 file changed, 108 insertions(+), 108 deletions(-) diff --git a/scripts/examples/gn_silabs_example.sh b/scripts/examples/gn_silabs_example.sh index 30f7a43c5bfb1a..d519311358171d 100755 --- a/scripts/examples/gn_silabs_example.sh +++ b/scripts/examples/gn_silabs_example.sh @@ -157,116 +157,116 @@ else shift while [ $# -gt 0 ]; do case $1 in - --clean) - DIR_CLEAN=true - shift - ;; - --wifi) - if [ -z "$2" ]; then - echo "--wifi requires rs9116 or SiWx917 or wf200" - exit 1 - fi - if [ "$2" = "rs9116" ]; then - optArgs+="use_rs9116=true " - elif [ "$2" = "SiWx917" ]; then - optArgs+="use_SiWx917=true " - elif [ "$2" = "wf200" ]; then - optArgs+="use_wf200=true " - else - echo "Wifi usage: --wifi rs9116|SiWx917|wf200" - exit 1 - fi - USE_WIFI=true - optArgs+="chip_device_platform =\"efr32\" " - shift - shift - ;; - --icd) - optArgs+="chip_enable_icd_server=true chip_openthread_ftd=false " - shift - ;; - --low-power) - optArgs+="chip_build_libshell=false enable_openthread_cli=false show_qr_code=false disable_lcd=true " - shift - ;; - --chip_enable_wifi_ipv4) - optArgs="chip_enable_wifi_ipv4=true chip_inet_config_enable_ipv4=true " - shift - ;; - --additional_data_advertising) - optArgs+="chip_enable_additional_data_advertising=true chip_enable_rotating_device_id=true " - shift - ;; - --use_ot_lib) - optArgs+="use_silabs_thread_lib=true chip_openthread_target=$SILABS_THREAD_TARGET openthread_external_platform=\"""\" " - shift - ;; - --use_ot_coap_lib) - optArgs+="use_silabs_thread_lib=true chip_openthread_target=$SILABS_THREAD_TARGET openthread_external_platform=\"""\" use_thread_coap_lib=true " - shift - ;; - --use_chip_lwip_lib) - optArgs+="lwip_root=\""//third_party/connectedhomeip/third_party/lwip"\" " - 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 - # ;; - --report_on_active) - optArgs+="chip_report_on_active_mode=true " - shift - ;; - --release) - optArgs+="is_debug=false disable_lcd=true chip_build_libshell=false enable_openthread_cli=false use_external_flash=false chip_logging=false silabs_log_enabled=false " - shift - ;; - --docker) - optArgs+="efr32_sdk_root=\"$GSDK_ROOT\" " - USE_DOCKER=true - shift - ;; - --uart_log) - optArgs+="sl_uart_log_output=true " - shift - ;; - - --slc_generate) - optArgs+="slc_generate=true " - USE_SLC=true - shift - ;; - --slc_reuse_files) - optArgs+="slc_reuse_files=true " - USE_SLC=true - shift - ;; - --gn_path) - if [ -z "$2" ]; then - echo "--gn_path requires a path to GN" - exit 1 - else - GN_PATH="$2" - fi - GN_PATH_PROVIDED=true - shift - shift - ;; - *"sl_matter_version_str="*) - optArgs+="$1 " - USE_GIT_SHA_FOR_VERSION=false - shift - ;; - *) - if [ "$1" =~ *"use_rs9116=true"* ] || [ "$1" =~ *"use_SiWx917=true"* ] || [ "$1" =~ *"use_wf200=true"* ]; then + --clean) + DIR_CLEAN=true + shift + ;; + --wifi) + if [ -z "$2" ]; then + echo "--wifi requires rs9116 or SiWx917 or wf200" + exit 1 + fi + if [ "$2" = "rs9116" ]; then + optArgs+="use_rs9116=true " + elif [ "$2" = "SiWx917" ]; then + optArgs+="use_SiWx917=true " + elif [ "$2" = "wf200" ]; then + optArgs+="use_wf200=true " + else + echo "Wifi usage: --wifi rs9116|SiWx917|wf200" + exit 1 + fi USE_WIFI=true - # NCP Mode so base MCU is an EFR32 optArgs+="chip_device_platform =\"efr32\" " - fi - optArgs+=$1" " - shift - ;; + shift + shift + ;; + --icd) + optArgs+="chip_enable_icd_server=true chip_openthread_ftd=false " + shift + ;; + --low-power) + optArgs+="chip_build_libshell=false enable_openthread_cli=false show_qr_code=false disable_lcd=true " + shift + ;; + --chip_enable_wifi_ipv4) + optArgs="chip_enable_wifi_ipv4=true chip_inet_config_enable_ipv4=true " + shift + ;; + --additional_data_advertising) + optArgs+="chip_enable_additional_data_advertising=true chip_enable_rotating_device_id=true " + shift + ;; + --use_ot_lib) + optArgs+="use_silabs_thread_lib=true chip_openthread_target=$SILABS_THREAD_TARGET openthread_external_platform=\"""\" " + shift + ;; + --use_ot_coap_lib) + optArgs+="use_silabs_thread_lib=true chip_openthread_target=$SILABS_THREAD_TARGET openthread_external_platform=\"""\" use_thread_coap_lib=true " + shift + ;; + --use_chip_lwip_lib) + optArgs+="lwip_root=\""//third_party/connectedhomeip/third_party/lwip"\" " + 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 + # ;; + --report_on_active) + optArgs+="chip_report_on_active_mode=true " + shift + ;; + --release) + optArgs+="is_debug=false disable_lcd=true chip_build_libshell=false enable_openthread_cli=false use_external_flash=false chip_logging=false silabs_log_enabled=false " + shift + ;; + --docker) + optArgs+="efr32_sdk_root=\"$GSDK_ROOT\" " + USE_DOCKER=true + shift + ;; + --uart_log) + optArgs+="sl_uart_log_output=true " + shift + ;; + + --slc_generate) + optArgs+="slc_generate=true " + USE_SLC=true + shift + ;; + --slc_reuse_files) + optArgs+="slc_reuse_files=true " + USE_SLC=true + shift + ;; + --gn_path) + if [ -z "$2" ]; then + echo "--gn_path requires a path to GN" + exit 1 + else + GN_PATH="$2" + fi + GN_PATH_PROVIDED=true + shift + shift + ;; + *"sl_matter_version_str="*) + optArgs+="$1 " + USE_GIT_SHA_FOR_VERSION=false + shift + ;; + *) + if [ "$1" =~ *"use_rs9116=true"* ] || [ "$1" =~ *"use_SiWx917=true"* ] || [ "$1" =~ *"use_wf200=true"* ]; then + USE_WIFI=true + # NCP Mode so base MCU is an EFR32 + optArgs+="chip_device_platform =\"efr32\" " + fi + optArgs+=$1" " + shift + ;; esac done From 844a7a1e263f644745ba43e181cf8a5a087cc16d Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs Date: Thu, 14 Sep 2023 09:39:35 -0400 Subject: [PATCH 3/6] Moved the ICD_REPORT_ON_ENTER_ACTIVE_MODE in the report scheduler implementation --- src/app/icd/ICDManager.cpp | 6 ------ src/app/reporting/ReportSchedulerImpl.cpp | 5 +++++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/app/icd/ICDManager.cpp b/src/app/icd/ICDManager.cpp index 5fa3466f0dc490..65343d76755e91 100644 --- a/src/app/icd/ICDManager.cpp +++ b/src/app/icd/ICDManager.cpp @@ -33,12 +33,6 @@ #define ICD_ENFORCE_SIT_SLOW_POLL_LIMIT 0 #endif -// This can be enable by adding report_on_active to your build arguments -#ifndef ICD_REPORT_ON_ENTER_ACTIVE_MODE -// Enabling this makes the device emit subscription reports when transitioning from idle to active mode. -#define ICD_REPORT_ON_ENTER_ACTIVE_MODE 0 -#endif - namespace chip { namespace app { diff --git a/src/app/reporting/ReportSchedulerImpl.cpp b/src/app/reporting/ReportSchedulerImpl.cpp index 7e9b1838641a96..c4fca6fdd67845 100644 --- a/src/app/reporting/ReportSchedulerImpl.cpp +++ b/src/app/reporting/ReportSchedulerImpl.cpp @@ -18,6 +18,11 @@ #include #include +#ifndef ICD_REPORT_ON_ENTER_ACTIVE_MODE +// Enabling this makes the device emit subscription reports when transitioning from idle to active mode. +#define ICD_REPORT_ON_ENTER_ACTIVE_MODE 0 +#endif + namespace chip { namespace app { namespace reporting { From 767d3d7c6ee8aaa874c9e28652d95ab9a5f30309 Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs Date: Mon, 2 Oct 2023 13:22:10 -0400 Subject: [PATCH 4/6] Moved the report on active define to the app BUILD.gn and removed un-necessary #ifdef --- src/app/BUILD.gn | 1 + src/app/icd/BUILD.gn | 2 -- src/app/reporting/ReportSchedulerImpl.cpp | 5 ----- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/app/BUILD.gn b/src/app/BUILD.gn index a4028a7a7449ef..6424dc32d2a1f8 100644 --- a/src/app/BUILD.gn +++ b/src/app/BUILD.gn @@ -59,6 +59,7 @@ buildconfig_header("app_buildconfig") { "CHIP_CONFIG_ENABLE_EVENTLIST_ATTRIBUTE=${enable_eventlist_attribute}", "CHIP_CONFIG_ENABLE_ICD_SERVER=${chip_enable_icd_server}", "CHIP_CONFIG_ENABLE_READ_CLIENT=${chip_enable_read_client}", + "ICD_REPORT_ON_ENTER_ACTIVE_MODE=${chip_report_on_active_mode}", ] } diff --git a/src/app/icd/BUILD.gn b/src/app/icd/BUILD.gn index 7bd057bd930813..c0034a88e7b9b8 100644 --- a/src/app/icd/BUILD.gn +++ b/src/app/icd/BUILD.gn @@ -34,8 +34,6 @@ source_set("manager-srcs") { ":observer-srcs", "${chip_root}/src/credentials:credentials", ] - - defines = [ "ICD_REPORT_ON_ENTER_ACTIVE_MODE=${chip_report_on_active_mode}" ] } # ICD management cluster source-set is broken out of the main source-set to enable unit tests diff --git a/src/app/reporting/ReportSchedulerImpl.cpp b/src/app/reporting/ReportSchedulerImpl.cpp index c4fca6fdd67845..7e9b1838641a96 100644 --- a/src/app/reporting/ReportSchedulerImpl.cpp +++ b/src/app/reporting/ReportSchedulerImpl.cpp @@ -18,11 +18,6 @@ #include #include -#ifndef ICD_REPORT_ON_ENTER_ACTIVE_MODE -// Enabling this makes the device emit subscription reports when transitioning from idle to active mode. -#define ICD_REPORT_ON_ENTER_ACTIVE_MODE 0 -#endif - namespace chip { namespace app { namespace reporting { From 28df0406edeb8373e49c1b47e526edb01383f415 Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs Date: Tue, 3 Oct 2023 17:35:52 -0400 Subject: [PATCH 5/6] Removed preset --- scripts/examples/gn_silabs_example.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/scripts/examples/gn_silabs_example.sh b/scripts/examples/gn_silabs_example.sh index d519311358171d..484788eb4baf28 100755 --- a/scripts/examples/gn_silabs_example.sh +++ b/scripts/examples/gn_silabs_example.sh @@ -214,10 +214,6 @@ else # 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 # ;; - --report_on_active) - optArgs+="chip_report_on_active_mode=true " - shift - ;; --release) optArgs+="is_debug=false disable_lcd=true chip_build_libshell=false enable_openthread_cli=false use_external_flash=false chip_logging=false silabs_log_enabled=false " shift From 02c6814236628becea77fc6ac687a7bf03c5f778 Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs Date: Wed, 4 Oct 2023 14:34:54 -0400 Subject: [PATCH 6/6] Added include AppBuildConfig --- src/app/reporting/ReportSchedulerImpl.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/reporting/ReportSchedulerImpl.cpp b/src/app/reporting/ReportSchedulerImpl.cpp index 7e9b1838641a96..5c061d1336bc84 100644 --- a/src/app/reporting/ReportSchedulerImpl.cpp +++ b/src/app/reporting/ReportSchedulerImpl.cpp @@ -15,6 +15,7 @@ * limitations under the License. */ +#include #include #include