From a583812c350e1b8af8d0f473f6870fa29209c858 Mon Sep 17 00:00:00 2001 From: jmartinez-silabs <67972863+jmartinez-silabs@users.noreply.github.com> Date: Wed, 8 Dec 2021 23:54:30 -0500 Subject: [PATCH] Add support for matter cli in EFR32 example apps (#12749) * Support matter shell in all efr32 example apps * add source set and start task for other examples * add shell_common example cmds * restyle --- examples/lighting-app/efr32/BUILD.gn | 3 +- examples/lighting-app/efr32/src/main.cpp | 8 + examples/lock-app/efr32/BUILD.gn | 3 +- examples/lock-app/efr32/src/main.cpp | 8 + examples/pigweed-app/efr32/BUILD.gn | 2 +- examples/platform/efr32/BUILD.gn | 17 +- examples/platform/efr32/matter_shell.cpp | 88 ++++++++ examples/platform/efr32/matter_shell.h | 27 +++ examples/platform/efr32/{uart.c => uart.cpp} | 18 +- examples/shell/efr32/BUILD.gn | 3 +- examples/shell/efr32/src/main.cpp | 35 +--- examples/window-app/efr32/BUILD.gn | 3 +- examples/window-app/efr32/src/main.cpp | 8 + src/lib/shell/BUILD.gn | 2 +- src/lib/shell/MainLoopEFR32.cpp | 204 +++++++++++++++++++ src/test_driver/efr32/BUILD.gn | 2 +- third_party/efr32_sdk/efr32_sdk.gni | 8 + 17 files changed, 397 insertions(+), 42 deletions(-) create mode 100644 examples/platform/efr32/matter_shell.cpp create mode 100644 examples/platform/efr32/matter_shell.h rename examples/platform/efr32/{uart.c => uart.cpp} (97%) create mode 100644 src/lib/shell/MainLoopEFR32.cpp diff --git a/examples/lighting-app/efr32/BUILD.gn b/examples/lighting-app/efr32/BUILD.gn index 142cb8dff3e051..82f8ac26266806 100644 --- a/examples/lighting-app/efr32/BUILD.gn +++ b/examples/lighting-app/efr32/BUILD.gn @@ -84,7 +84,7 @@ efr32_executable("lighting_app") { "${examples_plat_dir}/LEDWidget.cpp", "${examples_plat_dir}/heap_4_silabs.c", "${examples_plat_dir}/init_efrPlatform.cpp", - "${examples_plat_dir}/uart.c", + "${examples_plat_dir}/uart.cpp", "src/AppTask.cpp", "src/LightingManager.cpp", "src/ZclCallbacks.cpp", @@ -101,6 +101,7 @@ efr32_executable("lighting_app") { "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils", "${chip_root}/third_party/openthread/repo:libopenthread-cli-ftd", "${chip_root}/third_party/openthread/repo:libopenthread-ftd", + "${examples_plat_dir}:efr-matter-shell", ] include_dirs = [ "include" ] diff --git a/examples/lighting-app/efr32/src/main.cpp b/examples/lighting-app/efr32/src/main.cpp index 1648398333fbf8..943f0993a7af35 100644 --- a/examples/lighting-app/efr32/src/main.cpp +++ b/examples/lighting-app/efr32/src/main.cpp @@ -66,6 +66,10 @@ #include "Rpc.h" #endif +#ifdef ENABLE_CHIP_SHELL +#include "matter_shell.h" +#endif + using namespace ::chip; using namespace ::chip::Inet; using namespace ::chip::DeviceLayer; @@ -177,6 +181,10 @@ int main(void) appError(ret); } +#ifdef ENABLE_CHIP_SHELL + chip::startShellTask(); +#endif + EFR32_LOG("Starting FreeRTOS scheduler"); sl_system_kernel_start(); diff --git a/examples/lock-app/efr32/BUILD.gn b/examples/lock-app/efr32/BUILD.gn index 165b388f11c369..f36729cd64920b 100644 --- a/examples/lock-app/efr32/BUILD.gn +++ b/examples/lock-app/efr32/BUILD.gn @@ -81,7 +81,7 @@ efr32_executable("lock_app") { "${examples_plat_dir}/LEDWidget.cpp", "${examples_plat_dir}/heap_4_silabs.c", "${examples_plat_dir}/init_efrPlatform.cpp", - "${examples_plat_dir}/uart.c", + "${examples_plat_dir}/uart.cpp", "src/AppTask.cpp", "src/BoltLockManager.cpp", "src/ZclCallbacks.cpp", @@ -98,6 +98,7 @@ efr32_executable("lock_app") { "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils", "${chip_root}/third_party/openthread/repo:libopenthread-cli-ftd", "${chip_root}/third_party/openthread/repo:libopenthread-ftd", + "${examples_plat_dir}:efr-matter-shell", ] include_dirs = [ "include" ] diff --git a/examples/lock-app/efr32/src/main.cpp b/examples/lock-app/efr32/src/main.cpp index 012b1ddd63f162..c92b9e71c8b7d5 100644 --- a/examples/lock-app/efr32/src/main.cpp +++ b/examples/lock-app/efr32/src/main.cpp @@ -52,6 +52,10 @@ #include "Rpc.h" #endif +#ifdef ENABLE_CHIP_SHELL +#include "matter_shell.h" +#endif + #if CHIP_ENABLE_OPENTHREAD #include #include @@ -174,6 +178,10 @@ int main(void) appError(ret); } +#ifdef ENABLE_CHIP_SHELL + chip::startShellTask(); +#endif + EFR32_LOG("Starting FreeRTOS scheduler"); sl_system_kernel_start(); diff --git a/examples/pigweed-app/efr32/BUILD.gn b/examples/pigweed-app/efr32/BUILD.gn index f6b4f9934e0016..7ecb027c152ca4 100644 --- a/examples/pigweed-app/efr32/BUILD.gn +++ b/examples/pigweed-app/efr32/BUILD.gn @@ -57,7 +57,7 @@ efr32_executable("pigweed_app") { "${examples_plat_dir}/PigweedLogger.cpp", "${examples_plat_dir}/heap_4_silabs.c", "${examples_plat_dir}/init_efrPlatform.cpp", - "${examples_plat_dir}/uart.c", + "${examples_plat_dir}/uart.cpp", "src/main.cpp", ] diff --git a/examples/platform/efr32/BUILD.gn b/examples/platform/efr32/BUILD.gn index 652c05ec0ab31f..185651c5de3a61 100644 --- a/examples/platform/efr32/BUILD.gn +++ b/examples/platform/efr32/BUILD.gn @@ -14,7 +14,7 @@ import("//build_overrides/chip.gni") import("//build_overrides/efr32_sdk.gni") - +import("${chip_root}/src/lib/lib.gni") import("${efr32_sdk_build_root}/efr32_sdk.gni") config("chip_examples_project_config") { @@ -49,3 +49,18 @@ source_set("openthread_core_config_efr32_chip_examples") { public_configs = [ ":chip_examples_project_config" ] } + +source_set("efr-matter-shell") { + if (chip_build_libshell) { + defines = [ "ENABLE_CHIP_SHELL" ] + + sources = [ "matter_shell.cpp" ] + include_dirs = [ "." ] + + public_deps = [ + "${chip_root}/examples/shell/shell_common:shell_common", + "${chip_root}/src/lib/shell:shell", + "${chip_root}/src/lib/shell:shell_core", + ] + } +} diff --git a/examples/platform/efr32/matter_shell.cpp b/examples/platform/efr32/matter_shell.cpp new file mode 100644 index 00000000000000..50b5af84947a91 --- /dev/null +++ b/examples/platform/efr32/matter_shell.cpp @@ -0,0 +1,88 @@ +/* + * + * Copyright (c) 2021 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. + */ + +#include "matter_shell.h" +#include +#include +#include +#include +#include + +using namespace ::chip; +using chip::Shell::Engine; + +namespace { + +#define SHELL_TASK_STACK_SIZE 2048 +#define SHELL_TASK_PRIORITY 5 +TaskHandle_t shellTaskHandle; +StackType_t shellStack[SHELL_TASK_STACK_SIZE / sizeof(StackType_t)]; +StaticTask_t shellTaskStruct; + +void MatterShellTask(void * args) +{ + chip::Shell::Engine::Root().RunMainLoop(); +} + +} // namespace + +extern "C" unsigned int sleep(unsigned int seconds) +{ + const TickType_t xDelay = 1000 * seconds / portTICK_PERIOD_MS; + vTaskDelay(xDelay); + return 0; +} + +namespace chip { + +void NotifyShellProcess() +{ + xTaskNotifyGive(shellTaskHandle); +} + +void NotifyShellProcessFromISR() +{ + BaseType_t yieldRequired = pdFALSE; + if (shellTaskHandle != NULL) + { + vTaskNotifyGiveFromISR(shellTaskHandle, &yieldRequired); + } + portYIELD_FROM_ISR(yieldRequired); +} + +void WaitForShellActivity() +{ + ulTaskNotifyTake(pdTRUE, portMAX_DELAY); +} + +void startShellTask() +{ + int status = chip::Shell::streamer_init(chip::Shell::streamer_get()); + assert(status == 0); + + // For now also register commands from shell_common (shell app). + // TODO move at least OTCLI to default commands in lib/shell/commands + cmd_misc_init(); + cmd_otcli_init(); + cmd_ping_init(); + cmd_send_init(); + + shellTaskHandle = xTaskCreateStatic(MatterShellTask, "matter_cli", ArraySize(shellStack), NULL, SHELL_TASK_PRIORITY, shellStack, + &shellTaskStruct); +} + +} // namespace chip diff --git a/examples/platform/efr32/matter_shell.h b/examples/platform/efr32/matter_shell.h new file mode 100644 index 00000000000000..9b818bfe8a412b --- /dev/null +++ b/examples/platform/efr32/matter_shell.h @@ -0,0 +1,27 @@ +/* + * + * Copyright (c) 2021 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. + */ + +#pragma once + +namespace chip { + +void NotifyShellProcess(); +void NotifyShellProcessFromISR(); +void WaitForShellActivity(); +void startShellTask(); + +} // namespace chip diff --git a/examples/platform/efr32/uart.c b/examples/platform/efr32/uart.cpp similarity index 97% rename from examples/platform/efr32/uart.c rename to examples/platform/efr32/uart.cpp index 8d5b7fe37ab6f7..0fed6bde861c8c 100644 --- a/examples/platform/efr32/uart.c +++ b/examples/platform/efr32/uart.cpp @@ -15,14 +15,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "uart.h" #include "AppConfig.h" +#include "matter_shell.h" + +#ifdef __cplusplus +extern "C" { +#endif #include "assert.h" #include "em_core.h" #include "em_usart.h" #include "sl_board_control.h" #include "sl_uartdrv_instances.h" #include "sl_uartdrv_usart_vcom_config.h" +#include "uart.h" #include "uartdrv.h" #include #include @@ -192,6 +197,9 @@ void uartConsoleInit(void) void USART_IRQHandler(void) { +#ifdef ENABLE_CHIP_SHELL + chip::NotifyShellProcessFromISR(); +#endif #ifndef PW_RPC_ENABLED otSysEventSignalPending(); #endif @@ -212,6 +220,10 @@ static void UART_rx_callback(UARTDRV_Handle_t handle, Ecode_t transferStatus, ui } UARTDRV_Receive(sl_uartdrv_usart_vcom_handle, data, transferCount, UART_rx_callback); + +#ifdef ENABLE_CHIP_SHELL + chip::NotifyShellProcessFromISR(); +#endif #ifndef PW_RPC_ENABLED otSysEventSignalPending(); #endif @@ -267,3 +279,7 @@ int16_t uartConsoleRead(char * Buf, uint16_t NbBytesToRead) return (int16_t) RetrieveFromFifo(&sReceiveFifo, (uint8_t *) Buf, NbBytesToRead); } + +#ifdef __cplusplus +} +#endif diff --git a/examples/shell/efr32/BUILD.gn b/examples/shell/efr32/BUILD.gn index 13476fff6009d4..a18df44f8f9989 100644 --- a/examples/shell/efr32/BUILD.gn +++ b/examples/shell/efr32/BUILD.gn @@ -58,7 +58,7 @@ efr32_executable("shell_app") { sources = [ "${examples_plat_dir}/heap_4_silabs.c", "${examples_plat_dir}/init_efrPlatform.cpp", - "${examples_plat_dir}/uart.c", + "${examples_plat_dir}/uart.cpp", "src/main.cpp", ] @@ -70,6 +70,7 @@ efr32_executable("shell_app") { "${chip_root}/third_party/openthread/platforms:libopenthread-platform", "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils", "${chip_root}/third_party/openthread/repo:libopenthread-ftd", + "${examples_plat_dir}:efr-matter-shell", ] include_dirs = [ "include" ] diff --git a/examples/shell/efr32/src/main.cpp b/examples/shell/efr32/src/main.cpp index 2cbebee810be40..88fa56e00f92c7 100644 --- a/examples/shell/efr32/src/main.cpp +++ b/examples/shell/efr32/src/main.cpp @@ -36,6 +36,7 @@ #include #include +#include "matter_shell.h" #include #include #include @@ -63,13 +64,6 @@ using namespace ::chip; using namespace ::chip::DeviceLayer; using chip::Shell::Engine; -#define SHELL_TASK_STACK_SIZE 8192 -#define SHELL_TASK_PRIORITY 3 -static TaskHandle_t sShellTaskHandle; -#define APP_TASK_STACK_SIZE (1536) -static StackType_t appStack[APP_TASK_STACK_SIZE / sizeof(StackType_t)]; -static StaticTask_t appTaskStruct; - // ================================================================================ // Supporting functions // ================================================================================ @@ -87,13 +81,6 @@ void appError(CHIP_ERROR error) appError(static_cast(error.AsInteger())); } -extern "C" unsigned int sleep(unsigned int seconds) -{ - const TickType_t xDelay = 1000 * seconds / portTICK_PERIOD_MS; - vTaskDelay(xDelay); - return 0; -} - extern "C" void vApplicationIdleHook(void) { // FreeRTOS Idle callback @@ -102,11 +89,6 @@ extern "C" void vApplicationIdleHook(void) Internal::EFR32Config::RepackNvm3Flash(); } -static void shell_task(void * args) -{ - Engine::Root().RunMainLoop(); -} - // ================================================================================ // Main Code // ================================================================================ @@ -174,19 +156,6 @@ int main(void) } #endif // CHIP_ENABLE_OPENTHREAD - int status = chip::Shell::streamer_init(chip::Shell::streamer_get()); - assert(status == 0); - - cmd_misc_init(); - cmd_otcli_init(); - cmd_ping_init(); - cmd_send_init(); - - sShellTaskHandle = xTaskCreateStatic(shell_task, APP_TASK_NAME, ArraySize(appStack), NULL, 1, appStack, &appTaskStruct); - if (!sShellTaskHandle) - { - EFR32_LOG("MEMORY ERROR!!!"); - } - + chip::startShellTask(); sl_system_kernel_start(); } diff --git a/examples/window-app/efr32/BUILD.gn b/examples/window-app/efr32/BUILD.gn index 4d72f31371a670..b2b6cb7a48eda7 100644 --- a/examples/window-app/efr32/BUILD.gn +++ b/examples/window-app/efr32/BUILD.gn @@ -71,7 +71,7 @@ efr32_executable("window_app") { "${examples_plat_dir}/LEDWidget.cpp", "${examples_plat_dir}/heap_4_silabs.c", "${examples_plat_dir}/init_efrPlatform.cpp", - "${examples_plat_dir}/uart.c", + "${examples_plat_dir}/uart.cpp", "${project_dir}/common/src/WindowApp.cpp", "${project_dir}/common/src/ZclCallbacks.cpp", "src/WindowAppImpl.cpp", @@ -88,6 +88,7 @@ efr32_executable("window_app") { "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils", "${chip_root}/third_party/openthread/repo:libopenthread-cli-ftd", "${chip_root}/third_party/openthread/repo:libopenthread-ftd", + "${examples_plat_dir}:efr-matter-shell", ] include_dirs = [ diff --git a/examples/window-app/efr32/src/main.cpp b/examples/window-app/efr32/src/main.cpp index 8a099063a6796a..b9d4e3070a4d01 100644 --- a/examples/window-app/efr32/src/main.cpp +++ b/examples/window-app/efr32/src/main.cpp @@ -46,6 +46,10 @@ #include #endif +#ifdef ENABLE_CHIP_SHELL +#include "matter_shell.h" +#endif + using namespace ::chip::DeviceLayer; // ================================================================================ @@ -140,6 +144,10 @@ int main(void) } #endif // CHIP_ENABLE_OPENTHREAD +#ifdef ENABLE_CHIP_SHELL + chip::startShellTask(); +#endif + WindowApp & app = WindowApp::Instance(); EFR32_LOG("Starting App"); diff --git a/src/lib/shell/BUILD.gn b/src/lib/shell/BUILD.gn index 8aeb3bb7ef3b07..6f5ff3feaf2b84 100644 --- a/src/lib/shell/BUILD.gn +++ b/src/lib/shell/BUILD.gn @@ -50,7 +50,7 @@ static_library("shell") { ] } else if (chip_device_platform == "efr32") { sources += [ - "MainLoopDefault.cpp", + "MainLoopEFR32.cpp", "streamer_efr32.cpp", ] } else if (chip_device_platform == "k32w0") { diff --git a/src/lib/shell/MainLoopEFR32.cpp b/src/lib/shell/MainLoopEFR32.cpp new file mode 100644 index 00000000000000..32f4a1cc2012e4 --- /dev/null +++ b/src/lib/shell/MainLoopEFR32.cpp @@ -0,0 +1,204 @@ +/* + * + * Copyright (c) 2021 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. + */ + +#include "matter_shell.h" +#include "streamer.h" +#include +#include +#include + +#include +#include + +using chip::FormatCHIPError; +using chip::Platform::MemoryAlloc; +using chip::Platform::MemoryFree; +using chip::Shell::Engine; +using chip::Shell::streamer_get; + +namespace { + +constexpr const char kShellPrompt[] = "matterCli > "; + +void ReadLine(char * buffer, size_t max) +{ + ssize_t read = 0; + bool done = false; + char * inptr = buffer; + + // Read in characters until we get a new line or we hit our max size. + while (((inptr - buffer) < static_cast(max)) && !done) + { + chip::WaitForShellActivity(); + if (read == 0) + { + read = streamer_read(streamer_get(), inptr, 1); + } + + // Process any characters we just read in. + while (read > 0) + { + switch (*inptr) + { + case '\r': + case '\n': + streamer_printf(streamer_get(), "\r\n"); + *inptr = 0; // null terminate + done = true; + break; + case 0x7F: + // delete backspace character + 1 more + inptr -= 2; + if (inptr >= buffer - 1) + { + streamer_printf(streamer_get(), "\b \b"); + } + else + { + inptr = buffer - 1; + } + break; + default: + if (isprint(static_cast(*inptr)) || *inptr == '\t') + { + streamer_printf(streamer_get(), "%c", *inptr); + } + else + { + inptr--; + } + break; + } + + inptr++; + read--; + } + } +} + +bool IsSeparator(char ch) +{ + return (ch == ' ') || (ch == '\t') || (ch == '\r') || (ch == '\n'); +} + +bool IsEscape(char ch) +{ + return (ch == '\\'); +} + +bool IsEscapable(char ch) +{ + return IsSeparator(ch) || IsEscape(ch); +} + +int TokenizeLine(char * buffer, char ** tokens, int max_tokens) +{ + size_t len = strlen(buffer); + int cursor = 0; + size_t i = 0; + + // Strip leading spaces + while (buffer[i] && buffer[i] == ' ') + { + i++; + } + + if (len <= i) + { + return 0; + } + + // The first token starts at the beginning. + tokens[cursor++] = &buffer[i]; + + for (; i < len && cursor < max_tokens; i++) + { + if (IsEscape(buffer[i]) && IsEscapable(buffer[i + 1])) + { + // include the null terminator: strlen(cmd) = strlen(cmd + 1) + 1 + memmove(&buffer[i], &buffer[i + 1], strlen(&buffer[i])); + } + else if (IsSeparator(buffer[i])) + { + buffer[i] = 0; + if (!IsSeparator(buffer[i + 1])) + { + tokens[cursor++] = &buffer[i + 1]; + } + } + } + + tokens[cursor] = nullptr; + + return cursor; +} + +void ProcessShellLine(intptr_t args) +{ + int argc; + char * argv[CHIP_SHELL_MAX_TOKENS]; + + char * line = reinterpret_cast(args); + argc = TokenizeLine(line, argv, CHIP_SHELL_MAX_TOKENS); + + if (argc > 0) + { + CHIP_ERROR retval = Engine::Root().ExecCommand(argc, argv); + + if (retval != CHIP_NO_ERROR) + { + char errorStr[160]; + bool errorStrFound = FormatCHIPError(errorStr, sizeof(errorStr), retval); + if (!errorStrFound) + { + errorStr[0] = 0; + } + streamer_printf(streamer_get(), "Error %s: %s\r\n", argv[0], errorStr); + } + else + { + streamer_printf(streamer_get(), "Done\r\n", argv[0]); + } + } + MemoryFree(line); + streamer_printf(streamer_get(), kShellPrompt); +} + +} // namespace + +namespace chip { +namespace Shell { + +void Engine::RunMainLoop() +{ + Engine::Root().RegisterDefaultCommands(); + streamer_printf(streamer_get(), kShellPrompt); + + while (true) + { + char * line = static_cast(Platform::MemoryAlloc(CHIP_SHELL_MAX_LINE_SIZE)); + ReadLine(line, CHIP_SHELL_MAX_LINE_SIZE); +#if CONFIG_DEVICE_LAYER + DeviceLayer::PlatformMgr().ScheduleWork(ProcessShellLine, reinterpret_cast(line)); +#else + ProcessShellLine(reinterpret_cast(line)); +#endif + } +} + +} // namespace Shell +} // namespace chip diff --git a/src/test_driver/efr32/BUILD.gn b/src/test_driver/efr32/BUILD.gn index d5bb25ff017f49..d43ed2aaf74382 100644 --- a/src/test_driver/efr32/BUILD.gn +++ b/src/test_driver/efr32/BUILD.gn @@ -69,7 +69,7 @@ efr32_executable("efr32_device_tests") { "${examples_plat_dir}/PigweedLogger.cpp", "${examples_plat_dir}/heap_4_silabs.c", "${examples_plat_dir}/init_efrPlatform.cpp", - "${examples_plat_dir}/uart.c", + "${examples_plat_dir}/uart.cpp", "src/main.cpp", ] diff --git a/third_party/efr32_sdk/efr32_sdk.gni b/third_party/efr32_sdk/efr32_sdk.gni index 012a10058341e6..82191ec80ca1e1 100644 --- a/third_party/efr32_sdk/efr32_sdk.gni +++ b/third_party/efr32_sdk/efr32_sdk.gni @@ -17,6 +17,7 @@ import("//build_overrides/efr32_sdk.gni") import("//build_overrides/jlink.gni") import("//build_overrides/mbedtls.gni") +import("${chip_root}/src/lib/lib.gni") import("efr32_board.gni") declare_args() { @@ -145,6 +146,13 @@ template("efr32_sdk") { defines += board_defines + if (chip_build_libshell) { + defines += [ + "ENABLE_CHIP_SHELL", + "OPENTHREAD_CONFIG_CLI_TRANSPORT=OT_CLI_TRANSPORT_CONSOLE", + ] + } + if (efr32_family == "efr32mg12") { _include_dirs += [ "${efr32_sdk_root}/hardware/driver/memlcd/inc/memlcd_usart",