From 9dd2eb5b7e54b76c3633cc04d8d0a7ce28b18035 Mon Sep 17 00:00:00 2001 From: Junior Martinez Date: Wed, 19 Jan 2022 16:56:58 -0500 Subject: [PATCH 1/7] Add support for Sleepy End Device in EFR32 examples and add power manager to enable and handle MCU sleep modes --- examples/lighting-app/efr32/.gn | 2 +- examples/lighting-app/efr32/BUILD.gn | 3 ++ examples/lighting-app/efr32/args.gni | 1 - .../efr32/include/FreeRTOSConfig.h | 47 +------------------ examples/lighting-app/efr32/src/main.cpp | 7 +++ examples/lock-app/efr32/.gn | 2 +- examples/lock-app/efr32/BUILD.gn | 3 ++ examples/lock-app/efr32/args.gni | 1 - .../lock-app/efr32/include/FreeRTOSConfig.h | 47 +------------------ examples/lock-app/efr32/src/main.cpp | 7 +++ examples/window-app/efr32/.gn | 2 +- examples/window-app/efr32/BUILD.gn | 3 ++ examples/window-app/efr32/args.gni | 1 - .../window-app/efr32/include/FreeRTOSConfig.h | 47 +------------------ .../window-app/efr32/src/WindowAppImpl.cpp | 5 +- examples/window-app/efr32/src/main.cpp | 7 +++ third_party/efr32_sdk/efr32_sdk.gni | 12 +++++ third_party/efr32_sdk/repo | 2 +- third_party/zap/repo | 2 +- 19 files changed, 57 insertions(+), 144 deletions(-) diff --git a/examples/lighting-app/efr32/.gn b/examples/lighting-app/efr32/.gn index 3d48789e30ab3d..0ff42d50e06ef0 100644 --- a/examples/lighting-app/efr32/.gn +++ b/examples/lighting-app/efr32/.gn @@ -23,6 +23,6 @@ check_system_includes = true default_args = { target_cpu = "arm" target_os = "freertos" - + chip_openthread_ftd = true import("//args.gni") } diff --git a/examples/lighting-app/efr32/BUILD.gn b/examples/lighting-app/efr32/BUILD.gn index b9bbca9a8dc80f..f3b4bf14f642b7 100644 --- a/examples/lighting-app/efr32/BUILD.gn +++ b/examples/lighting-app/efr32/BUILD.gn @@ -45,6 +45,9 @@ declare_args() { # Monitor & log memory usage at runtime. enable_heap_monitoring = false + # Enable Sleepy end device + sleepy_device = false + # Wifi related stuff - they are overriden by gn -args="use_wf200=true" use_wf200 = false use_rs911x = false diff --git a/examples/lighting-app/efr32/args.gni b/examples/lighting-app/efr32/args.gni index 0f2b60d59f6054..42061052611489 100644 --- a/examples/lighting-app/efr32/args.gni +++ b/examples/lighting-app/efr32/args.gni @@ -21,5 +21,4 @@ efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") pw_log_BACKEND = "${chip_root}/src/lib/support/pw_log_chip" pw_assert_BACKEND = "$dir_pw_assert_log" chip_enable_openthread = true -chip_openthread_ftd = true chip_system_config_use_open_thread_udp = true diff --git a/examples/lighting-app/efr32/include/FreeRTOSConfig.h b/examples/lighting-app/efr32/include/FreeRTOSConfig.h index 17bc3975fe19af..dc4cb5385fcbe5 100644 --- a/examples/lighting-app/efr32/include/FreeRTOSConfig.h +++ b/examples/lighting-app/efr32/include/FreeRTOSConfig.h @@ -127,34 +127,15 @@ extern "C" { * See http://www.freertos.org/a00110.html. *----------------------------------------------------------*/ -/* Set configCREATE_LOW_POWER_DEMO as follows: - * - * 0: Build the full test and demo application. - * 1: Build the simple blinky tickless low power demo, generating the tick - * interrupt from the RTCC. EM2 will be entered. The LXFO clock is used. - * See the comments at the top of main.c, main_full.c and main_low_power.c for - * more information. - */ - -#define configCREATE_LOW_POWER_DEMO (0) - -/* Some configuration is dependent on the demo being built. */ -#if (configCREATE_LOW_POWER_DEMO == 0) - -/* Tickless mode is not used. */ - -/* Some of the standard demo test tasks assume a tick rate of 1KHz, even -though that is faster than would normally be warranted by a real -application. */ -#define configTICK_RATE_HZ (1000) /* Energy saving modes. */ #if defined(SL_CATALOG_POWER_MANAGER_PRESENT) #define configUSE_TICKLESS_IDLE 1 #else #define configUSE_TICKLESS_IDLE 0 -#endif +#endif //SL_CATALOG_POWER_MANAGER_PRESENT +#define configTICK_RATE_HZ (1000) /* Definition used by Keil to replace default system clock source. */ #define configOVERRIDE_DEFAULT_TICK_CONFIGURATION 1 @@ -164,30 +145,6 @@ application. */ #define configUSE_MALLOC_FAILED_HOOK (1) #define configUSE_IDLE_HOOK (1) -#define configENERGY_MODE (sleepEM1) - -#else - -/* Tickless idle mode, generating RTOS tick interrupts from the RTC, fed -by the LXFO clock. */ - -/* The slow clock used to generate the tick interrupt in the low power demo -runs at 32768/8=4096Hz. Ensure the tick rate is a multiple of the clock. */ -#define configTICK_RATE_HZ (128) - -/* The low power demo uses the tickless idle feature. */ -#define configUSE_TICKLESS_IDLE (1) -#define configOVERRIDE_DEFAULT_TICK_CONFIGURATION (1) - -/* Hook function related definitions. */ -#define configUSE_TICK_HOOK (0) -#define configCHECK_FOR_STACK_OVERFLOW (0) -#define configUSE_MALLOC_FAILED_HOOK (0) -#define configUSE_IDLE_HOOK (1) - -#define configENERGY_MODE (sleepEM3) -#endif - /* Main functions*/ /* Run time stats gathering related definitions. */ #define configGENERATE_RUN_TIME_STATS (0) diff --git a/examples/lighting-app/efr32/src/main.cpp b/examples/lighting-app/efr32/src/main.cpp index 297601ac6f8670..44d958f2588377 100644 --- a/examples/lighting-app/efr32/src/main.cpp +++ b/examples/lighting-app/efr32/src/main.cpp @@ -150,7 +150,14 @@ int main(void) appError(ret); } +#if CHIP_DEVICE_CONFIG_THREAD_FTD ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router); +#else // CHIP_DEVICE_CONFIG_THREAD_FTD +#if CHIP_DEVICE_CONFIG_ENABLE_SED + ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice); +#endif // CHIP_DEVICE_CONFIG_ENABLE_SED + ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); +#endif // CHIP_DEVICE_CONFIG_THREAD_FTD if (ret != CHIP_NO_ERROR) { EFR32_LOG("ConnectivityMgr().SetThreadDeviceType() failed"); diff --git a/examples/lock-app/efr32/.gn b/examples/lock-app/efr32/.gn index 3d48789e30ab3d..0ff42d50e06ef0 100644 --- a/examples/lock-app/efr32/.gn +++ b/examples/lock-app/efr32/.gn @@ -23,6 +23,6 @@ check_system_includes = true default_args = { target_cpu = "arm" target_os = "freertos" - + chip_openthread_ftd = true import("//args.gni") } diff --git a/examples/lock-app/efr32/BUILD.gn b/examples/lock-app/efr32/BUILD.gn index 7dcc8802659fdc..4056216e804f11 100644 --- a/examples/lock-app/efr32/BUILD.gn +++ b/examples/lock-app/efr32/BUILD.gn @@ -43,6 +43,9 @@ declare_args() { # Monitor & log memory usage at runtime. enable_heap_monitoring = false + + # Enable Sleepy end device + sleepy_device = false # Wifi related stuff - they are overriden by gn -args="use_wf200=true" use_wf200 = false diff --git a/examples/lock-app/efr32/args.gni b/examples/lock-app/efr32/args.gni index 3ea3fd22b6bd13..5e298bdae486b6 100644 --- a/examples/lock-app/efr32/args.gni +++ b/examples/lock-app/efr32/args.gni @@ -19,6 +19,5 @@ import("${chip_root}/src/platform/EFR32/args.gni") efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_openthread = true -chip_openthread_ftd = true pw_log_BACKEND = "${chip_root}/src/lib/support/pw_log_chip" pw_assert_BACKEND = "$dir_pw_assert_log" diff --git a/examples/lock-app/efr32/include/FreeRTOSConfig.h b/examples/lock-app/efr32/include/FreeRTOSConfig.h index cd1c6a4a845f6c..cd89cfe3802846 100644 --- a/examples/lock-app/efr32/include/FreeRTOSConfig.h +++ b/examples/lock-app/efr32/include/FreeRTOSConfig.h @@ -127,34 +127,15 @@ extern "C" { * See http://www.freertos.org/a00110.html. *----------------------------------------------------------*/ -/* Set configCREATE_LOW_POWER_DEMO as follows: - * - * 0: Build the full test and demo application. - * 1: Build the simple blinky tickless low power demo, generating the tick - * interrupt from the RTCC. EM2 will be entered. The LXFO clock is used. - * See the comments at the top of main.c, main_full.c and main_low_power.c for - * more information. - */ - -#define configCREATE_LOW_POWER_DEMO (0) - -/* Some configuration is dependent on the demo being built. */ -#if (configCREATE_LOW_POWER_DEMO == 0) - -/* Tickless mode is not used. */ - -/* Some of the standard demo test tasks assume a tick rate of 1KHz, even -though that is faster than would normally be warranted by a real -application. */ -#define configTICK_RATE_HZ (1000) /* Energy saving modes. */ #if defined(SL_CATALOG_POWER_MANAGER_PRESENT) #define configUSE_TICKLESS_IDLE 1 #else #define configUSE_TICKLESS_IDLE 0 -#endif +#endif //SL_CATALOG_POWER_MANAGER_PRESENT +#define configTICK_RATE_HZ (1000) /* Definition used by Keil to replace default system clock source. */ #define configOVERRIDE_DEFAULT_TICK_CONFIGURATION 1 @@ -164,30 +145,6 @@ application. */ #define configUSE_MALLOC_FAILED_HOOK (1) #define configUSE_IDLE_HOOK (1) -#define configENERGY_MODE (sleepEM1) - -#else - -/* Tickless idle mode, generating RTOS tick interrupts from the RTC, fed -by the LXFO clock. */ - -/* The slow clock used to generate the tick interrupt in the low power demo -runs at 32768/8=4096Hz. Ensure the tick rate is a multiple of the clock. */ -#define configTICK_RATE_HZ (128) - -/* The low power demo uses the tickless idle feature. */ -#define configUSE_TICKLESS_IDLE (1) -#define configOVERRIDE_DEFAULT_TICK_CONFIGURATION (1) - -/* Hook function related definitions. */ -#define configUSE_TICK_HOOK (0) -#define configCHECK_FOR_STACK_OVERFLOW (0) -#define configUSE_MALLOC_FAILED_HOOK (0) -#define configUSE_IDLE_HOOK (1) - -#define configENERGY_MODE (sleepEM3) -#endif - /* Main functions*/ /* Run time stats gathering related definitions. */ #define configGENERATE_RUN_TIME_STATS (0) diff --git a/examples/lock-app/efr32/src/main.cpp b/examples/lock-app/efr32/src/main.cpp index 7e25365142199d..bbee37bd7c7a9e 100644 --- a/examples/lock-app/efr32/src/main.cpp +++ b/examples/lock-app/efr32/src/main.cpp @@ -146,7 +146,14 @@ int main(void) appError(ret); } +#if CHIP_DEVICE_CONFIG_THREAD_FTD ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router); +#else // CHIP_DEVICE_CONFIG_THREAD_FTD +#if CHIP_DEVICE_CONFIG_ENABLE_SED + ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice); +#endif // CHIP_DEVICE_CONFIG_ENABLE_SED + ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); +#endif // CHIP_DEVICE_CONFIG_THREAD_FTD if (ret != CHIP_NO_ERROR) { EFR32_LOG("ConnectivityMgr().SetThreadDeviceType() failed"); diff --git a/examples/window-app/efr32/.gn b/examples/window-app/efr32/.gn index 3d48789e30ab3d..0ff42d50e06ef0 100644 --- a/examples/window-app/efr32/.gn +++ b/examples/window-app/efr32/.gn @@ -23,6 +23,6 @@ check_system_includes = true default_args = { target_cpu = "arm" target_os = "freertos" - + chip_openthread_ftd = true import("//args.gni") } diff --git a/examples/window-app/efr32/BUILD.gn b/examples/window-app/efr32/BUILD.gn index 2f3c814e4a83cb..2bbfd2ac19c21f 100644 --- a/examples/window-app/efr32/BUILD.gn +++ b/examples/window-app/efr32/BUILD.gn @@ -38,6 +38,9 @@ declare_args() { # Monitor & log memory usage at runtime. enable_heap_monitoring = false + # Enable Sleepy end device + sleepy_device = false + # Wifi related stuff - they are overriden by gn -args="use_wf200=true" use_wf200 = false use_rs911x = false diff --git a/examples/window-app/efr32/args.gni b/examples/window-app/efr32/args.gni index 1b73ad66dcea58..3061e39359d252 100644 --- a/examples/window-app/efr32/args.gni +++ b/examples/window-app/efr32/args.gni @@ -21,4 +21,3 @@ efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") pw_log_BACKEND = "${chip_root}/src/lib/support/pw_log_chip" pw_assert_BACKEND = "$dir_pw_assert_log" chip_enable_openthread = true -chip_openthread_ftd = true diff --git a/examples/window-app/efr32/include/FreeRTOSConfig.h b/examples/window-app/efr32/include/FreeRTOSConfig.h index cd1c6a4a845f6c..cd89cfe3802846 100644 --- a/examples/window-app/efr32/include/FreeRTOSConfig.h +++ b/examples/window-app/efr32/include/FreeRTOSConfig.h @@ -127,34 +127,15 @@ extern "C" { * See http://www.freertos.org/a00110.html. *----------------------------------------------------------*/ -/* Set configCREATE_LOW_POWER_DEMO as follows: - * - * 0: Build the full test and demo application. - * 1: Build the simple blinky tickless low power demo, generating the tick - * interrupt from the RTCC. EM2 will be entered. The LXFO clock is used. - * See the comments at the top of main.c, main_full.c and main_low_power.c for - * more information. - */ - -#define configCREATE_LOW_POWER_DEMO (0) - -/* Some configuration is dependent on the demo being built. */ -#if (configCREATE_LOW_POWER_DEMO == 0) - -/* Tickless mode is not used. */ - -/* Some of the standard demo test tasks assume a tick rate of 1KHz, even -though that is faster than would normally be warranted by a real -application. */ -#define configTICK_RATE_HZ (1000) /* Energy saving modes. */ #if defined(SL_CATALOG_POWER_MANAGER_PRESENT) #define configUSE_TICKLESS_IDLE 1 #else #define configUSE_TICKLESS_IDLE 0 -#endif +#endif //SL_CATALOG_POWER_MANAGER_PRESENT +#define configTICK_RATE_HZ (1000) /* Definition used by Keil to replace default system clock source. */ #define configOVERRIDE_DEFAULT_TICK_CONFIGURATION 1 @@ -164,30 +145,6 @@ application. */ #define configUSE_MALLOC_FAILED_HOOK (1) #define configUSE_IDLE_HOOK (1) -#define configENERGY_MODE (sleepEM1) - -#else - -/* Tickless idle mode, generating RTOS tick interrupts from the RTC, fed -by the LXFO clock. */ - -/* The slow clock used to generate the tick interrupt in the low power demo -runs at 32768/8=4096Hz. Ensure the tick rate is a multiple of the clock. */ -#define configTICK_RATE_HZ (128) - -/* The low power demo uses the tickless idle feature. */ -#define configUSE_TICKLESS_IDLE (1) -#define configOVERRIDE_DEFAULT_TICK_CONFIGURATION (1) - -/* Hook function related definitions. */ -#define configUSE_TICK_HOOK (0) -#define configCHECK_FOR_STACK_OVERFLOW (0) -#define configUSE_MALLOC_FAILED_HOOK (0) -#define configUSE_IDLE_HOOK (1) - -#define configENERGY_MODE (sleepEM3) -#endif - /* Main functions*/ /* Run time stats gathering related definitions. */ #define configGENERATE_RUN_TIME_STATS (0) diff --git a/examples/window-app/efr32/src/WindowAppImpl.cpp b/examples/window-app/efr32/src/WindowAppImpl.cpp index 7bff2706e5b5cb..c62067380a185d 100644 --- a/examples/window-app/efr32/src/WindowAppImpl.cpp +++ b/examples/window-app/efr32/src/WindowAppImpl.cpp @@ -382,7 +382,10 @@ void WindowAppImpl::UpdateLCD() } else { - LCDWriteQRCode((uint8_t *) mQRCode.c_str()); + if (GetQRCode(mQRCode, chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE)) == CHIP_NO_ERROR) + { + LCDWriteQRCode((uint8_t *) mQRCode.c_str()); + } } #endif } diff --git a/examples/window-app/efr32/src/main.cpp b/examples/window-app/efr32/src/main.cpp index 2a8704b949dc9d..de64dab6cec4b7 100644 --- a/examples/window-app/efr32/src/main.cpp +++ b/examples/window-app/efr32/src/main.cpp @@ -131,7 +131,14 @@ int main(void) appError(err); } +#if CHIP_DEVICE_CONFIG_THREAD_FTD err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router); +#else // CHIP_DEVICE_CONFIG_THREAD_FTD +#if CHIP_DEVICE_CONFIG_ENABLE_SED + err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice); +#endif // CHIP_DEVICE_CONFIG_ENABLE_SED + err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); +#endif // CHIP_DEVICE_CONFIG_THREAD_FTD if (err != CHIP_NO_ERROR) { EFR32_LOG("ConnectivityMgr().SetThreadDeviceType() failed"); diff --git a/third_party/efr32_sdk/efr32_sdk.gni b/third_party/efr32_sdk/efr32_sdk.gni index 0bd7a6faf8bd9d..b1ca399851c0b8 100644 --- a/third_party/efr32_sdk/efr32_sdk.gni +++ b/third_party/efr32_sdk/efr32_sdk.gni @@ -152,6 +152,18 @@ template("efr32_sdk") { defines += board_defines + if (defined(invoker.sleepy_device)) + { + if (invoker.sleepy_device) { + print("INVOKER SLEEPY") + defines += [ + "CHIP_DEVICE_CONFIG_ENABLE_SED=1", + "SL_CATALOG_POWER_MANAGER_PRESENT", + "SL_CATALOG_SLEEPTIMER_PRESENT", + ] + } + } + if (chip_build_libshell) { defines += [ "ENABLE_CHIP_SHELL", diff --git a/third_party/efr32_sdk/repo b/third_party/efr32_sdk/repo index 5705278b0c2ad5..d505a886028bcc 160000 --- a/third_party/efr32_sdk/repo +++ b/third_party/efr32_sdk/repo @@ -1 +1 @@ -Subproject commit 5705278b0c2ad5d502705f88e77ac1e4e347637b +Subproject commit d505a886028bccd9592fc53f613228af48ae5532 diff --git a/third_party/zap/repo b/third_party/zap/repo index 85a7080f6d1c17..d57a2656ed73c1 160000 --- a/third_party/zap/repo +++ b/third_party/zap/repo @@ -1 +1 @@ -Subproject commit 85a7080f6d1c17ec0bc4a6698a3dfd1f6bff7ce7 +Subproject commit d57a2656ed73c12a72e393ab65cb0a729b9593a9 From edaa4bd56d684bb7b8de15be6e0d895902c4a810 Mon Sep 17 00:00:00 2001 From: Junior Martinez Date: Mon, 24 Jan 2022 15:04:07 -0500 Subject: [PATCH 2/7] Rework efr32 build script, add some info for SED build in the examples readme & restyle --- examples/lighting-app/efr32/BUILD.gn | 2 +- examples/lighting-app/efr32/README.md | 21 +- .../efr32/include/FreeRTOSConfig.h | 3 +- examples/lock-app/efr32/BUILD.gn | 2 +- examples/lock-app/efr32/README.md | 31 ++- .../lock-app/efr32/include/FreeRTOSConfig.h | 3 +- examples/platform/efr32/uart.cpp | 15 ++ examples/window-app/efr32/BUILD.gn | 2 +- examples/window-app/efr32/README.md | 21 +- .../window-app/efr32/include/FreeRTOSConfig.h | 3 +- scripts/examples/gn_efr32_example.sh | 198 +++++++++++------- src/messaging/ExchangeContext.cpp | 22 +- third_party/efr32_sdk/efr32_sdk.gni | 9 +- third_party/zap/repo | 2 +- 14 files changed, 235 insertions(+), 99 deletions(-) diff --git a/examples/lighting-app/efr32/BUILD.gn b/examples/lighting-app/efr32/BUILD.gn index f3b4bf14f642b7..664e57c4387e5c 100644 --- a/examples/lighting-app/efr32/BUILD.gn +++ b/examples/lighting-app/efr32/BUILD.gn @@ -47,7 +47,7 @@ declare_args() { # Enable Sleepy end device sleepy_device = false - + # Wifi related stuff - they are overriden by gn -args="use_wf200=true" use_wf200 = false use_rs911x = false diff --git a/examples/lighting-app/efr32/README.md b/examples/lighting-app/efr32/README.md index 391a5f39976ef1..ca56caa5aae9fc 100644 --- a/examples/lighting-app/efr32/README.md +++ b/examples/lighting-app/efr32/README.md @@ -85,7 +85,7 @@ Silicon Labs platform. $ cd ~/connectedhomeip $ rm -rf ./out/ -OR use GN/Ninja directly + OR use GN/Ninja directly $ cd ~/connectedhomeip/examples/lighting-app/efr32 $ git submodule update --init @@ -99,7 +99,19 @@ OR use GN/Ninja directly $ cd ~/connectedhomeip/examples/lighting-app/efr32 $ rm -rf out/ -* Build the example with pigweed RCP use GN/Ninja Directly +* Build the example as Sleepy End Device (SED) + + $ ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32/ ./out/lighting-app_SED BRD4161A --sed + + or use gn as previously mentioned but adding the following arguments: + + $ gn gen out/debug '--args=efr32_board="BRD4161A" sleepy_device=true chip_openthread_ftd=false' + +* Build the example with pigweed RCP + + $ ./scripts/examples/gn_efr32_example.sh examples/lighting-app/efr32/ out/lighting_app_rpc BRD4161A 'import("//with_pw_rpc.gni")' + + or use GN/Ninja Directly $ cd ~/connectedhomeip/examples/lighting-app/efr32 $ git submodule update --init @@ -110,6 +122,11 @@ OR use GN/Ninja directly [Running Pigweed RPC console](#running-pigweed-rpc-console) +For more build options, help is provided when running the build script without +arguments + + ./scripts/examples/gn_efr32_example.sh + ## Flashing the Application diff --git a/examples/lighting-app/efr32/include/FreeRTOSConfig.h b/examples/lighting-app/efr32/include/FreeRTOSConfig.h index dc4cb5385fcbe5..f8d2c6a1500057 100644 --- a/examples/lighting-app/efr32/include/FreeRTOSConfig.h +++ b/examples/lighting-app/efr32/include/FreeRTOSConfig.h @@ -127,13 +127,12 @@ extern "C" { * See http://www.freertos.org/a00110.html. *----------------------------------------------------------*/ - /* Energy saving modes. */ #if defined(SL_CATALOG_POWER_MANAGER_PRESENT) #define configUSE_TICKLESS_IDLE 1 #else #define configUSE_TICKLESS_IDLE 0 -#endif //SL_CATALOG_POWER_MANAGER_PRESENT +#endif // SL_CATALOG_POWER_MANAGER_PRESENT #define configTICK_RATE_HZ (1000) /* Definition used by Keil to replace default system clock source. */ diff --git a/examples/lock-app/efr32/BUILD.gn b/examples/lock-app/efr32/BUILD.gn index 4056216e804f11..faed6b8cc3225a 100644 --- a/examples/lock-app/efr32/BUILD.gn +++ b/examples/lock-app/efr32/BUILD.gn @@ -43,7 +43,7 @@ declare_args() { # Monitor & log memory usage at runtime. enable_heap_monitoring = false - + # Enable Sleepy end device sleepy_device = false diff --git a/examples/lock-app/efr32/README.md b/examples/lock-app/efr32/README.md index 6c3fa798d6154a..c6914bbb4ee407 100644 --- a/examples/lock-app/efr32/README.md +++ b/examples/lock-app/efr32/README.md @@ -84,7 +84,7 @@ Silicon Labs platform. $ cd ~/connectedhomeip $ rm -rf ./out/ -OR use GN/Ninja directly + OR use GN/Ninja directly $ cd ~/connectedhomeip/examples/lock-app/efr32 $ git submodule update --init @@ -98,6 +98,35 @@ OR use GN/Ninja directly $ cd ~/connectedhomeip/examples/lock-app/efr32 $ rm -rf out/ + +* Build the example as Sleepy End Device (SED) + + $ ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32/ ./out/lighting-app_SED BRD4161A --sed + + or use gn as previously mentioned but adding the following arguments: + + $ gn gen out/debug '--args=efr32_board="BRD4161A" sleepy_device=true chip_openthread_ftd=false' + +* Build the example with pigweed RCP + + $ ./scripts/examples/gn_efr32_example.sh examples/lock-app/efr32/ out/lock_app_rpc BRD4161A 'import("//with_pw_rpc.gni")' + + or use GN/Ninja Directly + + $ cd ~/connectedhomeip/examples/lock-app/efr32 + $ git submodule update --init + $ source third_party/connectedhomeip/scripts/activate.sh + $ export EFR32_BOARD=BRD4161A + $ gn gen out/debug --args='import("//with_pw_rpc.gni")' + $ ninja -C out/debug + + [Running Pigweed RPC console](#running-pigweed-rpc-console) + +For more build options, help is provided when running the build script without +arguments + + ./scripts/examples/gn_efr32_example.sh + ## Flashing the Application diff --git a/examples/lock-app/efr32/include/FreeRTOSConfig.h b/examples/lock-app/efr32/include/FreeRTOSConfig.h index cd89cfe3802846..af0b8ace973680 100644 --- a/examples/lock-app/efr32/include/FreeRTOSConfig.h +++ b/examples/lock-app/efr32/include/FreeRTOSConfig.h @@ -127,13 +127,12 @@ extern "C" { * See http://www.freertos.org/a00110.html. *----------------------------------------------------------*/ - /* Energy saving modes. */ #if defined(SL_CATALOG_POWER_MANAGER_PRESENT) #define configUSE_TICKLESS_IDLE 1 #else #define configUSE_TICKLESS_IDLE 0 -#endif //SL_CATALOG_POWER_MANAGER_PRESENT +#endif // SL_CATALOG_POWER_MANAGER_PRESENT #define configTICK_RATE_HZ (1000) /* Definition used by Keil to replace default system clock source. */ diff --git a/examples/platform/efr32/uart.cpp b/examples/platform/efr32/uart.cpp index 8d384a9ac657b4..dd370c60475daa 100644 --- a/examples/platform/efr32/uart.cpp +++ b/examples/platform/efr32/uart.cpp @@ -32,6 +32,10 @@ extern "C" { #include #include +#if defined(SL_CATALOG_POWER_MANAGER_PRESENT) +#include "sl_power_manager.h" +#endif + #if !defined(MIN) #define MIN(A, B) ((A) < (B) ? (A) : (B)) #endif @@ -245,13 +249,24 @@ int16_t uartConsoleWrite(const char * Buf, uint16_t BufLength) return UART_CONSOLE_ERR; } +#if defined(SL_CATALOG_POWER_MANAGER_PRESENT) + sl_power_manager_add_em_requirement(SL_POWER_MANAGER_EM1); +#endif + // Use of ForceTransmit here. Transmit with DMA was causing errors with PW_RPC // TODO Use DMA and find/fix what causes the issue with PW if (UARTDRV_ForceTransmit(sl_uartdrv_usart_vcom_handle, (uint8_t *) Buf, BufLength) == ECODE_EMDRV_UARTDRV_OK) { +#if defined(SL_CATALOG_POWER_MANAGER_PRESENT) + sl_power_manager_remove_em_requirement(SL_POWER_MANAGER_EM1); +#endif return BufLength; } +#if defined(SL_CATALOG_POWER_MANAGER_PRESENT) + sl_power_manager_remove_em_requirement(SL_POWER_MANAGER_EM1); +#endif + return UART_CONSOLE_ERR; } diff --git a/examples/window-app/efr32/BUILD.gn b/examples/window-app/efr32/BUILD.gn index 2bbfd2ac19c21f..135d14f1bc462c 100644 --- a/examples/window-app/efr32/BUILD.gn +++ b/examples/window-app/efr32/BUILD.gn @@ -40,7 +40,7 @@ declare_args() { # Enable Sleepy end device sleepy_device = false - + # Wifi related stuff - they are overriden by gn -args="use_wf200=true" use_wf200 = false use_rs911x = false diff --git a/examples/window-app/efr32/README.md b/examples/window-app/efr32/README.md index 79ad30072ff490..17e1c7799afa55 100644 --- a/examples/window-app/efr32/README.md +++ b/examples/window-app/efr32/README.md @@ -89,7 +89,7 @@ Silicon Labs platform. $ cd ~/connectedhomeip $ rm -rf ./out/ -OR use GN/Ninja directly + OR use GN/Ninja directly $ cd ~/connectedhomeip/examples/window-app/efr32 $ git submodule update --init @@ -103,7 +103,19 @@ OR use GN/Ninja directly $ cd ~/connectedhomeip/examples/window-app/efr32 $ rm -rf out/ -* Build the example with pigweed RCP use GN/Ninja Directly +* Build the example as Sleepy End Device (SED) + + $ ./scripts/examples/gn_efr32_example.sh ./examples/window-app/efr32/ ./out/window-app_SED BRD4161A --sed + + or use gn as previously mentioned but adding the following arguments: + + $ gn gen out/debug '--args=efr32_board="BRD4161A" sleepy_device=true chip_openthread_ftd=false' + +* Build the example with pigweed RCP + + $ ./scripts/examples/gn_efr32_example.sh examples/window-app/efr32/ out/window_app_rpc BRD4161A 'import("//with_pw_rpc.gni")' + + or use GN/Ninja Directly $ cd ~/connectedhomeip/examples/window-app/efr32 $ git submodule update --init @@ -114,6 +126,11 @@ OR use GN/Ninja directly [Running Pigweed RPC console](#running-pigweed-rpc-console) +For more build options, help is provided when running the build script without +arguments + + ./scripts/examples/gn_efr32_example.sh + ## Flashing the Application diff --git a/examples/window-app/efr32/include/FreeRTOSConfig.h b/examples/window-app/efr32/include/FreeRTOSConfig.h index cd89cfe3802846..af0b8ace973680 100644 --- a/examples/window-app/efr32/include/FreeRTOSConfig.h +++ b/examples/window-app/efr32/include/FreeRTOSConfig.h @@ -127,13 +127,12 @@ extern "C" { * See http://www.freertos.org/a00110.html. *----------------------------------------------------------*/ - /* Energy saving modes. */ #if defined(SL_CATALOG_POWER_MANAGER_PRESENT) #define configUSE_TICKLESS_IDLE 1 #else #define configUSE_TICKLESS_IDLE 0 -#endif //SL_CATALOG_POWER_MANAGER_PRESENT +#endif // SL_CATALOG_POWER_MANAGER_PRESENT #define configTICK_RATE_HZ (1000) /* Definition used by Keil to replace default system clock source. */ diff --git a/scripts/examples/gn_efr32_example.sh b/scripts/examples/gn_efr32_example.sh index ed0cc22502bfff..9bc42a1f8e4e9f 100755 --- a/scripts/examples/gn_efr32_example.sh +++ b/scripts/examples/gn_efr32_example.sh @@ -23,79 +23,133 @@ source "$(dirname "$0")/../../scripts/activate.sh" set -x env -USE_WF200=0 -USE_RS911X=0 -USE_WIFI=0 - -ROOT=$1 -arg2=$2 -shift -shift -while [ $# -gt 0 ]; do - case $1 in - --wifi) - if [ -z "$2" ]; then - echo "--efr requires BRDxxxx" - exit 1 - fi - if [ X"$2" = "Xrs911x" ]; then - WIFI_ARGS="use_rs911x=true" - elif [ "$2" = wf200 ]; then - WIFI_ARGS="use_wf200=true" - else - echo "Wifi usage: --wifi rs911x|wf200" - exit 1 - fi - shift - shift - - ;; - --efr) - if [ -z "$2" ]; then - echo "--efr requires BRDxxxx" - exit 1 - fi - EFR32_BOARD=$2 - shift - shift - ;; - - --gnargs) - echo "-gnargs - Not yet implemented" - exit 1 - GNARGS=$2 - shift - shift - ;; - - *) - EFR32_BOARD=$1 - shift - if [ X"$1" != "X" ]; then - GNARGS=$1 - shift - fi - ;; - esac -done - -if [ X"$EFR32_BOARD" = "X" ]; then - echo "EFR32_BOARD not defined" - exit 1 -fi -BUILD_DIR=$arg2/$EFR32_BOARD -echo BUILD_DIR="$BUILD_DIR" -if [ "X$WIFI_ARGS" != "X" ]; then - gn gen --check --fail-on-unused-args --root="$ROOT" --dotfile="$ROOT"/build_for_wifi_gnfile.gn --args="efr32_board=\"$EFR32_BOARD\" $WIFI_ARGS" "$BUILD_DIR" +USE_WIFI=false + +USAGE="./scripts/examples/gn_efr32_example.sh []" + +if [ "$#" == "0" ]; then + echo "Build script for EFR32 Matter apps + Format: + $USAGE + + + Root Location of the app e.g: examples/lighting-app/efr32/ + + + Desired location for the output files + + + Identifier of the board for which this app is built + Currently Supported : + BRD4161A + BRD4163A + BRD4164A + BRD4166A + BRD4170A + BRD4186A + BRD4187A + BRD4304A + + - optional noteworthy build options for EFR32 + chip_build_libshell + Enable libshell support. (Default false) + chip_logging + Current value (Default true) + chip_openthread_ftd + Use openthread Full Thread Device, else, use Minimal Thread Device. (Default true) + efr32_sdk_root + Location for an alternate or modified efr32 SDK + enable_heap_monitoring + Monitor & log memory usage at runtime. (Default false) + setupDiscriminator + Discriminatoor value used for BLE connexion. (Default 3840) + setupPinCode + PIN code for PASE session establishment. (Default 73141520) + sleepy_device + Enable Sleepy end device. (Default false) + Must also set chip_openthread_ftd=false + use_rs911x + Build wifi example with extension board rs911x. (Default false) + use_wf200 + Build wifi example with extension board wf200. (Default false) + 'import("//with_pw_rpc.gni")' + Use to build the example with pigweed RPC + + Presets + --sed + enable sleepy end device and set thread mtd + --wifi + build wifi example variant for given exansion board + " +elif [ "$#" -lt "2" ]; then + echo "Invalid number of arguments + Format: + $USAGE" else - # thread build - # - if [ -z "$GNARGS" ]; then - gn gen --check --fail-on-unused-args --root="$ROOT" --args="efr32_board=\"$EFR32_BOARD\"" "$BUILD_DIR" + ROOT=$1 + OUTDIR=$2 + + if [ "$#" -gt "2" ]; then + EFR32_BOARD=$3 + shift + fi + + shift + shift + while [ $# -gt 0 ]; do + case $1 in + --wifi) + if [ -z "$2" ]; then + echo "--wifi requires rs911x or wf200" + exit 1 + fi + if [ "$2" = "rs911x" ]; then + optArgs+="use_rs911x=true" + elif [ "$2" = "wf200" ]; then + optArgs+="use_wf200=true" + else + echo "Wifi usage: --wifi rs911x|wf200" + exit 1 + fi + USE_WIFI=true + shift + shift + ;; + --sed) + optArgs+="sleepy_device=true chip_openthread_ftd=false " + shift + ;; + *) + if [ "$1" =~ *"use_rs911x=true"* ] || [ "$1" =~ *"use_wf200=true"* ]; then + USE_WIFI=true + fi + + optArgs+=$1" " + shift + ;; + esac + done + + if [ -z "$EFR32_BOARD" ]; then + echo "EFR32_BOARD not defined" + exit 1 + fi + + BUILD_DIR=$OUTDIR/$EFR32_BOARD + echo BUILD_DIR="$BUILD_DIR" + if [ "$USE_WIFI" == true ]; then + gn gen --check --fail-on-unused-args --root="$ROOT" --dotfile="$ROOT"/build_for_wifi_gnfile.gn --args="efr32_board=\"$EFR32_BOARD\" $optArgs" "$BUILD_DIR" else - gn gen --check --fail-on-unused-args --root="$ROOT" --args="efr32_board=\"$EFR32_BOARD\" $GNARGS" "$BUILD_DIR" + # thread build + # + if [ -z "$optArgs" ]; then + gn gen --check --fail-on-unused-args --root="$ROOT" --args="efr32_board=\"$EFR32_BOARD\"" "$BUILD_DIR" + else + gn gen --check --fail-on-unused-args --root="$ROOT" --args="efr32_board=\"$EFR32_BOARD\" $optArgs" "$BUILD_DIR" + fi fi + ninja -v -C "$BUILD_DIR"/ + #print stats + arm-none-eabi-size -A "$BUILD_DIR"/*.out + fi -ninja -v -C "$BUILD_DIR"/ -#print stats -arm-none-eabi-size -A "$BUILD_DIR"/*.out diff --git a/src/messaging/ExchangeContext.cpp b/src/messaging/ExchangeContext.cpp index 8ec3b67989aff8..64c99bd7a76427 100644 --- a/src/messaging/ExchangeContext.cpp +++ b/src/messaging/ExchangeContext.cpp @@ -87,15 +87,23 @@ void ExchangeContext::SetResponseTimeout(Timeout timeout) #if CONFIG_DEVICE_LAYER && CHIP_DEVICE_CONFIG_ENABLE_SED void ExchangeContext::UpdateSEDPollingMode() { - if (GetSessionHandle()->AsSecureSession()->GetPeerAddress().GetTransportType() != Transport::Type::kBle) + SessionHandle sessionHandle = GetSessionHandle(); + Transport::Session::SessionType sessType = sessionHandle->GetSessionType(); + + // During PASE session, which happen on BLE, the session is kUnauthenticated + // So AsSecureSession() ends up faulting the sytem + if (sessType != Transport::Session::SessionType::kUnauthenticated) { - if (!IsResponseExpected() && !IsSendExpected() && (mExchangeMgr->GetNumActiveExchanges() == 1)) - { - chip::DeviceLayer::ConnectivityMgr().RequestSEDFastPollingMode(false); - } - else + if (sessionHandle->AsSecureSession()->GetPeerAddress().GetTransportType() != Transport::Type::kBle) { - chip::DeviceLayer::ConnectivityMgr().RequestSEDFastPollingMode(true); + if (!IsResponseExpected() && !IsSendExpected() && (mExchangeMgr->GetNumActiveExchanges() == 1)) + { + chip::DeviceLayer::ConnectivityMgr().RequestSEDFastPollingMode(false); + } + else + { + chip::DeviceLayer::ConnectivityMgr().RequestSEDFastPollingMode(true); + } } } } diff --git a/third_party/efr32_sdk/efr32_sdk.gni b/third_party/efr32_sdk/efr32_sdk.gni index b1ca399851c0b8..660b3668e14be5 100644 --- a/third_party/efr32_sdk/efr32_sdk.gni +++ b/third_party/efr32_sdk/efr32_sdk.gni @@ -152,17 +152,15 @@ template("efr32_sdk") { defines += board_defines - if (defined(invoker.sleepy_device)) - { + if (defined(invoker.sleepy_device)) { if (invoker.sleepy_device) { - print("INVOKER SLEEPY") defines += [ "CHIP_DEVICE_CONFIG_ENABLE_SED=1", "SL_CATALOG_POWER_MANAGER_PRESENT", "SL_CATALOG_SLEEPTIMER_PRESENT", - ] + ] } - } + } if (chip_build_libshell) { defines += [ @@ -438,6 +436,7 @@ template("efr32_sdk") { "${efr32_sdk_root}/util/third_party/freertos/kernel/croutine.c", "${efr32_sdk_root}/util/third_party/freertos/kernel/event_groups.c", "${efr32_sdk_root}/util/third_party/freertos/kernel/list.c", + "${efr32_sdk_root}/util/third_party/freertos/kernel/portable/SiliconLabs/tick_power_manager.c", "${efr32_sdk_root}/util/third_party/freertos/kernel/queue.c", "${efr32_sdk_root}/util/third_party/freertos/kernel/stream_buffer.c", "${efr32_sdk_root}/util/third_party/freertos/kernel/tasks.c", diff --git a/third_party/zap/repo b/third_party/zap/repo index d57a2656ed73c1..85a7080f6d1c17 160000 --- a/third_party/zap/repo +++ b/third_party/zap/repo @@ -1 +1 @@ -Subproject commit d57a2656ed73c12a72e393ab65cb0a729b9593a9 +Subproject commit 85a7080f6d1c17ec0bc4a6698a3dfd1f6bff7ce7 From f2a929ab6eaa6ef4144d4f741a1d6e7fa863b44f Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Mon, 24 Jan 2022 20:20:33 +0000 Subject: [PATCH 3/7] Restyled by prettier-markdown --- examples/lock-app/efr32/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/lock-app/efr32/README.md b/examples/lock-app/efr32/README.md index c6914bbb4ee407..6a16ecd76ee0d2 100644 --- a/examples/lock-app/efr32/README.md +++ b/examples/lock-app/efr32/README.md @@ -98,7 +98,6 @@ Silicon Labs platform. $ cd ~/connectedhomeip/examples/lock-app/efr32 $ rm -rf out/ - * Build the example as Sleepy End Device (SED) $ ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32/ ./out/lighting-app_SED BRD4161A --sed From e0c840f8b7ecba1802f3fe3e8cf533f2aa42606c Mon Sep 17 00:00:00 2001 From: Junior Martinez Date: Mon, 24 Jan 2022 15:46:16 -0500 Subject: [PATCH 4/7] Fix non SED build, Correct typo --- src/messaging/ExchangeContext.cpp | 2 +- third_party/efr32_sdk/efr32_sdk.gni | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/messaging/ExchangeContext.cpp b/src/messaging/ExchangeContext.cpp index 64c99bd7a76427..6757341ecc56c0 100644 --- a/src/messaging/ExchangeContext.cpp +++ b/src/messaging/ExchangeContext.cpp @@ -91,7 +91,7 @@ void ExchangeContext::UpdateSEDPollingMode() Transport::Session::SessionType sessType = sessionHandle->GetSessionType(); // During PASE session, which happen on BLE, the session is kUnauthenticated - // So AsSecureSession() ends up faulting the sytem + // So AsSecureSession() ends up faulting the system if (sessType != Transport::Session::SessionType::kUnauthenticated) { if (sessionHandle->AsSecureSession()->GetPeerAddress().GetTransportType() != Transport::Type::kBle) diff --git a/third_party/efr32_sdk/efr32_sdk.gni b/third_party/efr32_sdk/efr32_sdk.gni index 660b3668e14be5..816acb6434e061 100644 --- a/third_party/efr32_sdk/efr32_sdk.gni +++ b/third_party/efr32_sdk/efr32_sdk.gni @@ -436,13 +436,20 @@ template("efr32_sdk") { "${efr32_sdk_root}/util/third_party/freertos/kernel/croutine.c", "${efr32_sdk_root}/util/third_party/freertos/kernel/event_groups.c", "${efr32_sdk_root}/util/third_party/freertos/kernel/list.c", - "${efr32_sdk_root}/util/third_party/freertos/kernel/portable/SiliconLabs/tick_power_manager.c", "${efr32_sdk_root}/util/third_party/freertos/kernel/queue.c", "${efr32_sdk_root}/util/third_party/freertos/kernel/stream_buffer.c", "${efr32_sdk_root}/util/third_party/freertos/kernel/tasks.c", "${efr32_sdk_root}/util/third_party/freertos/kernel/timers.c", ] + if (defined(invoker.sleepy_device)) { + if (invoker.sleepy_device) { + sources += [ + "${efr32_sdk_root}/util/third_party/freertos/kernel/portable/SiliconLabs/tick_power_manager.c", + ] + } + } + if (defined(enable_fem)) { sources += [ "${efr32_sdk_root}/util/plugin/plugin-common/fem-control/fem-control.c", From 1326a28f8dfbb5cad769a3f5f86e2b80a628a8f1 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Mon, 24 Jan 2022 21:02:21 +0000 Subject: [PATCH 5/7] Restyled by gn --- third_party/efr32_sdk/efr32_sdk.gni | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/third_party/efr32_sdk/efr32_sdk.gni b/third_party/efr32_sdk/efr32_sdk.gni index 816acb6434e061..f653f018223024 100644 --- a/third_party/efr32_sdk/efr32_sdk.gni +++ b/third_party/efr32_sdk/efr32_sdk.gni @@ -444,9 +444,7 @@ template("efr32_sdk") { if (defined(invoker.sleepy_device)) { if (invoker.sleepy_device) { - sources += [ - "${efr32_sdk_root}/util/third_party/freertos/kernel/portable/SiliconLabs/tick_power_manager.c", - ] + sources += [ "${efr32_sdk_root}/util/third_party/freertos/kernel/portable/SiliconLabs/tick_power_manager.c" ] } } From 058996f69436fa37f4ea1a79f98c11f3a77910bf Mon Sep 17 00:00:00 2001 From: Junior Martinez Date: Mon, 24 Jan 2022 16:33:17 -0500 Subject: [PATCH 6/7] Add sed,SED and ftd to wordlist for spellcheck errors --- .github/.wordlist.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/.wordlist.txt b/.github/.wordlist.txt index bef9dbb18a275f..da4b79a217d7a8 100644 --- a/.github/.wordlist.txt +++ b/.github/.wordlist.txt @@ -418,6 +418,7 @@ FreeRTOSConfig fsl fstab fsync +ftd fullclean gbl gcloud @@ -887,6 +888,8 @@ SDK's SDKs SDKTARGETSYSROOT sdl +sed +SED SEGGER semver sendto From e2fa64eafedbfc8166d77d60941a7957f265faf3 Mon Sep 17 00:00:00 2001 From: Junior Martinez Date: Tue, 25 Jan 2022 09:38:36 -0500 Subject: [PATCH 7/7] rename argument sleepy_device to enable_sleepy_device --- .github/.wordlist.txt | 1 - examples/lighting-app/efr32/BUILD.gn | 2 +- examples/lighting-app/efr32/README.md | 2 +- examples/lock-app/efr32/BUILD.gn | 2 +- examples/lock-app/efr32/README.md | 2 +- examples/window-app/efr32/BUILD.gn | 2 +- examples/window-app/efr32/README.md | 2 +- scripts/examples/gn_efr32_example.sh | 4 ++-- third_party/efr32_sdk/efr32_sdk.gni | 8 ++++---- 9 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/.wordlist.txt b/.github/.wordlist.txt index da4b79a217d7a8..2e54058b2fd795 100644 --- a/.github/.wordlist.txt +++ b/.github/.wordlist.txt @@ -888,7 +888,6 @@ SDK's SDKs SDKTARGETSYSROOT sdl -sed SED SEGGER semver diff --git a/examples/lighting-app/efr32/BUILD.gn b/examples/lighting-app/efr32/BUILD.gn index 664e57c4387e5c..1596316e8d2099 100644 --- a/examples/lighting-app/efr32/BUILD.gn +++ b/examples/lighting-app/efr32/BUILD.gn @@ -46,7 +46,7 @@ declare_args() { enable_heap_monitoring = false # Enable Sleepy end device - sleepy_device = false + enable_sleepy_device = false # Wifi related stuff - they are overriden by gn -args="use_wf200=true" use_wf200 = false diff --git a/examples/lighting-app/efr32/README.md b/examples/lighting-app/efr32/README.md index ca56caa5aae9fc..552777dea027a3 100644 --- a/examples/lighting-app/efr32/README.md +++ b/examples/lighting-app/efr32/README.md @@ -105,7 +105,7 @@ Silicon Labs platform. or use gn as previously mentioned but adding the following arguments: - $ gn gen out/debug '--args=efr32_board="BRD4161A" sleepy_device=true chip_openthread_ftd=false' + $ gn gen out/debug '--args=efr32_board="BRD4161A" enable_sleepy_device=true chip_openthread_ftd=false' * Build the example with pigweed RCP diff --git a/examples/lock-app/efr32/BUILD.gn b/examples/lock-app/efr32/BUILD.gn index faed6b8cc3225a..e38d406952f8c7 100644 --- a/examples/lock-app/efr32/BUILD.gn +++ b/examples/lock-app/efr32/BUILD.gn @@ -45,7 +45,7 @@ declare_args() { enable_heap_monitoring = false # Enable Sleepy end device - sleepy_device = false + enable_sleepy_device = false # Wifi related stuff - they are overriden by gn -args="use_wf200=true" use_wf200 = false diff --git a/examples/lock-app/efr32/README.md b/examples/lock-app/efr32/README.md index 6a16ecd76ee0d2..b10e203a578242 100644 --- a/examples/lock-app/efr32/README.md +++ b/examples/lock-app/efr32/README.md @@ -104,7 +104,7 @@ Silicon Labs platform. or use gn as previously mentioned but adding the following arguments: - $ gn gen out/debug '--args=efr32_board="BRD4161A" sleepy_device=true chip_openthread_ftd=false' + $ gn gen out/debug '--args=efr32_board="BRD4161A" enable_sleepy_device=true chip_openthread_ftd=false' * Build the example with pigweed RCP diff --git a/examples/window-app/efr32/BUILD.gn b/examples/window-app/efr32/BUILD.gn index 135d14f1bc462c..1ab9f0ddce3376 100644 --- a/examples/window-app/efr32/BUILD.gn +++ b/examples/window-app/efr32/BUILD.gn @@ -39,7 +39,7 @@ declare_args() { enable_heap_monitoring = false # Enable Sleepy end device - sleepy_device = false + enable_sleepy_device = false # Wifi related stuff - they are overriden by gn -args="use_wf200=true" use_wf200 = false diff --git a/examples/window-app/efr32/README.md b/examples/window-app/efr32/README.md index 17e1c7799afa55..aae70535a2d40b 100644 --- a/examples/window-app/efr32/README.md +++ b/examples/window-app/efr32/README.md @@ -109,7 +109,7 @@ Silicon Labs platform. or use gn as previously mentioned but adding the following arguments: - $ gn gen out/debug '--args=efr32_board="BRD4161A" sleepy_device=true chip_openthread_ftd=false' + $ gn gen out/debug '--args=efr32_board="BRD4161A" enable_sleepy_device=true chip_openthread_ftd=false' * Build the example with pigweed RCP diff --git a/scripts/examples/gn_efr32_example.sh b/scripts/examples/gn_efr32_example.sh index 9bc42a1f8e4e9f..7edba97ddc69c6 100755 --- a/scripts/examples/gn_efr32_example.sh +++ b/scripts/examples/gn_efr32_example.sh @@ -65,7 +65,7 @@ if [ "$#" == "0" ]; then Discriminatoor value used for BLE connexion. (Default 3840) setupPinCode PIN code for PASE session establishment. (Default 73141520) - sleepy_device + enable_sleepy_device Enable Sleepy end device. (Default false) Must also set chip_openthread_ftd=false use_rs911x @@ -116,7 +116,7 @@ else shift ;; --sed) - optArgs+="sleepy_device=true chip_openthread_ftd=false " + optArgs+="enable_sleepy_device=true chip_openthread_ftd=false " shift ;; *) diff --git a/third_party/efr32_sdk/efr32_sdk.gni b/third_party/efr32_sdk/efr32_sdk.gni index f653f018223024..81ca2ac8034cfd 100644 --- a/third_party/efr32_sdk/efr32_sdk.gni +++ b/third_party/efr32_sdk/efr32_sdk.gni @@ -152,8 +152,8 @@ template("efr32_sdk") { defines += board_defines - if (defined(invoker.sleepy_device)) { - if (invoker.sleepy_device) { + if (defined(invoker.enable_sleepy_device)) { + if (invoker.enable_sleepy_device) { defines += [ "CHIP_DEVICE_CONFIG_ENABLE_SED=1", "SL_CATALOG_POWER_MANAGER_PRESENT", @@ -442,8 +442,8 @@ template("efr32_sdk") { "${efr32_sdk_root}/util/third_party/freertos/kernel/timers.c", ] - if (defined(invoker.sleepy_device)) { - if (invoker.sleepy_device) { + if (defined(invoker.enable_sleepy_device)) { + if (invoker.enable_sleepy_device) { sources += [ "${efr32_sdk_root}/util/third_party/freertos/kernel/portable/SiliconLabs/tick_power_manager.c" ] } }