diff --git a/config/efr32/lib/pw_rpc/BUILD.gn b/config/efr32/lib/pw_rpc/BUILD.gn new file mode 100644 index 00000000000000..ba44030c0eb549 --- /dev/null +++ b/config/efr32/lib/pw_rpc/BUILD.gn @@ -0,0 +1,47 @@ +# 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. + +import("//build_overrides/chip.gni") +import("//build_overrides/pigweed.gni") +import("$dir_pw_build/target_types.gni") + +config("cpp17") { + cflags_cc = [ "-std=gnu++17" ] + cflags_c = [ "-std=gnu11" ] + cflags_objc = [ "-std=gnu11" ] + cflags_objcc = [ "-std=gnu++17" ] +} + +config("std_cpp17") { + configs = [ ":cpp17" ] +} + +static_library("pw_rpc") { + output_name = "libPwRpc" + + public_configs = [ "${dir_pigweed}/pw_hdlc:default_config" ] + sources = [ "${dir_pigweed}/pw_hdlc/rpc_example/hdlc_rpc_server.cc" ] + deps = [ + "$dir_pw_rpc:server", + "$dir_pw_rpc/nanopb:echo_service", + "$dir_pw_rpc/system_server", + "${chip_root}/examples/platform/efr32/pw_sys_io:pw_sys_io_efr32", + "${dir_pigweed}/pw_hdlc:pw_rpc", + dir_pw_assert, + dir_pw_hdlc, + dir_pw_log, + ] + + output_dir = "${root_out_dir}/lib" +} diff --git a/config/efr32/lib/pw_rpc/pw_rpc.gni b/config/efr32/lib/pw_rpc/pw_rpc.gni new file mode 100644 index 00000000000000..180c9111a21c22 --- /dev/null +++ b/config/efr32/lib/pw_rpc/pw_rpc.gni @@ -0,0 +1,25 @@ +# 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. + +import("//build_overrides/chip.gni") +import("//build_overrides/pigweed.gni") + +pw_log_BACKEND = "$dir_pw_log_basic" +pw_assert_BACKEND = "$dir_pw_assert_log" +pw_sys_io_BACKEND = + "${chip_root}/examples/platform/efr32/pw_sys_io:pw_sys_io_efr32" +pw_rpc_system_server_BACKEND = + "${chip_root}/examples/common/pigweed:system_rpc_server" + +dir_pw_third_party_nanopb = "${chip_root}/third_party/nanopb/repo" diff --git a/config/efr32/toolchain/BUILD.gn b/config/efr32/toolchain/BUILD.gn index e2967372f24e42..5f2b98ad690907 100644 --- a/config/efr32/toolchain/BUILD.gn +++ b/config/efr32/toolchain/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2020 Project CHIP Authors +# 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. diff --git a/examples/lighting-app/efr32/BUILD.gn b/examples/lighting-app/efr32/BUILD.gn index b2c5ab0afea742..39502d598f71a8 100644 --- a/examples/lighting-app/efr32/BUILD.gn +++ b/examples/lighting-app/efr32/BUILD.gn @@ -41,14 +41,13 @@ efr32_sdk("sdk") { include_dirs = [ "${chip_root}/src/platform/EFR32", "${efr32_project_dir}/include", - "${efr32_project_dir}/src", + "${examples_plat_dir}", "${examples_plat_dir}/${efr32_family}/${efr32_board}", ] sources = [ "${efr32_project_dir}/include/CHIPProjectConfig.h", "${efr32_project_dir}/include/FreeRTOSConfig.h", - "${examples_plat_dir}/${efr32_family}/${efr32_board}/hal-config.h", ] defines = [] @@ -79,14 +78,14 @@ efr32_executable("lighting_app") { ] include_dirs += [ - "${efr32_project_dir}/include", + "include", "${chip_root}/src/app/util", "${chip_root}/src/app/server", "${examples_plat_dir}", + "${examples_plat_dir}/${efr32_family}/${efr32_board}", ] sources = [ - "${examples_plat_dir}/${efr32_family}/${efr32_board}/hal-config.h", "${examples_plat_dir}/${efr32_family}/${efr32_board}/init_board.c", "${examples_plat_dir}/${efr32_family}/${efr32_board}/init_mcu.c", "${examples_plat_dir}/LEDWidget.cpp", diff --git a/examples/lighting-app/efr32/args.gni b/examples/lighting-app/efr32/args.gni index f32888c77df1f5..26b4af781e8bbc 100644 --- a/examples/lighting-app/efr32/args.gni +++ b/examples/lighting-app/efr32/args.gni @@ -13,6 +13,10 @@ # limitations under the License. import("//build_overrides/chip.gni") +import("//build_overrides/pigweed.gni") import("${chip_root}/examples/platform/efr32/args.gni") 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" diff --git a/examples/lighting-app/efr32/with_pw_rpc.gni b/examples/lighting-app/efr32/with_pw_rpc.gni new file mode 100644 index 00000000000000..7c08d68a6bbd33 --- /dev/null +++ b/examples/lighting-app/efr32/with_pw_rpc.gni @@ -0,0 +1,29 @@ +# 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. + +# add this gni as import in your build args to use pigweed in the example +# 'import("//with_pw_rpc.gni")' +# *WIP* pigweed is not fully integrated in this EFR example yet + +import("//build_overrides/chip.gni") +import("${chip_root}/config/efr32/lib/pw_rpc/pw_rpc.gni") +import("${chip_root}/examples/platform/efr32/args.gni") + +efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") + +declare_args() { + chip_build_pw_rpc_lib = true +} + +default_configs_std = [ "${chip_root}/config/efr32/lib/pw_rpc:std_cpp17" ] diff --git a/examples/lock-app/efr32/BUILD.gn b/examples/lock-app/efr32/BUILD.gn index 765ec153d243a7..feac05d51fcf50 100644 --- a/examples/lock-app/efr32/BUILD.gn +++ b/examples/lock-app/efr32/BUILD.gn @@ -40,15 +40,14 @@ if (efr32_board == "BRD4166A") { efr32_sdk("sdk") { include_dirs = [ "${chip_root}/src/platform/EFR32", - "${efr32_project_dir}/include/", - "${efr32_project_dir}/src/", + "${efr32_project_dir}/include", + "${examples_plat_dir}", "${examples_plat_dir}/${efr32_family}/${efr32_board}", ] sources = [ "${efr32_project_dir}/include/CHIPProjectConfig.h", "${efr32_project_dir}/include/FreeRTOSConfig.h", - "${examples_plat_dir}/${efr32_family}/${efr32_board}/hal-config.h", ] defines = [] @@ -79,14 +78,14 @@ efr32_executable("lock_app") { ] include_dirs += [ - "${efr32_project_dir}/include", + "include", "${chip_root}/src/app/util", "${chip_root}/src/app/server", "${examples_plat_dir}", + "${examples_plat_dir}/${efr32_family}/${efr32_board}", ] sources = [ - "${examples_plat_dir}/${efr32_family}/${efr32_board}/hal-config.h", "${examples_plat_dir}/${efr32_family}/${efr32_board}/init_board.c", "${examples_plat_dir}/${efr32_family}/${efr32_board}/init_mcu.c", "${examples_plat_dir}/LEDWidget.cpp", diff --git a/examples/lock-app/efr32/args.gni b/examples/lock-app/efr32/args.gni index f32888c77df1f5..26b4af781e8bbc 100644 --- a/examples/lock-app/efr32/args.gni +++ b/examples/lock-app/efr32/args.gni @@ -13,6 +13,10 @@ # limitations under the License. import("//build_overrides/chip.gni") +import("//build_overrides/pigweed.gni") import("${chip_root}/examples/platform/efr32/args.gni") 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" diff --git a/examples/lock-app/efr32/include/ble-configuration.h b/examples/lock-app/efr32/include/ble-configuration.h deleted file mode 100644 index c4057144b80c5c..00000000000000 --- a/examples/lock-app/efr32/include/ble-configuration.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * All rights reserved. - * - * 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. - */ - -/******************************************************************************* - * @file - * @brief ble-configuration.h - ******************************************************************************* - * # License - * Copyright 2018 Silicon Laboratories Inc. www.silabs.com - ******************************************************************************* - * - * The licensor of this software is Silicon Laboratories Inc. Your use of this - * software is governed by the terms of Silicon Labs Master Software License - * Agreement (MSLA) available at - * www.silabs.com/about-us/legal/master-software-license-agreement. This - * software is distributed to you in Source Code format and is governed by the - * sections of the MSLA applicable to Source Code. - * - ******************************************************************************/ - -#pragma once - -// Top level macros -#define SILABS_AF_DEVICE_NAME "lock-example" - -// Generated plugin macros - -#ifdef EMBER_AF_BOARD_TYPE -#undef EMBER_AF_BOARD_TYPE -#endif -#define EMBER_AF_BOARD_TYPE BOARD_ID diff --git a/examples/lock-app/efr32/include/board_features.h b/examples/lock-app/efr32/include/board_features.h deleted file mode 100644 index 68d64b12f52234..00000000000000 --- a/examples/lock-app/efr32/include/board_features.h +++ /dev/null @@ -1,241 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * All rights reserved. - * - * 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. - */ -/******************************************************************************* - * @file - * @brief board_features.h - ******************************************************************************* - * # License - * Copyright 2018 Silicon Laboratories Inc. www.silabs.com - ******************************************************************************* - * - * The licensor of this software is Silicon Laboratories Inc. Your use of this - * software is governed by the terms of Silicon Labs Master Software License - * Agreement (MSLA) available at - * www.silabs.com/about-us/legal/master-software-license-agreement. This - * software is distributed to you in Source Code format and is governed by the - * sections of the MSLA applicable to Source Code. - * - ******************************************************************************/ - -#pragma once - -#include "ble-configuration.h" - -/* Indicate if LCD is supported */ -#if (EMBER_AF_BOARD_TYPE == BRD4100A) || (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4103A) || \ - (EMBER_AF_BOARD_TYPE == BRD4104A) || (EMBER_AF_BOARD_TYPE == BRD4105A) || (EMBER_AF_BOARD_TYPE == BRD4150A) || \ - (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4150C) || (EMBER_AF_BOARD_TYPE == BRD4151A) || \ - (EMBER_AF_BOARD_TYPE == BRD4153A) || (EMBER_AF_BOARD_TYPE == BRD4158A) || (EMBER_AF_BOARD_TYPE == BRD4159A) || \ - (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) || (EMBER_AF_BOARD_TYPE == BRD4163A) || \ - (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) || (EMBER_AF_BOARD_TYPE == BRD4167A) || \ - (EMBER_AF_BOARD_TYPE == BRD4168A) || (EMBER_AF_BOARD_TYPE == BRD4169A) || (EMBER_AF_BOARD_TYPE == BRD4169B) || \ - (EMBER_AF_BOARD_TYPE == BRD4170A) || (EMBER_AF_BOARD_TYPE == BRD4171A) || (EMBER_AF_BOARD_TYPE == BRD4172A) || \ - (EMBER_AF_BOARD_TYPE == BRD4172B) || (EMBER_AF_BOARD_TYPE == BRD4173A) || (EMBER_AF_BOARD_TYPE == BRD4174A) || \ - (EMBER_AF_BOARD_TYPE == BRD4174B) || (EMBER_AF_BOARD_TYPE == BRD4175A) || (EMBER_AF_BOARD_TYPE == BRD4180A) || \ - (EMBER_AF_BOARD_TYPE == BRD4180B) || (EMBER_AF_BOARD_TYPE == BRD4181A) || (EMBER_AF_BOARD_TYPE == BRD4181B) || \ - (EMBER_AF_BOARD_TYPE == BRD4182A) || (EMBER_AF_BOARD_TYPE == BRD4300A) || (EMBER_AF_BOARD_TYPE == BRD4302A) || \ - (EMBER_AF_BOARD_TYPE == BRD4303A) || (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) || \ - (EMBER_AF_BOARD_TYPE == BRD4305C) || (EMBER_AF_BOARD_TYPE == BRD4305D) || (EMBER_AF_BOARD_TYPE == BRD4305E) || \ - (EMBER_AF_BOARD_TYPE == BRD4306A) || (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306C) || \ - (EMBER_AF_BOARD_TYPE == BRD4306D) || (EMBER_AF_BOARD_TYPE == BRD4308A) || (EMBER_AF_BOARD_TYPE == BRD4308B) || \ - (EMBER_AF_BOARD_TYPE == BRD4310A) || (EMBER_AF_BOARD_TYPE == BRD4311A) -#define FEATURE_LCD_SUPPORT -#endif - -/* Indicate if the same pins are used for LEDs and Buttons on the WSTK */ -#if (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4300A) || (EMBER_AF_BOARD_TYPE == BRD4301A) || \ - (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4306A) || (EMBER_AF_BOARD_TYPE == BRD4306B) || \ - (EMBER_AF_BOARD_TYPE == BRD4306C) || (EMBER_AF_BOARD_TYPE == BRD4306D) || (EMBER_AF_BOARD_TYPE == BRD4308A) || \ - (EMBER_AF_BOARD_TYPE == BRD4308B) || (EMBER_AF_BOARD_TYPE == BRD4309A) || (EMBER_AF_BOARD_TYPE == BRD4310A) || \ - (EMBER_AF_BOARD_TYPE == BRD4311A) -#define FEATURE_LED_BUTTON_ON_SAME_PIN -#endif - -#if (EMBER_AF_BOARD_TYPE == BRD4100A) || (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4103A) || \ - (EMBER_AF_BOARD_TYPE == BRD4104A) || (EMBER_AF_BOARD_TYPE == BRD4105A) || (EMBER_AF_BOARD_TYPE == BRD4150A) || \ - (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4150C) || (EMBER_AF_BOARD_TYPE == BRD4151A) || \ - (EMBER_AF_BOARD_TYPE == BRD4153A) || (EMBER_AF_BOARD_TYPE == BRD4158A) || (EMBER_AF_BOARD_TYPE == BRD4159A) || \ - (EMBER_AF_BOARD_TYPE == BRD4160A) || (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) || \ - (EMBER_AF_BOARD_TYPE == BRD4163A) || (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) || \ - (EMBER_AF_BOARD_TYPE == BRD4166A) || (EMBER_AF_BOARD_TYPE == BRD4167A) || (EMBER_AF_BOARD_TYPE == BRD4168A) || \ - (EMBER_AF_BOARD_TYPE == BRD4169A) || (EMBER_AF_BOARD_TYPE == BRD4169B) || (EMBER_AF_BOARD_TYPE == BRD4170A) || \ - (EMBER_AF_BOARD_TYPE == BRD4171A) || (EMBER_AF_BOARD_TYPE == BRD4172A) || (EMBER_AF_BOARD_TYPE == BRD4172B) || \ - (EMBER_AF_BOARD_TYPE == BRD4173A) || (EMBER_AF_BOARD_TYPE == BRD4174A) || (EMBER_AF_BOARD_TYPE == BRD4174B) || \ - (EMBER_AF_BOARD_TYPE == BRD4175A) || (EMBER_AF_BOARD_TYPE == BRD4182A) || (EMBER_AF_BOARD_TYPE == BRD4183A) || \ - (EMBER_AF_BOARD_TYPE == BRD4184A) || (EMBER_AF_BOARD_TYPE == BRD4301A) || (EMBER_AF_BOARD_TYPE == BRD4302A) || \ - (EMBER_AF_BOARD_TYPE == BRD4303A) || (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) || \ - (EMBER_AF_BOARD_TYPE == BRD4305C) || (EMBER_AF_BOARD_TYPE == BRD4305D) || (EMBER_AF_BOARD_TYPE == BRD4305E) || \ - (EMBER_AF_BOARD_TYPE == BRD4306A) || (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306C) || \ - (EMBER_AF_BOARD_TYPE == BRD4306D) || (EMBER_AF_BOARD_TYPE == BRD4310A) || (EMBER_AF_BOARD_TYPE == BRD4311A) -#define FEATURE_SPI_FLASH -#endif - -#if (EMBER_AF_BOARD_TYPE == BRD4101B) -#define FEATURE_IOEXPANDER -#endif - -#if (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4151A) || (EMBER_AF_BOARD_TYPE == BRD4158A) || \ - (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) || \ - (EMBER_AF_BOARD_TYPE == BRD4168A) || (EMBER_AF_BOARD_TYPE == BRD4169B) || (EMBER_AF_BOARD_TYPE == BRD4170A) || \ - (EMBER_AF_BOARD_TYPE == BRD4171A) || (EMBER_AF_BOARD_TYPE == BRD4172A) || (EMBER_AF_BOARD_TYPE == BRD4172B) || \ - (EMBER_AF_BOARD_TYPE == BRD4174A) || (EMBER_AF_BOARD_TYPE == BRD4174B) || (EMBER_AF_BOARD_TYPE == BRD4180A) || \ - (EMBER_AF_BOARD_TYPE == BRD4180B) || (EMBER_AF_BOARD_TYPE == BRD4181A) || (EMBER_AF_BOARD_TYPE == BRD4181B) || \ - (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) || (EMBER_AF_BOARD_TYPE == BRD4305E) || \ - (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306D) || (EMBER_AF_BOARD_TYPE == BRD4308A) || \ - (EMBER_AF_BOARD_TYPE == BRD4308B) || (EMBER_AF_BOARD_TYPE == BRD4309A) -#define FEATURE_PA_INPUT_FROM_VBAT -#endif - -#if (EMBER_AF_BOARD_TYPE == BRD4182A) || (EMBER_AF_BOARD_TYPE == BRD4183A) || (EMBER_AF_BOARD_TYPE == BRD4184A) || \ - (EMBER_AF_BOARD_TYPE == BRD4310A) || (EMBER_AF_BOARD_TYPE == BRD4311A) -#define FEATURE_EXP_HEADER_USART1 -#endif - -#if (EMBER_AF_BOARD_TYPE == BRD4103A) || (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) || \ - (EMBER_AF_BOARD_TYPE == BRD4163A) || (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4170A) -#define FEATURE_EXP_HEADER_USART3 -#endif - -#if (EMBER_AF_BOARD_TYPE == BRD4100A) || (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4103A) || \ - (EMBER_AF_BOARD_TYPE == BRD4104A) || (EMBER_AF_BOARD_TYPE == BRD4105A) || (EMBER_AF_BOARD_TYPE == BRD4150A) || \ - (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4150C) || (EMBER_AF_BOARD_TYPE == BRD4151A) || \ - (EMBER_AF_BOARD_TYPE == BRD4153A) || (EMBER_AF_BOARD_TYPE == BRD4158A) || (EMBER_AF_BOARD_TYPE == BRD4159A) || \ - (EMBER_AF_BOARD_TYPE == BRD4160A) || (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) || \ - (EMBER_AF_BOARD_TYPE == BRD4163A) || (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) || \ - (EMBER_AF_BOARD_TYPE == BRD4166A) || (EMBER_AF_BOARD_TYPE == BRD4167A) || (EMBER_AF_BOARD_TYPE == BRD4168A) || \ - (EMBER_AF_BOARD_TYPE == BRD4169A) || (EMBER_AF_BOARD_TYPE == BRD4169B) || (EMBER_AF_BOARD_TYPE == BRD4170A) || \ - (EMBER_AF_BOARD_TYPE == BRD4171A) || (EMBER_AF_BOARD_TYPE == BRD4172A) || (EMBER_AF_BOARD_TYPE == BRD4172B) || \ - (EMBER_AF_BOARD_TYPE == BRD4173A) || (EMBER_AF_BOARD_TYPE == BRD4174A) || (EMBER_AF_BOARD_TYPE == BRD4174B) || \ - (EMBER_AF_BOARD_TYPE == BRD4175A) || (EMBER_AF_BOARD_TYPE == BRD4179B) || (EMBER_AF_BOARD_TYPE == BRD4180A) || \ - (EMBER_AF_BOARD_TYPE == BRD4180B) || (EMBER_AF_BOARD_TYPE == BRD4181A) || (EMBER_AF_BOARD_TYPE == BRD4181B) || \ - (EMBER_AF_BOARD_TYPE == BRD4182A) || (EMBER_AF_BOARD_TYPE == BRD4183A) || (EMBER_AF_BOARD_TYPE == BRD4184A) || \ - (EMBER_AF_BOARD_TYPE == BRD4300A) || (EMBER_AF_BOARD_TYPE == BRD4301A) || (EMBER_AF_BOARD_TYPE == BRD4302A) || \ - (EMBER_AF_BOARD_TYPE == BRD4303A) || (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) || \ - (EMBER_AF_BOARD_TYPE == BRD4305C) || (EMBER_AF_BOARD_TYPE == BRD4305D) || (EMBER_AF_BOARD_TYPE == BRD4305E) || \ - (EMBER_AF_BOARD_TYPE == BRD4306A) || (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306C) || \ - (EMBER_AF_BOARD_TYPE == BRD4306D) || (EMBER_AF_BOARD_TYPE == BRD4308A) || (EMBER_AF_BOARD_TYPE == BRD4308B) || \ - (EMBER_AF_BOARD_TYPE == BRD4309A) || (EMBER_AF_BOARD_TYPE == BRD4310A) || (EMBER_AF_BOARD_TYPE == BRD4311A) -#define FEATURE_PTI_SUPPORT -#endif - -#if (EMBER_AF_BOARD_TYPE == BRD4100A) || (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4103A) || \ - (EMBER_AF_BOARD_TYPE == BRD4104A) || (EMBER_AF_BOARD_TYPE == BRD4105A) || (EMBER_AF_BOARD_TYPE == BRD4150A) || \ - (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4150C) || (EMBER_AF_BOARD_TYPE == BRD4151A) || \ - (EMBER_AF_BOARD_TYPE == BRD4153A) || (EMBER_AF_BOARD_TYPE == BRD4158A) || (EMBER_AF_BOARD_TYPE == BRD4159A) || \ - (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) || (EMBER_AF_BOARD_TYPE == BRD4163A) || \ - (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) || (EMBER_AF_BOARD_TYPE == BRD4167A) || \ - (EMBER_AF_BOARD_TYPE == BRD4168A) || (EMBER_AF_BOARD_TYPE == BRD4169A) || (EMBER_AF_BOARD_TYPE == BRD4169B) || \ - (EMBER_AF_BOARD_TYPE == BRD4170A) || (EMBER_AF_BOARD_TYPE == BRD4172A) || (EMBER_AF_BOARD_TYPE == BRD4172B) || \ - (EMBER_AF_BOARD_TYPE == BRD4173A) || (EMBER_AF_BOARD_TYPE == BRD4174A) || (EMBER_AF_BOARD_TYPE == BRD4174B) || \ - (EMBER_AF_BOARD_TYPE == BRD4175A) || (EMBER_AF_BOARD_TYPE == BRD4179B) || (EMBER_AF_BOARD_TYPE == BRD4180A) || \ - (EMBER_AF_BOARD_TYPE == BRD4180B) || (EMBER_AF_BOARD_TYPE == BRD4181A) || (EMBER_AF_BOARD_TYPE == BRD4181B) || \ - (EMBER_AF_BOARD_TYPE == BRD4182A) || (EMBER_AF_BOARD_TYPE == BRD4183A) || (EMBER_AF_BOARD_TYPE == BRD4300A) || \ - (EMBER_AF_BOARD_TYPE == BRD4301A) || (EMBER_AF_BOARD_TYPE == BRD4302A) || (EMBER_AF_BOARD_TYPE == BRD4303A) || \ - (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) || (EMBER_AF_BOARD_TYPE == BRD4305C) || \ - (EMBER_AF_BOARD_TYPE == BRD4305D) || (EMBER_AF_BOARD_TYPE == BRD4305E) || (EMBER_AF_BOARD_TYPE == BRD4306A) || \ - (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306C) || (EMBER_AF_BOARD_TYPE == BRD4306D) || \ - (EMBER_AF_BOARD_TYPE == BRD4308A) || (EMBER_AF_BOARD_TYPE == BRD4308B) || (EMBER_AF_BOARD_TYPE == BRD4309A) || \ - (EMBER_AF_BOARD_TYPE == BRD4310A) || (EMBER_AF_BOARD_TYPE == BRD4311A) -#define FEATURE_HW_FLOW_CONTROL -#endif - -#if (EMBER_AF_BOARD_TYPE == BRD4100A) || (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4103A) || \ - (EMBER_AF_BOARD_TYPE == BRD4104A) || (EMBER_AF_BOARD_TYPE == BRD4105A) || (EMBER_AF_BOARD_TYPE == BRD4150A) || \ - (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4150C) || (EMBER_AF_BOARD_TYPE == BRD4151A) || \ - (EMBER_AF_BOARD_TYPE == BRD4153A) || (EMBER_AF_BOARD_TYPE == BRD4158A) || (EMBER_AF_BOARD_TYPE == BRD4159A) || \ - (EMBER_AF_BOARD_TYPE == BRD4160A) || (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) || \ - (EMBER_AF_BOARD_TYPE == BRD4163A) || (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) || \ - (EMBER_AF_BOARD_TYPE == BRD4166A) || (EMBER_AF_BOARD_TYPE == BRD4167A) || (EMBER_AF_BOARD_TYPE == BRD4168A) || \ - (EMBER_AF_BOARD_TYPE == BRD4169A) || (EMBER_AF_BOARD_TYPE == BRD4169B) || (EMBER_AF_BOARD_TYPE == BRD4170A) || \ - (EMBER_AF_BOARD_TYPE == BRD4171A) || (EMBER_AF_BOARD_TYPE == BRD4172A) || (EMBER_AF_BOARD_TYPE == BRD4172B) || \ - (EMBER_AF_BOARD_TYPE == BRD4173A) || (EMBER_AF_BOARD_TYPE == BRD4174A) || (EMBER_AF_BOARD_TYPE == BRD4174B) || \ - (EMBER_AF_BOARD_TYPE == BRD4175A) || (EMBER_AF_BOARD_TYPE == BRD4182A) || (EMBER_AF_BOARD_TYPE == BRD4184A) || \ - (EMBER_AF_BOARD_TYPE == BRD4300A) || (EMBER_AF_BOARD_TYPE == BRD4301A) || (EMBER_AF_BOARD_TYPE == BRD4302A) || \ - (EMBER_AF_BOARD_TYPE == BRD4303A) || (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) || \ - (EMBER_AF_BOARD_TYPE == BRD4305C) || (EMBER_AF_BOARD_TYPE == BRD4305D) || (EMBER_AF_BOARD_TYPE == BRD4305E) || \ - (EMBER_AF_BOARD_TYPE == BRD4306A) || (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306C) || \ - (EMBER_AF_BOARD_TYPE == BRD4306D) || (EMBER_AF_BOARD_TYPE == BRD4310A) || (EMBER_AF_BOARD_TYPE == BRD4311A) -#define FEATURE_I2C_SENSOR -#endif - -#if (EMBER_AF_BOARD_TYPE == BRD4100A) || (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4103A) || \ - (EMBER_AF_BOARD_TYPE == BRD4104A) || (EMBER_AF_BOARD_TYPE == BRD4105A) || (EMBER_AF_BOARD_TYPE == BRD4150A) || \ - (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4150C) || (EMBER_AF_BOARD_TYPE == BRD4151A) || \ - (EMBER_AF_BOARD_TYPE == BRD4153A) || (EMBER_AF_BOARD_TYPE == BRD4158A) || (EMBER_AF_BOARD_TYPE == BRD4159A) || \ - (EMBER_AF_BOARD_TYPE == BRD4160A) || (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) || \ - (EMBER_AF_BOARD_TYPE == BRD4163A) || (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) || \ - (EMBER_AF_BOARD_TYPE == BRD4166A) || (EMBER_AF_BOARD_TYPE == BRD4167A) || (EMBER_AF_BOARD_TYPE == BRD4168A) || \ - (EMBER_AF_BOARD_TYPE == BRD4169A) || (EMBER_AF_BOARD_TYPE == BRD4169B) || (EMBER_AF_BOARD_TYPE == BRD4170A) || \ - (EMBER_AF_BOARD_TYPE == BRD4172A) || (EMBER_AF_BOARD_TYPE == BRD4172B) || (EMBER_AF_BOARD_TYPE == BRD4173A) || \ - (EMBER_AF_BOARD_TYPE == BRD4174A) || (EMBER_AF_BOARD_TYPE == BRD4174B) || (EMBER_AF_BOARD_TYPE == BRD4175A) || \ - (EMBER_AF_BOARD_TYPE == BRD4179B) || (EMBER_AF_BOARD_TYPE == BRD4180A) || (EMBER_AF_BOARD_TYPE == BRD4180B) || \ - (EMBER_AF_BOARD_TYPE == BRD4181A) || (EMBER_AF_BOARD_TYPE == BRD4181B) || (EMBER_AF_BOARD_TYPE == BRD4182A) || \ - (EMBER_AF_BOARD_TYPE == BRD4183A) || (EMBER_AF_BOARD_TYPE == BRD4184A) || (EMBER_AF_BOARD_TYPE == BRD4300A) || \ - (EMBER_AF_BOARD_TYPE == BRD4301A) || (EMBER_AF_BOARD_TYPE == BRD4302A) || (EMBER_AF_BOARD_TYPE == BRD4303A) || \ - (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) || (EMBER_AF_BOARD_TYPE == BRD4305C) || \ - (EMBER_AF_BOARD_TYPE == BRD4305D) || (EMBER_AF_BOARD_TYPE == BRD4305E) || (EMBER_AF_BOARD_TYPE == BRD4306A) || \ - (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306C) || (EMBER_AF_BOARD_TYPE == BRD4306D) || \ - (EMBER_AF_BOARD_TYPE == BRD4308A) || (EMBER_AF_BOARD_TYPE == BRD4308B) || (EMBER_AF_BOARD_TYPE == BRD4310A) -#define FEATURE_LFXO -#endif - -#if (EMBER_AF_BOARD_TYPE == BRD4179B) -#define FEATURE_EFP -#endif - -#if (EMBER_AF_BOARD_TYPE == BRD4100A) || (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4103A) || \ - (EMBER_AF_BOARD_TYPE == BRD4104A) || (EMBER_AF_BOARD_TYPE == BRD4105A) || (EMBER_AF_BOARD_TYPE == BRD4150A) || \ - (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4150C) || (EMBER_AF_BOARD_TYPE == BRD4151A) || \ - (EMBER_AF_BOARD_TYPE == BRD4153A) || (EMBER_AF_BOARD_TYPE == BRD4158A) || (EMBER_AF_BOARD_TYPE == BRD4159A) || \ - (EMBER_AF_BOARD_TYPE == BRD4160A) || (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) || \ - (EMBER_AF_BOARD_TYPE == BRD4163A) || (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) || \ - (EMBER_AF_BOARD_TYPE == BRD4166A) || (EMBER_AF_BOARD_TYPE == BRD4167A) || (EMBER_AF_BOARD_TYPE == BRD4168A) || \ - (EMBER_AF_BOARD_TYPE == BRD4169A) || (EMBER_AF_BOARD_TYPE == BRD4169B) || (EMBER_AF_BOARD_TYPE == BRD4170A) || \ - (EMBER_AF_BOARD_TYPE == BRD4171A) || (EMBER_AF_BOARD_TYPE == BRD4172A) || (EMBER_AF_BOARD_TYPE == BRD4172B) || \ - (EMBER_AF_BOARD_TYPE == BRD4173A) || (EMBER_AF_BOARD_TYPE == BRD4174A) || (EMBER_AF_BOARD_TYPE == BRD4174B) || \ - (EMBER_AF_BOARD_TYPE == BRD4175A) || (EMBER_AF_BOARD_TYPE == BRD4179B) || (EMBER_AF_BOARD_TYPE == BRD4180A) || \ - (EMBER_AF_BOARD_TYPE == BRD4180B) || (EMBER_AF_BOARD_TYPE == BRD4181A) || (EMBER_AF_BOARD_TYPE == BRD4181B) || \ - (EMBER_AF_BOARD_TYPE == BRD4182A) || (EMBER_AF_BOARD_TYPE == BRD4183A) || (EMBER_AF_BOARD_TYPE == BRD4184A) || \ - (EMBER_AF_BOARD_TYPE == BRD4300A) || (EMBER_AF_BOARD_TYPE == BRD4301A) || (EMBER_AF_BOARD_TYPE == BRD4302A) || \ - (EMBER_AF_BOARD_TYPE == BRD4303A) || (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) || \ - (EMBER_AF_BOARD_TYPE == BRD4305C) || (EMBER_AF_BOARD_TYPE == BRD4305D) || (EMBER_AF_BOARD_TYPE == BRD4305E) || \ - (EMBER_AF_BOARD_TYPE == BRD4306A) || (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306C) || \ - (EMBER_AF_BOARD_TYPE == BRD4306D) || (EMBER_AF_BOARD_TYPE == BRD4308A) || (EMBER_AF_BOARD_TYPE == BRD4308B) || \ - (EMBER_AF_BOARD_TYPE == BRD4309A) || (EMBER_AF_BOARD_TYPE == BRD4310A) || (EMBER_AF_BOARD_TYPE == BRD4311A) || \ - (EMBER_AF_BOARD_TYPE == RD_0057_0101) -#define FEATURE_BOARD_DETECTED -#endif - -#if (EMBER_AF_BOARD_TYPE == CUSTOM_BOARD) -// Uncomment the corresponding line in case of using Silicon Labs board feature in your design. -// For using the selected feature you may need additional drivers. Check an appropriate SDK example for reference. - -// #define FEATURE_LCD_SUPPORT -// #define FEATURE_LED_BUTTON_ON_SAME_PIN -// #define FEATURE_SPI_FLASH -// #define FEATURE_IOEXPANDER -// #define FEATURE_PA_INPUT_FROM_VBAT -// #define FEATURE_EXP_HEADER_USART1 -// #define FEATURE_EXP_HEADER_USART3 -// #define FEATURE_PTI_SUPPORT -// #define FEATURE_HW_FLOW_CONTROL -// #define FEATURE_I2C_SENSOR -// #define FEATURE_LFXO -// #define FEATURE_EFP -// #define FEATURE_BOARD_DETECTED -#endif diff --git a/examples/lock-app/efr32/include/hal-config-app-common.h b/examples/lock-app/efr32/include/hal-config-app-common.h deleted file mode 100644 index b19a61575b89e2..00000000000000 --- a/examples/lock-app/efr32/include/hal-config-app-common.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * All rights reserved. - * - * 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. - */ -/****************************************************************************** - * @file - * @brief hal-config-app-common.h - ******************************************************************************* - * # License - * Copyright 2018 Silicon Laboratories Inc. www.silabs.com - ******************************************************************************* - * - * The licensor of this software is Silicon Laboratories Inc. Your use of this - * software is governed by the terms of Silicon Labs Master Software License - * Agreement (MSLA) available at - * www.silabs.com/about-us/legal/master-software-license-agreement. This - * software is distributed to you in Source Code format and is governed by the - * sections of the MSLA applicable to Source Code. - * - ******************************************************************************/ - -#pragma once - -#include "em_device.h" -#include "hal-config-types.h" - -#if defined(FEATURE_IOEXPANDER) -#include "hal-config-ioexp.h" -#endif - -#define HAL_EXTFLASH_FREQUENCY (1000000) - -#define HAL_PTI_ENABLE (1) -#define HAL_PTI_MODE (HAL_PTI_MODE_UART) -#define HAL_PTI_BAUD_RATE (1600000) - -#define HAL_PA_RAMP (10) -#define HAL_PA_2P4_LOWPOWER (0) -#define HAL_PA_POWER (252) -#define HAL_PA_CURVE_HEADER "pa_curves_efr32.h" - -#define HAL_PA_VOLTAGE BSP_PA_VOLTAGE - -// Select antenna path on EFR32xG2x devices: -// - RF2G2_IO1: 0 -// - RF2G2_IO2: 1 -#define GECKO_RF_ANTENNA 1 -#if defined(FEATURE_EXP_HEADER_USART3) - -#define BSP_EXP_USART USART3 - -#define BSP_EXP_USART_CTS_PIN BSP_USART3_CTS_PIN -#define BSP_EXP_USART_CTS_PORT BSP_USART3_CTS_PORT -#define BSP_EXP_USART_CTS_LOC BSP_USART3_CTS_LOC - -#define BSP_EXP_USART_RTS_PIN BSP_USART3_RTS_PIN -#define BSP_EXP_USART_RTS_PORT BSP_USART3_RTS_PORT -#define BSP_EXP_USART_RTS_LOC BSP_USART3_RTS_LOC - -#define BSP_EXP_USART_RX_PIN BSP_USART3_RX_PIN -#define BSP_EXP_USART_RX_PORT BSP_USART3_RX_PORT -#define BSP_EXP_USART_RX_LOC BSP_USART3_RX_LOC - -#define BSP_EXP_USART_TX_PIN BSP_USART3_TX_PIN -#define BSP_EXP_USART_TX_PORT BSP_USART3_TX_PORT -#define BSP_EXP_USART_TX_LOC BSP_USART3_TX_LOC - -#elif defined(FEATURE_EXP_HEADER_USART1) - -#define BSP_EXP_USART USART1 - -#define BSP_EXP_USART_CTS_PIN BSP_USART1_CTS_PIN -#define BSP_EXP_USART_CTS_PORT BSP_USART1_CTS_PORT -#define BSP_EXP_USART_CTS_LOC BSP_USART1_CTS_LOC - -#define BSP_EXP_USART_RTS_PIN BSP_USART1_RTS_PIN -#define BSP_EXP_USART_RTS_PORT BSP_USART1_RTS_PORT -#define BSP_EXP_USART_RTS_LOC BSP_USART1_RTS_LOC - -#define BSP_EXP_USART_RX_PIN BSP_USART1_RX_PIN -#define BSP_EXP_USART_RX_PORT BSP_USART1_RX_PORT -#define BSP_EXP_USART_RX_LOC BSP_USART1_RX_LOC - -#define BSP_EXP_USART_TX_PIN BSP_USART1_TX_PIN -#define BSP_EXP_USART_TX_PORT BSP_USART1_TX_PORT -#define BSP_EXP_USART_TX_LOC BSP_USART1_TX_LOC - -#else - -#define BSP_EXP_USART USART0 - -#define BSP_EXP_USART_CTS_PIN BSP_USART0_CTS_PIN -#define BSP_EXP_USART_CTS_PORT BSP_USART0_CTS_PORT -#define BSP_EXP_USART_CTS_LOC BSP_USART0_CTS_LOC - -#define BSP_EXP_USART_RTS_PIN BSP_USART0_RTS_PIN -#define BSP_EXP_USART_RTS_PORT BSP_USART0_RTS_PORT -#define BSP_EXP_USART_RTS_LOC BSP_USART0_RTS_LOC - -#define BSP_EXP_USART_RX_PIN BSP_USART0_RX_PIN -#define BSP_EXP_USART_RX_PORT BSP_USART0_RX_PORT -#define BSP_EXP_USART_RX_LOC BSP_USART0_RX_LOC - -#define BSP_EXP_USART_TX_PIN BSP_USART0_TX_PIN -#define BSP_EXP_USART_TX_PORT BSP_USART0_TX_PORT -#define BSP_EXP_USART_TX_LOC BSP_USART0_TX_LOC - -#endif // FEATURE_EXP_HEADER_USART3 diff --git a/examples/lock-app/efr32/with_pw_rpc.gni b/examples/lock-app/efr32/with_pw_rpc.gni new file mode 100644 index 00000000000000..7c08d68a6bbd33 --- /dev/null +++ b/examples/lock-app/efr32/with_pw_rpc.gni @@ -0,0 +1,29 @@ +# 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. + +# add this gni as import in your build args to use pigweed in the example +# 'import("//with_pw_rpc.gni")' +# *WIP* pigweed is not fully integrated in this EFR example yet + +import("//build_overrides/chip.gni") +import("${chip_root}/config/efr32/lib/pw_rpc/pw_rpc.gni") +import("${chip_root}/examples/platform/efr32/args.gni") + +efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") + +declare_args() { + chip_build_pw_rpc_lib = true +} + +default_configs_std = [ "${chip_root}/config/efr32/lib/pw_rpc:std_cpp17" ] diff --git a/examples/persistent-storage/efr32/BUILD.gn b/examples/persistent-storage/efr32/BUILD.gn index 670588f3e995b4..e68f8915bb051b 100644 --- a/examples/persistent-storage/efr32/BUILD.gn +++ b/examples/persistent-storage/efr32/BUILD.gn @@ -32,13 +32,13 @@ efr32_sdk("sdk") { "${chip_root}/src/platform/EFR32", "${efr32_project_dir}/include", "${efr32_project_dir}/src", + "${examples_plat_dir}", "${examples_plat_dir}/${efr32_family}/${efr32_board}", ] sources = [ "${efr32_project_dir}/include/CHIPProjectConfig.h", "${efr32_project_dir}/include/FreeRTOSConfig.h", - "${examples_plat_dir}/${efr32_family}/${efr32_board}/hal-config.h", ] defines = [ @@ -71,11 +71,11 @@ efr32_executable("persistent_storage") { "${efr32_project_dir}/include", "${chip_root}/src/app/util", "${examples_plat_dir}", + "${examples_plat_dir}/${efr32_family}/${efr32_board}", ] sources = [ "${efr32_project_dir}/../KeyValueStorageTest.cpp", - "${examples_plat_dir}/${efr32_family}/${efr32_board}/hal-config.h", "${examples_plat_dir}/${efr32_family}/${efr32_board}/init_board.c", "${examples_plat_dir}/${efr32_family}/${efr32_board}/init_mcu.c", "main.cpp", diff --git a/examples/persistent-storage/efr32/args.gni b/examples/persistent-storage/efr32/args.gni index 5d92170adab614..8b257629c29a2b 100644 --- a/examples/persistent-storage/efr32/args.gni +++ b/examples/persistent-storage/efr32/args.gni @@ -17,3 +17,6 @@ import("//build_overrides/pigweed.gni") import("${chip_root}/examples/platform/efr32/args.gni") 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" diff --git a/examples/persistent-storage/efr32/include/board_features.h b/examples/persistent-storage/efr32/include/board_features.h deleted file mode 100644 index e1ccb846160ada..00000000000000 --- a/examples/persistent-storage/efr32/include/board_features.h +++ /dev/null @@ -1,249 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * All rights reserved. - * - * 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. - */ -/******************************************************************************* - * @file - * @brief board_features.h - ******************************************************************************* - * # License - * Copyright 2018 Silicon Laboratories Inc. www.silabs.com - ******************************************************************************* - * - * The licensor of this software is Silicon Laboratories Inc. Your use of this - * software is governed by the terms of Silicon Labs Master Software License - * Agreement (MSLA) available at - * www.silabs.com/about-us/legal/master-software-license-agreement. This - * software is distributed to you in Source Code format and is governed by the - * sections of the MSLA applicable to Source Code. - * - ******************************************************************************/ - -#pragma once - -// Top level macros -#define SILABS_AF_DEVICE_NAME "lighting-example" - -// Generated plugin macros - -#ifdef EMBER_AF_BOARD_TYPE -#undef EMBER_AF_BOARD_TYPE -#endif -#define EMBER_AF_BOARD_TYPE BOARD_ID - -/* Indicate if LCD is supported */ -#if (EMBER_AF_BOARD_TYPE == BRD4100A) || (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4103A) || \ - (EMBER_AF_BOARD_TYPE == BRD4104A) || (EMBER_AF_BOARD_TYPE == BRD4105A) || (EMBER_AF_BOARD_TYPE == BRD4150A) || \ - (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4150C) || (EMBER_AF_BOARD_TYPE == BRD4151A) || \ - (EMBER_AF_BOARD_TYPE == BRD4153A) || (EMBER_AF_BOARD_TYPE == BRD4158A) || (EMBER_AF_BOARD_TYPE == BRD4159A) || \ - (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) || (EMBER_AF_BOARD_TYPE == BRD4163A) || \ - (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) || (EMBER_AF_BOARD_TYPE == BRD4167A) || \ - (EMBER_AF_BOARD_TYPE == BRD4168A) || (EMBER_AF_BOARD_TYPE == BRD4169A) || (EMBER_AF_BOARD_TYPE == BRD4169B) || \ - (EMBER_AF_BOARD_TYPE == BRD4170A) || (EMBER_AF_BOARD_TYPE == BRD4171A) || (EMBER_AF_BOARD_TYPE == BRD4172A) || \ - (EMBER_AF_BOARD_TYPE == BRD4172B) || (EMBER_AF_BOARD_TYPE == BRD4173A) || (EMBER_AF_BOARD_TYPE == BRD4174A) || \ - (EMBER_AF_BOARD_TYPE == BRD4174B) || (EMBER_AF_BOARD_TYPE == BRD4175A) || (EMBER_AF_BOARD_TYPE == BRD4180A) || \ - (EMBER_AF_BOARD_TYPE == BRD4180B) || (EMBER_AF_BOARD_TYPE == BRD4181A) || (EMBER_AF_BOARD_TYPE == BRD4181B) || \ - (EMBER_AF_BOARD_TYPE == BRD4182A) || (EMBER_AF_BOARD_TYPE == BRD4300A) || (EMBER_AF_BOARD_TYPE == BRD4302A) || \ - (EMBER_AF_BOARD_TYPE == BRD4303A) || (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) || \ - (EMBER_AF_BOARD_TYPE == BRD4305C) || (EMBER_AF_BOARD_TYPE == BRD4305D) || (EMBER_AF_BOARD_TYPE == BRD4305E) || \ - (EMBER_AF_BOARD_TYPE == BRD4306A) || (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306C) || \ - (EMBER_AF_BOARD_TYPE == BRD4306D) || (EMBER_AF_BOARD_TYPE == BRD4308A) || (EMBER_AF_BOARD_TYPE == BRD4308B) || \ - (EMBER_AF_BOARD_TYPE == BRD4310A) || (EMBER_AF_BOARD_TYPE == BRD4311A) -#define FEATURE_LCD_SUPPORT -#endif - -/* Indicate if the same pins are used for LEDs and Buttons on the WSTK */ -#if (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4300A) || (EMBER_AF_BOARD_TYPE == BRD4301A) || \ - (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4306A) || (EMBER_AF_BOARD_TYPE == BRD4306B) || \ - (EMBER_AF_BOARD_TYPE == BRD4306C) || (EMBER_AF_BOARD_TYPE == BRD4306D) || (EMBER_AF_BOARD_TYPE == BRD4308A) || \ - (EMBER_AF_BOARD_TYPE == BRD4308B) || (EMBER_AF_BOARD_TYPE == BRD4309A) || (EMBER_AF_BOARD_TYPE == BRD4310A) || \ - (EMBER_AF_BOARD_TYPE == BRD4311A) -#define FEATURE_LED_BUTTON_ON_SAME_PIN -#endif - -#if (EMBER_AF_BOARD_TYPE == BRD4100A) || (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4103A) || \ - (EMBER_AF_BOARD_TYPE == BRD4104A) || (EMBER_AF_BOARD_TYPE == BRD4105A) || (EMBER_AF_BOARD_TYPE == BRD4150A) || \ - (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4150C) || (EMBER_AF_BOARD_TYPE == BRD4151A) || \ - (EMBER_AF_BOARD_TYPE == BRD4153A) || (EMBER_AF_BOARD_TYPE == BRD4158A) || (EMBER_AF_BOARD_TYPE == BRD4159A) || \ - (EMBER_AF_BOARD_TYPE == BRD4160A) || (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) || \ - (EMBER_AF_BOARD_TYPE == BRD4163A) || (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) || \ - (EMBER_AF_BOARD_TYPE == BRD4166A) || (EMBER_AF_BOARD_TYPE == BRD4167A) || (EMBER_AF_BOARD_TYPE == BRD4168A) || \ - (EMBER_AF_BOARD_TYPE == BRD4169A) || (EMBER_AF_BOARD_TYPE == BRD4169B) || (EMBER_AF_BOARD_TYPE == BRD4170A) || \ - (EMBER_AF_BOARD_TYPE == BRD4171A) || (EMBER_AF_BOARD_TYPE == BRD4172A) || (EMBER_AF_BOARD_TYPE == BRD4172B) || \ - (EMBER_AF_BOARD_TYPE == BRD4173A) || (EMBER_AF_BOARD_TYPE == BRD4174A) || (EMBER_AF_BOARD_TYPE == BRD4174B) || \ - (EMBER_AF_BOARD_TYPE == BRD4175A) || (EMBER_AF_BOARD_TYPE == BRD4182A) || (EMBER_AF_BOARD_TYPE == BRD4183A) || \ - (EMBER_AF_BOARD_TYPE == BRD4184A) || (EMBER_AF_BOARD_TYPE == BRD4301A) || (EMBER_AF_BOARD_TYPE == BRD4302A) || \ - (EMBER_AF_BOARD_TYPE == BRD4303A) || (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) || \ - (EMBER_AF_BOARD_TYPE == BRD4305C) || (EMBER_AF_BOARD_TYPE == BRD4305D) || (EMBER_AF_BOARD_TYPE == BRD4305E) || \ - (EMBER_AF_BOARD_TYPE == BRD4306A) || (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306C) || \ - (EMBER_AF_BOARD_TYPE == BRD4306D) || (EMBER_AF_BOARD_TYPE == BRD4310A) || (EMBER_AF_BOARD_TYPE == BRD4311A) -#define FEATURE_SPI_FLASH -#endif - -#if (EMBER_AF_BOARD_TYPE == BRD4101B) -#define FEATURE_IOEXPANDER -#endif - -#if (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4151A) || (EMBER_AF_BOARD_TYPE == BRD4158A) || \ - (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) || \ - (EMBER_AF_BOARD_TYPE == BRD4168A) || (EMBER_AF_BOARD_TYPE == BRD4169B) || (EMBER_AF_BOARD_TYPE == BRD4170A) || \ - (EMBER_AF_BOARD_TYPE == BRD4171A) || (EMBER_AF_BOARD_TYPE == BRD4172A) || (EMBER_AF_BOARD_TYPE == BRD4172B) || \ - (EMBER_AF_BOARD_TYPE == BRD4174A) || (EMBER_AF_BOARD_TYPE == BRD4174B) || (EMBER_AF_BOARD_TYPE == BRD4180A) || \ - (EMBER_AF_BOARD_TYPE == BRD4180B) || (EMBER_AF_BOARD_TYPE == BRD4181A) || (EMBER_AF_BOARD_TYPE == BRD4181B) || \ - (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) || (EMBER_AF_BOARD_TYPE == BRD4305E) || \ - (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306D) || (EMBER_AF_BOARD_TYPE == BRD4308A) || \ - (EMBER_AF_BOARD_TYPE == BRD4308B) || (EMBER_AF_BOARD_TYPE == BRD4309A) -#define FEATURE_PA_INPUT_FROM_VBAT -#endif - -#if (EMBER_AF_BOARD_TYPE == BRD4182A) || (EMBER_AF_BOARD_TYPE == BRD4183A) || (EMBER_AF_BOARD_TYPE == BRD4184A) || \ - (EMBER_AF_BOARD_TYPE == BRD4310A) || (EMBER_AF_BOARD_TYPE == BRD4311A) -#define FEATURE_EXP_HEADER_USART1 -#endif - -#if (EMBER_AF_BOARD_TYPE == BRD4103A) || (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) || \ - (EMBER_AF_BOARD_TYPE == BRD4163A) || (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4170A) -#define FEATURE_EXP_HEADER_USART3 -#endif - -#if (EMBER_AF_BOARD_TYPE == BRD4100A) || (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4103A) || \ - (EMBER_AF_BOARD_TYPE == BRD4104A) || (EMBER_AF_BOARD_TYPE == BRD4105A) || (EMBER_AF_BOARD_TYPE == BRD4150A) || \ - (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4150C) || (EMBER_AF_BOARD_TYPE == BRD4151A) || \ - (EMBER_AF_BOARD_TYPE == BRD4153A) || (EMBER_AF_BOARD_TYPE == BRD4158A) || (EMBER_AF_BOARD_TYPE == BRD4159A) || \ - (EMBER_AF_BOARD_TYPE == BRD4160A) || (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) || \ - (EMBER_AF_BOARD_TYPE == BRD4163A) || (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) || \ - (EMBER_AF_BOARD_TYPE == BRD4166A) || (EMBER_AF_BOARD_TYPE == BRD4167A) || (EMBER_AF_BOARD_TYPE == BRD4168A) || \ - (EMBER_AF_BOARD_TYPE == BRD4169A) || (EMBER_AF_BOARD_TYPE == BRD4169B) || (EMBER_AF_BOARD_TYPE == BRD4170A) || \ - (EMBER_AF_BOARD_TYPE == BRD4171A) || (EMBER_AF_BOARD_TYPE == BRD4172A) || (EMBER_AF_BOARD_TYPE == BRD4172B) || \ - (EMBER_AF_BOARD_TYPE == BRD4173A) || (EMBER_AF_BOARD_TYPE == BRD4174A) || (EMBER_AF_BOARD_TYPE == BRD4174B) || \ - (EMBER_AF_BOARD_TYPE == BRD4175A) || (EMBER_AF_BOARD_TYPE == BRD4179B) || (EMBER_AF_BOARD_TYPE == BRD4180A) || \ - (EMBER_AF_BOARD_TYPE == BRD4180B) || (EMBER_AF_BOARD_TYPE == BRD4181A) || (EMBER_AF_BOARD_TYPE == BRD4181B) || \ - (EMBER_AF_BOARD_TYPE == BRD4182A) || (EMBER_AF_BOARD_TYPE == BRD4183A) || (EMBER_AF_BOARD_TYPE == BRD4184A) || \ - (EMBER_AF_BOARD_TYPE == BRD4300A) || (EMBER_AF_BOARD_TYPE == BRD4301A) || (EMBER_AF_BOARD_TYPE == BRD4302A) || \ - (EMBER_AF_BOARD_TYPE == BRD4303A) || (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) || \ - (EMBER_AF_BOARD_TYPE == BRD4305C) || (EMBER_AF_BOARD_TYPE == BRD4305D) || (EMBER_AF_BOARD_TYPE == BRD4305E) || \ - (EMBER_AF_BOARD_TYPE == BRD4306A) || (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306C) || \ - (EMBER_AF_BOARD_TYPE == BRD4306D) || (EMBER_AF_BOARD_TYPE == BRD4308A) || (EMBER_AF_BOARD_TYPE == BRD4308B) || \ - (EMBER_AF_BOARD_TYPE == BRD4309A) || (EMBER_AF_BOARD_TYPE == BRD4310A) || (EMBER_AF_BOARD_TYPE == BRD4311A) -#define FEATURE_PTI_SUPPORT -#endif - -#if (EMBER_AF_BOARD_TYPE == BRD4100A) || (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4103A) || \ - (EMBER_AF_BOARD_TYPE == BRD4104A) || (EMBER_AF_BOARD_TYPE == BRD4105A) || (EMBER_AF_BOARD_TYPE == BRD4150A) || \ - (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4150C) || (EMBER_AF_BOARD_TYPE == BRD4151A) || \ - (EMBER_AF_BOARD_TYPE == BRD4153A) || (EMBER_AF_BOARD_TYPE == BRD4158A) || (EMBER_AF_BOARD_TYPE == BRD4159A) || \ - (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) || (EMBER_AF_BOARD_TYPE == BRD4163A) || \ - (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) || (EMBER_AF_BOARD_TYPE == BRD4167A) || \ - (EMBER_AF_BOARD_TYPE == BRD4168A) || (EMBER_AF_BOARD_TYPE == BRD4169A) || (EMBER_AF_BOARD_TYPE == BRD4169B) || \ - (EMBER_AF_BOARD_TYPE == BRD4170A) || (EMBER_AF_BOARD_TYPE == BRD4172A) || (EMBER_AF_BOARD_TYPE == BRD4172B) || \ - (EMBER_AF_BOARD_TYPE == BRD4173A) || (EMBER_AF_BOARD_TYPE == BRD4174A) || (EMBER_AF_BOARD_TYPE == BRD4174B) || \ - (EMBER_AF_BOARD_TYPE == BRD4175A) || (EMBER_AF_BOARD_TYPE == BRD4179B) || (EMBER_AF_BOARD_TYPE == BRD4180A) || \ - (EMBER_AF_BOARD_TYPE == BRD4180B) || (EMBER_AF_BOARD_TYPE == BRD4181A) || (EMBER_AF_BOARD_TYPE == BRD4181B) || \ - (EMBER_AF_BOARD_TYPE == BRD4182A) || (EMBER_AF_BOARD_TYPE == BRD4183A) || (EMBER_AF_BOARD_TYPE == BRD4300A) || \ - (EMBER_AF_BOARD_TYPE == BRD4301A) || (EMBER_AF_BOARD_TYPE == BRD4302A) || (EMBER_AF_BOARD_TYPE == BRD4303A) || \ - (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) || (EMBER_AF_BOARD_TYPE == BRD4305C) || \ - (EMBER_AF_BOARD_TYPE == BRD4305D) || (EMBER_AF_BOARD_TYPE == BRD4305E) || (EMBER_AF_BOARD_TYPE == BRD4306A) || \ - (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306C) || (EMBER_AF_BOARD_TYPE == BRD4306D) || \ - (EMBER_AF_BOARD_TYPE == BRD4308A) || (EMBER_AF_BOARD_TYPE == BRD4308B) || (EMBER_AF_BOARD_TYPE == BRD4309A) || \ - (EMBER_AF_BOARD_TYPE == BRD4310A) || (EMBER_AF_BOARD_TYPE == BRD4311A) -#define FEATURE_HW_FLOW_CONTROL -#endif - -#if (EMBER_AF_BOARD_TYPE == BRD4100A) || (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4103A) || \ - (EMBER_AF_BOARD_TYPE == BRD4104A) || (EMBER_AF_BOARD_TYPE == BRD4105A) || (EMBER_AF_BOARD_TYPE == BRD4150A) || \ - (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4150C) || (EMBER_AF_BOARD_TYPE == BRD4151A) || \ - (EMBER_AF_BOARD_TYPE == BRD4153A) || (EMBER_AF_BOARD_TYPE == BRD4158A) || (EMBER_AF_BOARD_TYPE == BRD4159A) || \ - (EMBER_AF_BOARD_TYPE == BRD4160A) || (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) || \ - (EMBER_AF_BOARD_TYPE == BRD4163A) || (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) || \ - (EMBER_AF_BOARD_TYPE == BRD4166A) || (EMBER_AF_BOARD_TYPE == BRD4167A) || (EMBER_AF_BOARD_TYPE == BRD4168A) || \ - (EMBER_AF_BOARD_TYPE == BRD4169A) || (EMBER_AF_BOARD_TYPE == BRD4169B) || (EMBER_AF_BOARD_TYPE == BRD4170A) || \ - (EMBER_AF_BOARD_TYPE == BRD4171A) || (EMBER_AF_BOARD_TYPE == BRD4172A) || (EMBER_AF_BOARD_TYPE == BRD4172B) || \ - (EMBER_AF_BOARD_TYPE == BRD4173A) || (EMBER_AF_BOARD_TYPE == BRD4174A) || (EMBER_AF_BOARD_TYPE == BRD4174B) || \ - (EMBER_AF_BOARD_TYPE == BRD4175A) || (EMBER_AF_BOARD_TYPE == BRD4182A) || (EMBER_AF_BOARD_TYPE == BRD4184A) || \ - (EMBER_AF_BOARD_TYPE == BRD4300A) || (EMBER_AF_BOARD_TYPE == BRD4301A) || (EMBER_AF_BOARD_TYPE == BRD4302A) || \ - (EMBER_AF_BOARD_TYPE == BRD4303A) || (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) || \ - (EMBER_AF_BOARD_TYPE == BRD4305C) || (EMBER_AF_BOARD_TYPE == BRD4305D) || (EMBER_AF_BOARD_TYPE == BRD4305E) || \ - (EMBER_AF_BOARD_TYPE == BRD4306A) || (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306C) || \ - (EMBER_AF_BOARD_TYPE == BRD4306D) || (EMBER_AF_BOARD_TYPE == BRD4310A) || (EMBER_AF_BOARD_TYPE == BRD4311A) -#define FEATURE_I2C_SENSOR -#endif - -#if (EMBER_AF_BOARD_TYPE == BRD4100A) || (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4103A) || \ - (EMBER_AF_BOARD_TYPE == BRD4104A) || (EMBER_AF_BOARD_TYPE == BRD4105A) || (EMBER_AF_BOARD_TYPE == BRD4150A) || \ - (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4150C) || (EMBER_AF_BOARD_TYPE == BRD4151A) || \ - (EMBER_AF_BOARD_TYPE == BRD4153A) || (EMBER_AF_BOARD_TYPE == BRD4158A) || (EMBER_AF_BOARD_TYPE == BRD4159A) || \ - (EMBER_AF_BOARD_TYPE == BRD4160A) || (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) || \ - (EMBER_AF_BOARD_TYPE == BRD4163A) || (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) || \ - (EMBER_AF_BOARD_TYPE == BRD4166A) || (EMBER_AF_BOARD_TYPE == BRD4167A) || (EMBER_AF_BOARD_TYPE == BRD4168A) || \ - (EMBER_AF_BOARD_TYPE == BRD4169A) || (EMBER_AF_BOARD_TYPE == BRD4169B) || (EMBER_AF_BOARD_TYPE == BRD4170A) || \ - (EMBER_AF_BOARD_TYPE == BRD4172A) || (EMBER_AF_BOARD_TYPE == BRD4172B) || (EMBER_AF_BOARD_TYPE == BRD4173A) || \ - (EMBER_AF_BOARD_TYPE == BRD4174A) || (EMBER_AF_BOARD_TYPE == BRD4174B) || (EMBER_AF_BOARD_TYPE == BRD4175A) || \ - (EMBER_AF_BOARD_TYPE == BRD4179B) || (EMBER_AF_BOARD_TYPE == BRD4180A) || (EMBER_AF_BOARD_TYPE == BRD4180B) || \ - (EMBER_AF_BOARD_TYPE == BRD4181A) || (EMBER_AF_BOARD_TYPE == BRD4181B) || (EMBER_AF_BOARD_TYPE == BRD4182A) || \ - (EMBER_AF_BOARD_TYPE == BRD4183A) || (EMBER_AF_BOARD_TYPE == BRD4184A) || (EMBER_AF_BOARD_TYPE == BRD4300A) || \ - (EMBER_AF_BOARD_TYPE == BRD4301A) || (EMBER_AF_BOARD_TYPE == BRD4302A) || (EMBER_AF_BOARD_TYPE == BRD4303A) || \ - (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) || (EMBER_AF_BOARD_TYPE == BRD4305C) || \ - (EMBER_AF_BOARD_TYPE == BRD4305D) || (EMBER_AF_BOARD_TYPE == BRD4305E) || (EMBER_AF_BOARD_TYPE == BRD4306A) || \ - (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306C) || (EMBER_AF_BOARD_TYPE == BRD4306D) || \ - (EMBER_AF_BOARD_TYPE == BRD4308A) || (EMBER_AF_BOARD_TYPE == BRD4308B) || (EMBER_AF_BOARD_TYPE == BRD4310A) -#define FEATURE_LFXO -#endif - -#if (EMBER_AF_BOARD_TYPE == BRD4179B) -#define FEATURE_EFP -#endif - -#if (EMBER_AF_BOARD_TYPE == BRD4100A) || (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4103A) || \ - (EMBER_AF_BOARD_TYPE == BRD4104A) || (EMBER_AF_BOARD_TYPE == BRD4105A) || (EMBER_AF_BOARD_TYPE == BRD4150A) || \ - (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4150C) || (EMBER_AF_BOARD_TYPE == BRD4151A) || \ - (EMBER_AF_BOARD_TYPE == BRD4153A) || (EMBER_AF_BOARD_TYPE == BRD4158A) || (EMBER_AF_BOARD_TYPE == BRD4159A) || \ - (EMBER_AF_BOARD_TYPE == BRD4160A) || (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) || \ - (EMBER_AF_BOARD_TYPE == BRD4163A) || (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) || \ - (EMBER_AF_BOARD_TYPE == BRD4166A) || (EMBER_AF_BOARD_TYPE == BRD4167A) || (EMBER_AF_BOARD_TYPE == BRD4168A) || \ - (EMBER_AF_BOARD_TYPE == BRD4169A) || (EMBER_AF_BOARD_TYPE == BRD4169B) || (EMBER_AF_BOARD_TYPE == BRD4170A) || \ - (EMBER_AF_BOARD_TYPE == BRD4171A) || (EMBER_AF_BOARD_TYPE == BRD4172A) || (EMBER_AF_BOARD_TYPE == BRD4172B) || \ - (EMBER_AF_BOARD_TYPE == BRD4173A) || (EMBER_AF_BOARD_TYPE == BRD4174A) || (EMBER_AF_BOARD_TYPE == BRD4174B) || \ - (EMBER_AF_BOARD_TYPE == BRD4175A) || (EMBER_AF_BOARD_TYPE == BRD4179B) || (EMBER_AF_BOARD_TYPE == BRD4180A) || \ - (EMBER_AF_BOARD_TYPE == BRD4180B) || (EMBER_AF_BOARD_TYPE == BRD4181A) || (EMBER_AF_BOARD_TYPE == BRD4181B) || \ - (EMBER_AF_BOARD_TYPE == BRD4182A) || (EMBER_AF_BOARD_TYPE == BRD4183A) || (EMBER_AF_BOARD_TYPE == BRD4184A) || \ - (EMBER_AF_BOARD_TYPE == BRD4300A) || (EMBER_AF_BOARD_TYPE == BRD4301A) || (EMBER_AF_BOARD_TYPE == BRD4302A) || \ - (EMBER_AF_BOARD_TYPE == BRD4303A) || (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) || \ - (EMBER_AF_BOARD_TYPE == BRD4305C) || (EMBER_AF_BOARD_TYPE == BRD4305D) || (EMBER_AF_BOARD_TYPE == BRD4305E) || \ - (EMBER_AF_BOARD_TYPE == BRD4306A) || (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306C) || \ - (EMBER_AF_BOARD_TYPE == BRD4306D) || (EMBER_AF_BOARD_TYPE == BRD4308A) || (EMBER_AF_BOARD_TYPE == BRD4308B) || \ - (EMBER_AF_BOARD_TYPE == BRD4309A) || (EMBER_AF_BOARD_TYPE == BRD4310A) || (EMBER_AF_BOARD_TYPE == BRD4311A) || \ - (EMBER_AF_BOARD_TYPE == RD_0057_0101) -#define FEATURE_BOARD_DETECTED -#endif - -#if (EMBER_AF_BOARD_TYPE == CUSTOM_BOARD) -// Uncomment the corresponding line in case of using Silicon Labs board feature in your design. -// For using the selected feature you may need additional drivers. Check an appropriate SDK example for reference. - -// #define FEATURE_LCD_SUPPORT -// #define FEATURE_LED_BUTTON_ON_SAME_PIN -// #define FEATURE_SPI_FLASH -// #define FEATURE_IOEXPANDER -// #define FEATURE_PA_INPUT_FROM_VBAT -// #define FEATURE_EXP_HEADER_USART1 -// #define FEATURE_EXP_HEADER_USART3 -// #define FEATURE_PTI_SUPPORT -// #define FEATURE_HW_FLOW_CONTROL -// #define FEATURE_I2C_SENSOR -// #define FEATURE_LFXO -// #define FEATURE_EFP -// #define FEATURE_BOARD_DETECTED -#endif diff --git a/examples/persistent-storage/efr32/include/hal-config-app-common.h b/examples/persistent-storage/efr32/include/hal-config-app-common.h deleted file mode 100644 index b19a61575b89e2..00000000000000 --- a/examples/persistent-storage/efr32/include/hal-config-app-common.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * All rights reserved. - * - * 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. - */ -/****************************************************************************** - * @file - * @brief hal-config-app-common.h - ******************************************************************************* - * # License - * Copyright 2018 Silicon Laboratories Inc. www.silabs.com - ******************************************************************************* - * - * The licensor of this software is Silicon Laboratories Inc. Your use of this - * software is governed by the terms of Silicon Labs Master Software License - * Agreement (MSLA) available at - * www.silabs.com/about-us/legal/master-software-license-agreement. This - * software is distributed to you in Source Code format and is governed by the - * sections of the MSLA applicable to Source Code. - * - ******************************************************************************/ - -#pragma once - -#include "em_device.h" -#include "hal-config-types.h" - -#if defined(FEATURE_IOEXPANDER) -#include "hal-config-ioexp.h" -#endif - -#define HAL_EXTFLASH_FREQUENCY (1000000) - -#define HAL_PTI_ENABLE (1) -#define HAL_PTI_MODE (HAL_PTI_MODE_UART) -#define HAL_PTI_BAUD_RATE (1600000) - -#define HAL_PA_RAMP (10) -#define HAL_PA_2P4_LOWPOWER (0) -#define HAL_PA_POWER (252) -#define HAL_PA_CURVE_HEADER "pa_curves_efr32.h" - -#define HAL_PA_VOLTAGE BSP_PA_VOLTAGE - -// Select antenna path on EFR32xG2x devices: -// - RF2G2_IO1: 0 -// - RF2G2_IO2: 1 -#define GECKO_RF_ANTENNA 1 -#if defined(FEATURE_EXP_HEADER_USART3) - -#define BSP_EXP_USART USART3 - -#define BSP_EXP_USART_CTS_PIN BSP_USART3_CTS_PIN -#define BSP_EXP_USART_CTS_PORT BSP_USART3_CTS_PORT -#define BSP_EXP_USART_CTS_LOC BSP_USART3_CTS_LOC - -#define BSP_EXP_USART_RTS_PIN BSP_USART3_RTS_PIN -#define BSP_EXP_USART_RTS_PORT BSP_USART3_RTS_PORT -#define BSP_EXP_USART_RTS_LOC BSP_USART3_RTS_LOC - -#define BSP_EXP_USART_RX_PIN BSP_USART3_RX_PIN -#define BSP_EXP_USART_RX_PORT BSP_USART3_RX_PORT -#define BSP_EXP_USART_RX_LOC BSP_USART3_RX_LOC - -#define BSP_EXP_USART_TX_PIN BSP_USART3_TX_PIN -#define BSP_EXP_USART_TX_PORT BSP_USART3_TX_PORT -#define BSP_EXP_USART_TX_LOC BSP_USART3_TX_LOC - -#elif defined(FEATURE_EXP_HEADER_USART1) - -#define BSP_EXP_USART USART1 - -#define BSP_EXP_USART_CTS_PIN BSP_USART1_CTS_PIN -#define BSP_EXP_USART_CTS_PORT BSP_USART1_CTS_PORT -#define BSP_EXP_USART_CTS_LOC BSP_USART1_CTS_LOC - -#define BSP_EXP_USART_RTS_PIN BSP_USART1_RTS_PIN -#define BSP_EXP_USART_RTS_PORT BSP_USART1_RTS_PORT -#define BSP_EXP_USART_RTS_LOC BSP_USART1_RTS_LOC - -#define BSP_EXP_USART_RX_PIN BSP_USART1_RX_PIN -#define BSP_EXP_USART_RX_PORT BSP_USART1_RX_PORT -#define BSP_EXP_USART_RX_LOC BSP_USART1_RX_LOC - -#define BSP_EXP_USART_TX_PIN BSP_USART1_TX_PIN -#define BSP_EXP_USART_TX_PORT BSP_USART1_TX_PORT -#define BSP_EXP_USART_TX_LOC BSP_USART1_TX_LOC - -#else - -#define BSP_EXP_USART USART0 - -#define BSP_EXP_USART_CTS_PIN BSP_USART0_CTS_PIN -#define BSP_EXP_USART_CTS_PORT BSP_USART0_CTS_PORT -#define BSP_EXP_USART_CTS_LOC BSP_USART0_CTS_LOC - -#define BSP_EXP_USART_RTS_PIN BSP_USART0_RTS_PIN -#define BSP_EXP_USART_RTS_PORT BSP_USART0_RTS_PORT -#define BSP_EXP_USART_RTS_LOC BSP_USART0_RTS_LOC - -#define BSP_EXP_USART_RX_PIN BSP_USART0_RX_PIN -#define BSP_EXP_USART_RX_PORT BSP_USART0_RX_PORT -#define BSP_EXP_USART_RX_LOC BSP_USART0_RX_LOC - -#define BSP_EXP_USART_TX_PIN BSP_USART0_TX_PIN -#define BSP_EXP_USART_TX_PORT BSP_USART0_TX_PORT -#define BSP_EXP_USART_TX_LOC BSP_USART0_TX_LOC - -#endif // FEATURE_EXP_HEADER_USART3 diff --git a/examples/persistent-storage/efr32/third_party/connectedhomeip b/examples/persistent-storage/efr32/third_party/connectedhomeip new file mode 120000 index 00000000000000..80527d5e8de354 --- /dev/null +++ b/examples/persistent-storage/efr32/third_party/connectedhomeip @@ -0,0 +1 @@ +../../../../../connectedhomeip \ No newline at end of file diff --git a/examples/persistent-storage/efr32/with_pw_rpc.gni b/examples/persistent-storage/efr32/with_pw_rpc.gni new file mode 100644 index 00000000000000..7c08d68a6bbd33 --- /dev/null +++ b/examples/persistent-storage/efr32/with_pw_rpc.gni @@ -0,0 +1,29 @@ +# 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. + +# add this gni as import in your build args to use pigweed in the example +# 'import("//with_pw_rpc.gni")' +# *WIP* pigweed is not fully integrated in this EFR example yet + +import("//build_overrides/chip.gni") +import("${chip_root}/config/efr32/lib/pw_rpc/pw_rpc.gni") +import("${chip_root}/examples/platform/efr32/args.gni") + +efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") + +declare_args() { + chip_build_pw_rpc_lib = true +} + +default_configs_std = [ "${chip_root}/config/efr32/lib/pw_rpc:std_cpp17" ] diff --git a/examples/pigweed-app/efr32/.gn b/examples/pigweed-app/efr32/.gn new file mode 100644 index 00000000000000..81cec9d11a421b --- /dev/null +++ b/examples/pigweed-app/efr32/.gn @@ -0,0 +1,28 @@ +# 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. + +import("//build_overrides/build.gni") + +# The location of the build configuration file. +buildconfig = "${build_root}/config/BUILDCONFIG.gn" + +# CHIP uses angle bracket includes. +check_system_includes = true + +default_args = { + target_cpu = "arm" + target_os = "freertos" + + import("//args.gni") +} diff --git a/examples/pigweed-app/efr32/BUILD.gn b/examples/pigweed-app/efr32/BUILD.gn new file mode 100644 index 00000000000000..4aed6ff4d79eae --- /dev/null +++ b/examples/pigweed-app/efr32/BUILD.gn @@ -0,0 +1,107 @@ +# 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. + +import("//build_overrides/build.gni") +import("//build_overrides/chip.gni") +import("//build_overrides/efr32_sdk.gni") +import("//build_overrides/pigweed.gni") +import("${build_root}/config/defaults.gni") + +import("${chip_root}/config/efr32/lib/pw_rpc/pw_rpc.gni") +import("${efr32_sdk_build_root}/efr32_executable.gni") +import("${efr32_sdk_build_root}/efr32_sdk.gni") + +assert(current_os == "freertos") + +efr32_project_dir = "${chip_root}/examples/pigweed-app/efr32" +examples_plat_dir = "${chip_root}/examples/platform/efr32" + +efr32_sdk("sdk") { + include_dirs = [ + "${chip_root}/src/platform/EFR32", + "${efr32_project_dir}/include", + "${examples_plat_dir}", + "${examples_plat_dir}/${efr32_family}/${efr32_board}", + ] + + defines = [] + if (is_debug) { + defines += [ "BUILD_RELEASE=0" ] + } else { + defines += [ "BUILD_RELEASE=1" ] + } + + defines += [ + "BOARD_ID=${efr32_board}", + "HAL_VCOM_ENABLE = 1", + "EFR32_LOG_ENABLED =1", + ] +} + +efr32_executable("pigweed_app") { + include_dirs = [] + defines = [] + output_name = "chip-efr32-pigweed-example.out" + + public_deps = [ + ":sdk", + "$dir_pw_assert", + "${chip_root}/config/efr32/lib/pw_rpc:pw_rpc", + "${chip_root}/examples/common/pigweed:system_rpc_server", + "${chip_root}/src/lib", + "${examples_plat_dir}/pw_sys_io:pw_sys_io_efr32", + ] + + include_dirs += [ + "include", + "${examples_plat_dir}", + "${examples_plat_dir}/${efr32_family}/${efr32_board}", + "${examples_plat_dir}/pw_sys_io/public", + "${dir_pigweed}/pw_sys_io/public", + "${dir_pigweed}/pw_span/public_overrides", + "${dir_pigweed}/pw_span/public", + "${dir_pigweed}/pw_polyfill/public", + "${dir_pigweed}/pw_polyfill/standard_library_public", + "${dir_pigweed}/pw_polyfill/public_overrides", + "${dir_pigweed}/pw_status/public", + "${dir_pigweed}/pw_preprocessor/public", + "${dir_pigweed}/pw_rpc/system_server/public", + ] + + sources = [ + "${examples_plat_dir}/${efr32_family}/${efr32_board}/init_board.c", + "${examples_plat_dir}/${efr32_family}/${efr32_board}/init_mcu.c", + "${examples_plat_dir}/LEDWidget.cpp", + "${examples_plat_dir}/uart.c", + "src/main.cpp", + ] + + output_dir = root_out_dir + + if (efr32_family == "efr32mg12") { + ldscript = "${efr32_project_dir}/ldscripts/efr32-pigweed-example-MG12P.ld" + } else if (efr32_family == "efr32mg21") { + ldscript = "${efr32_project_dir}/ldscripts/efr32-pigweed-example-MG21.ld" + } + + ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ] +} + +group("efr32") { + deps = [ ":pigweed_app" ] +} + +group("default") { + deps = [ ":efr32" ] +} diff --git a/examples/pigweed-app/efr32/README.md b/examples/pigweed-app/efr32/README.md new file mode 100644 index 00000000000000..b03167500e85fd --- /dev/null +++ b/examples/pigweed-app/efr32/README.md @@ -0,0 +1,125 @@ +# CHIP EFR32 Pigweed Example Application + +The EFR32 example demonstrates the usage of Pigweed module functionalities in an +application. + +The example is based on [CHIP](https://github.com/project-chip/connectedhomeip), +the [Pigweed](https://pigweed.googlesource.com/pigweed/pigweed) module, which is +a collection of libraries that provide different functionalities for embedded +systems, and the EFR32 platform. + +You can use this example as a training ground for making experiments, testing +Pigweed module features and checking what actions are necessary to fully +integrate Pigweed in a CHIP project. + +Pigweed functionalities are being gradually integrated into CHIP. Currently, the +following features are available: + +- **Echo RPC** - Creates a Remote Procedure Call server and allows sending + commands through the serial port to the device, which makes echo and sends + the received commands back. + +--- + +- [CHIP EFR32 Pigweed Example Application](#chip-EFR32-pigweed-example-application) + - [Building the Example Application](#building-the-example-application) + - [To build the application, follow these steps:](#to-build-the-application-follow-these-steps) + - [Testing the Example Application](#testing-the-example-application) + +--- + +## Building the Example Application + +- Download or clone the + [sdk_support](https://github.com/SiliconLabs/sdk_support) from GitHub + $ git clone https://github.com/SiliconLabs/sdk_support.git + and export the path with : + $ + export EFR32_SDK_ROOT= + +- Download the + [Simplicity Commander](https://www.silabs.com/mcu/programming-options) + command line tool, and ensure that `commander` is your shell search path. + (For Mac OS X, `commander` is located inside + `Commander.app/Contents/MacOS/`.) + + export PATH=/Applications/Commander.app/Contents/MacOS:$PATH + +- Download and install a suitable ARM gcc tool chain: + [GNU Arm Embedded Toolchain 9-2019-q4-major](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads) + +- Install some additional tools(likely already present for CHIP developers): + + # Linux + sudo apt-get install git libwebkitgtk-1.0-0 ninja-build + + # Mac OS X + brew install ninja + +- Supported hardware: + + MG12 boards: + + - BRD4161A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@19dBm + - BRD4163A / SLWSTK6000B / Dual band Wireless Starter Kit / 2.4GHz@19dBm, + 868MHz@19dBm + - BRD4164A / SLWSTK6000B / Dual band Wireless Starter Kit / 2.4GHz@19dBm, + 915MHz@19dBm + - BRD4166A / SLTB004A / Thunderboard Sense 2 / 2.4GHz@10dBm + - BRD4170A / SLWSTK6000B / Multiband Wireless Starter Kit / 2.4GHz@19dBm, + 915MHz@19dBm + - BRD4304A / SLWSTK6000B / MGM12P Module / 2.4GHz@19dBm + + MG21 boards: + + - BRD4180A / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@20dBm + +* Build the example application: + + cd ~/connectedhomeip/examples/pigweed-app/efr32 + git submodule update --init + source third_party/connectedhomeip/scripts/activate.sh + export EFR32_SDK_ROOT= + export EFR32_BOARD=BRD4161A + gn gen out/debug --args="efr32_sdk_root=\"${EFR32_SDK_ROOT}\" efr32_board=\"${EFR32_BOARD}\"" + ninja -C out/debug + +- To delete generated executable, libraries and object files use: + + cd ~/connectedhomeip/examples/pigweed-app/efr32 + rm -rf out/ + +### Flashing the Application + +- On the command line: + + cd ~/connectedhomeip/examples/pigweed-app/efr32 + python3 out/debug/chip-efr32-pigweed-example.flash.py + +- With the Commander app, just load the .s37 file. +- Or with the Ozone debugger, just load the .out file. + +## Testing the Example Application + +Determine the serial port name for the EFR device by checking /dev: ls +/dev/tty\* + + It should look like this : + - On Linux + /dev/ttyACM0 + - On MAC + /dev/tty.usbmodem0004401548451 + +Run the following command to start an interactive Python shell, where the Echo +RPC commands can be invoked: + + python -m pw_hdlc.rpc_console --device /dev/tty.usbmodem0004401548451 -b 115200 $CHIP_ROOT/third_party/pigweed/repo/pw_rpc/pw_rpc_protos/echo.proto -o /tmp/pw_rpc.out + +To send an Echo RPC message, type the following command, where the actual +message is the text in quotation marks after the `msg=` phrase: + + rpcs.pw.rpc.EchoService.Echo(msg="hi") + + Note: Some users might have to install the + [VCP driver](https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers) + before the device shows up on `/dev/tty`. diff --git a/examples/pigweed-app/efr32/args.gni b/examples/pigweed-app/efr32/args.gni new file mode 100644 index 00000000000000..45567046d2a4db --- /dev/null +++ b/examples/pigweed-app/efr32/args.gni @@ -0,0 +1,25 @@ +# 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. + +import("//build_overrides/chip.gni") +import("${chip_root}/config/efr32/lib/pw_rpc/pw_rpc.gni") +import("${chip_root}/examples/platform/efr32/args.gni") + +efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") + +declare_args() { + chip_build_pw_rpc_lib = true +} + +default_configs_std = [ "${chip_root}/config/efr32/lib/pw_rpc:std_cpp17" ] diff --git a/examples/pigweed-app/efr32/build_overrides b/examples/pigweed-app/efr32/build_overrides new file mode 120000 index 00000000000000..194ee0b812dc3d --- /dev/null +++ b/examples/pigweed-app/efr32/build_overrides @@ -0,0 +1 @@ +../../build_overrides/ \ No newline at end of file diff --git a/examples/pigweed-app/efr32/include/AppConfig.h b/examples/pigweed-app/efr32/include/AppConfig.h new file mode 100644 index 00000000000000..61a5430dafeeb8 --- /dev/null +++ b/examples/pigweed-app/efr32/include/AppConfig.h @@ -0,0 +1,49 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * All rights reserved. + * + * 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 + +// ---- PW Example App Config ---- + +// EFR32 WSTK Buttons +#define PB0 0 +#define PB1 1 + +// EFR32 WSTK LEDs +#define BSP_LED_0 0 +#define BSP_LED_1 1 + +#define APP_BUTTON_DEBOUNCE_PERIOD_MS 50 +#define APP_BUTTON_PRESSED 0 +#define APP_BUTTON_RELEASED 1 + +#define SYSTEM_STATE_LED BSP_LED_0 + +// EFR Logging +#ifdef __cplusplus +extern "C" { +#endif + +void efr32LogInit(void); +void efr32Log(const char * aFormat, ...); +#define EFR32_LOG(...) efr32Log(__VA_ARGS__); +void appError(int err); + +#ifdef __cplusplus +} +#endif diff --git a/examples/pigweed-app/efr32/include/CHIPProjectConfig.h b/examples/pigweed-app/efr32/include/CHIPProjectConfig.h new file mode 100644 index 00000000000000..ef9dbc5592501e --- /dev/null +++ b/examples/pigweed-app/efr32/include/CHIPProjectConfig.h @@ -0,0 +1,122 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * All rights reserved. + * + * 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. + */ + +/** + * @file + * Example project configuration file for CHIP. + * + * This is a place to put application or project-specific overrides + * to the default configuration values for general CHIP features. + * + */ + +#pragma once + +/** + * CHIP_DEVICE_CONFIG_ENABLE_TEST_DEVICE_IDENTITY + * + * Enables the use of a hard-coded default Chip device id and credentials if no device id + * is found in Chip NV storage. + * + * This option is for testing only and should be disabled in production releases. + */ +#define CHIP_DEVICE_CONFIG_ENABLE_TEST_DEVICE_IDENTITY 34 + +// Use a default pairing code if one hasn't been provisioned in flash. +#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 12345678 +#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00 + +// For convenience, Chip Security Test Mode can be enabled and the +// requirement for authentication in various protocols can be disabled. +// +// WARNING: These options make it possible to circumvent basic Chip security functionality, +// including message encryption. Because of this they MUST NEVER BE ENABLED IN PRODUCTION BUILDS. +// +#define CHIP_CONFIG_SECURITY_TEST_MODE 0 +#define CHIP_CONFIG_REQUIRE_AUTH 1 + +/** + * CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID + * + * 0x235A: Chip's Vendor Id. + */ +#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0x235A + +/** + * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID + * + * 0xFE00: SDK Sample Lock Resource + */ +#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0xFE00 + +/** + * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_REVISION + * + * The product revision number assigned to device or product by the device vendor. This + * number is scoped to the device product id, and typically corresponds to a revision of the + * physical device, a change to its packaging, and/or a change to its marketing presentation. + * This value is generally *not* incremented for device software revisions. + */ +#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_REVISION 1 + +/** + * CHIP_DEVICE_CONFIG_DEVICE_FIRMWARE_REVISION + * + * A string identifying the firmware revision running on the device. + * CHIP service currently expects the firmware version to be in the format + * {MAJOR_VERSION}.0d{MINOR_VERSION} + */ +#ifndef CHIP_DEVICE_CONFIG_DEVICE_FIRMWARE_REVISION +#define CHIP_DEVICE_CONFIG_DEVICE_FIRMWARE_REVISION "0.1ALPHA" +#endif +/** + * CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE + * + * Enable support for Chip-over-BLE (CHIPoBLE). + */ +#define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE 1 + +/** + * CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC + * + * Enables synchronizing the device's real time clock with a remote Chip Time service + * using the Chip Time Sync protocol. + */ +#define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 0 + +/** + * CHIP_DEVICE_CONFIG_USE_TEST_SERIAL_NUMBER + * + * Enables the use of a hard-coded default serial number if none + * is found in Chip NV storage. + */ +#define CHIP_DEVICE_CONFIG_USE_TEST_SERIAL_NUMBER "DUMMY_SN" + +/** + * CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS + * + * Enable recording UTC timestamps. + */ +#define CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 1 + +/** + * CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE + * + * A size, in bytes, of the individual debug event logging buffer. + */ +#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (512) diff --git a/examples/pigweed-app/efr32/include/FreeRTOSConfig.h b/examples/pigweed-app/efr32/include/FreeRTOSConfig.h new file mode 100644 index 00000000000000..041206f84739c7 --- /dev/null +++ b/examples/pigweed-app/efr32/include/FreeRTOSConfig.h @@ -0,0 +1,285 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * All rights reserved. + * + * 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. + */ + +/*************************************************************************** + * # License + * + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is Third Party Software licensed by Silicon Labs from a third party + * and is governed by the sections of the MSLA applicable to Third Party + * Software and the additional terms set forth below. + * + ******************************************************************************/ +/* + FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd. + All rights reserved + + VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. + + This file is part of the FreeRTOS distribution. + + FreeRTOS is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License (version 2) as published by the + Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception. + + *************************************************************************** + >>! NOTE: The modification to the GPL is included to allow you to !<< + >>! distribute a combined work that includes FreeRTOS without being !<< + >>! obliged to provide the source code for proprietary components !<< + >>! outside of the FreeRTOS kernel. !<< + *************************************************************************** + + FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. Full license text is available on the following + link: http://www.freertos.org/a00114.html + + *************************************************************************** + * * + * FreeRTOS provides completely free yet professionally developed, * + * robust, strictly quality controlled, supported, and cross * + * platform software that is more than just the market leader, it * + * is the industry's de facto standard. * + * * + * Help yourself get started quickly while simultaneously helping * + * to support the FreeRTOS project by purchasing a FreeRTOS * + * tutorial book, reference manual, or both: * + * http://www.FreeRTOS.org/Documentation * + * * + *************************************************************************** + + http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading + the FAQ page "My application does not run, what could be wrong?". Have you + defined configASSERT()? + + http://www.FreeRTOS.org/support - In return for receiving this top quality + embedded software for free we request you assist our global community by + participating in the support forum. + + http://www.FreeRTOS.org/training - Investing in training allows your team to + be as productive as possible as early as possible. Now you can receive + FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers + Ltd, and the world's leading authority on the world's leading RTOS. + + http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, + including FreeRTOS+Trace - an indispensable productivity tool, a DOS + compatible FAT file system, and our tiny thread aware UDP/IP stack. + + http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate. + Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS. + + http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High + Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS + licenses offer ticketed support, indemnification and commercial middleware. + + http://www.SafeRTOS.com - High Integrity Systems also provide a safety + engineered and independently SIL3 certified version for use in safety and + mission critical applications that require provable dependability. + + 1 tab == 4 spaces! +*/ + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include "em_device.h" +#include + +/*----------------------------------------------------------- + * Application specific definitions. + * + * These definitions should be adjusted for your particular hardware and + * application requirements. + * + * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE + * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. + * + * 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) + +/* The full demo always has tasks to run so the tick will never be turned +off. The blinky demo will use the default tickless idle implementation to +turn the tick off. */ +#define configUSE_TICKLESS_IDLE (0) + +/* Hook function related definitions. */ +#define configUSE_TICK_HOOK (1) +#define configCHECK_FOR_STACK_OVERFLOW (2) +#define configUSE_MALLOC_FAILED_HOOK (1) +#define configUSE_IDLE_HOOK (0) + +#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 (0) + +#define configENERGY_MODE (sleepEM3) +#endif + +/* Main functions*/ +/* Run time stats gathering related definitions. */ +#define configGENERATE_RUN_TIME_STATS (0) + +/* Co-routine related definitions. */ +#define configUSE_CO_ROUTINES (0) +#define configMAX_CO_ROUTINE_PRIORITIES (1) + +/* Software timer related definitions. */ +#define configUSE_TIMERS (1) +#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES - 1) /* Highest priority */ +#define configTIMER_QUEUE_LENGTH (10) +#define configTIMER_TASK_STACK_DEPTH (1024) + +/* Cortex-M specific definitions. */ +#ifdef __NVIC_PRIO_BITS +/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */ +#define configPRIO_BITS (__NVIC_PRIO_BITS) +#else +#define configPRIO_BITS 3 /* 7 priority levels */ +#endif + +/* The lowest interrupt priority that can be used in a call to a "set priority" +function. */ +#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY (0x07) + +/* The highest interrupt priority that can be used by any interrupt service +routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL +INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER +PRIORITY THAN THIS! (higher priorities are lower numeric values. */ +#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY (0x03) + +/* Interrupt priorities used by the kernel port layer itself. These are generic +to all Cortex-M ports, and do not rely on any particular library functions. */ +#define configKERNEL_INTERRUPT_PRIORITY (configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS)) +/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!! +See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */ +#define configMAX_SYSCALL_INTERRUPT_PRIORITY (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS)) + +/* FreeRTOS MPU specific definitions. */ +#define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS (1) + +#define configCPU_CLOCK_HZ (SystemCoreClock) +#define configUSE_PREEMPTION (1) +#define configUSE_TIME_SLICING (1) +#define configUSE_PORT_OPTIMISED_TASK_SELECTION (1) +#define configUSE_TICKLESS_IDLE_SIMPLE_DEBUG (1) /* See into vPortSuppressTicksAndSleep source code for explanation */ +#define configMAX_PRIORITIES (8) +#define configMINIMAL_STACK_SIZE (120) /* Number of words to use for Idle and Timer stacks */ +#define configMAX_TASK_NAME_LEN (4) +#define configUSE_16_BIT_TICKS (0) +#define configIDLE_SHOULD_YIELD (0) +#define configUSE_MUTEXES (1) +#define configUSE_RECURSIVE_MUTEXES (1) +#define configUSE_COUNTING_SEMAPHORES (1) +#define configUSE_ALTERNATIVE_API (0) /* Deprecated! */ +#define configQUEUE_REGISTRY_SIZE (10) +#define configUSE_QUEUE_SETS (0) +#define configUSE_NEWLIB_REENTRANT (0) +#define configENABLE_BACKWARD_COMPATIBILITY (1) + +/* Optional functions - most linkers will remove unused functions anyway. */ +#define INCLUDE_vTaskPrioritySet (1) +#define INCLUDE_uxTaskPriorityGet (1) +#define INCLUDE_vTaskDelete (1) +#define INCLUDE_vTaskSuspend (1) +#define INCLUDE_xResumeFromISR (1) +#define INCLUDE_vTaskDelayUntil (1) +#define INCLUDE_vTaskDelay (1) +#define INCLUDE_xTaskGetSchedulerState (1) +#define INCLUDE_xTaskGetCurrentTaskHandle (1) +#define INCLUDE_uxTaskGetStackHighWaterMark (1) +#define INCLUDE_xTaskGetIdleTaskHandle (1) +#define INCLUDE_xTimerGetTimerDaemonTaskHandle (1) +#define INCLUDE_pcTaskGetTaskName (1) +#define INCLUDE_eTaskGetState (1) +#define INCLUDE_xEventGroupSetBitFromISR (1) +#define INCLUDE_xTimerPendFunctionCall (1) + +/* Stop if an assertion fails. */ +#define configASSERT(x) \ + if ((x) == 0) \ + { \ + taskDISABLE_INTERRUPTS(); \ + printf("\nFREERTOS ASSERT ( %s )\n", #x); \ + for (;;) \ + ; \ + } +#define configASSERTNULL(x) \ + if ((x) == NULL) \ + { \ + taskDISABLE_INTERRUPTS(); \ + for (;;) \ + ; \ + } + +/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS +standard names. */ +#define vPortSVCHandler SVC_Handler +#define xPortPendSVHandler PendSV_Handler +#define xPortSysTickHandler SysTick_Handler + +#if defined(__GNUC__) +/* For the linker. */ +#define fabs __builtin_fabs +#endif + +#ifdef __cplusplus +} +#endif diff --git a/examples/pigweed-app/efr32/ldscripts/efr32-pigweed-example-MG12P.ld b/examples/pigweed-app/efr32/ldscripts/efr32-pigweed-example-MG12P.ld new file mode 100644 index 00000000000000..d20e4f84defdac --- /dev/null +++ b/examples/pigweed-app/efr32/ldscripts/efr32-pigweed-example-MG12P.ld @@ -0,0 +1,288 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * All rights reserved. + * + * 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. + */ +/***************************************************************************//** + * Linker script for Silicon Labs EFR32MG12P devices + * @version 5.7.2 + ******************************************************************************* + * # License + * Copyright 2018 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * SPDX-License-Identifier: Zlib + * + * The licensor of this software is Silicon Laboratories Inc. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ******************************************************************************/ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 1048576 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 262144 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapBase + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + * __Vectors_End + * __Vectors_Size + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.vectors)) + __Vectors_End = .; + __Vectors_Size = __Vectors_End - __Vectors; + __end__ = .; + + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + KEEP(*(.application_properties)) + KEEP(*(.gecko_configuration)) + KEEP(*(.xo_configuration)) + KEEP(*(.gatt_header)) + KEEP(*(.gatt_data)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + + KEEP(*(.eh_frame*)) + } > FLASH + + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + /*******************************************************************/ + /* Define flash block for BLE-simee & chip-nvm3 */ + /* simee: 9000H (36k) bytes for BLE nvm3 */ + /* chipNvm3_section: 4000H (16k) bytes for chip nvm3. */ + /* 8K is reserved for OpenThread's NVM which is mapped directly at */ + /* the top of flash */ + /*******************************************************************/ + + OPENTHREAD_NVM_SIZE = 8192; + + .nvm_dummy (DSECT): + { + __nvm3_dummy_begin = .; + . = ALIGN (8192); + __nvm3_dummy_simee = .; + KEEP(*(.simee)); + . = ALIGN (8192); + __nvm3_dummy_chip = .; + KEEP(*(chipNvm3_section)); + . = ALIGN (8192); + . += OPENTHREAD_NVM_SIZE; + . = ALIGN (8192); + } > FLASH + + /* Set NVM to end of FLASH */ + __nvm3Base = LENGTH(FLASH) - SIZEOF(.nvm_dummy) + (__nvm3_dummy_simee - __nvm3_dummy_begin); + __chipNvm3Base = LENGTH(FLASH) - SIZEOF(.nvm_dummy) + (__nvm3_dummy_chip - __nvm3_dummy_begin); + + + /*******************************************************************/ + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + . = ALIGN (4); + PROVIDE (__ram_func_section_start = .); + *(.ram) + PROVIDE (__ram_func_section_end = .); + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __HeapBase = .; + __end__ = .; + end = __end__; + _end = __end__; + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + KEEP(*(.stack*)) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") + + + /* Check if FLASH usage exceeds FLASH size */ + ASSERT( LENGTH(FLASH) >= (__etext + SIZEOF(.data)), "FLASH memory overflowed !") + ASSERT((__etext + SIZEOF(.data)) <= __nvm3Base, "FLASH memory overlapped with NVM section.") +} diff --git a/examples/pigweed-app/efr32/ldscripts/efr32-pigweed-example-MG21.ld b/examples/pigweed-app/efr32/ldscripts/efr32-pigweed-example-MG21.ld new file mode 100644 index 00000000000000..e8e870f65cf41f --- /dev/null +++ b/examples/pigweed-app/efr32/ldscripts/efr32-pigweed-example-MG21.ld @@ -0,0 +1,288 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * All rights reserved. + * + * 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. + */ +/***************************************************************************//** + * Linker script for Silicon Labs EFR32MG21 devices + * @version 5.7.2 + ******************************************************************************* + * # License + * Copyright 2018 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * SPDX-License-Identifier: Zlib + * + * The licensor of this software is Silicon Laboratories Inc. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ******************************************************************************/ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 1048576 - 8192 /* 8K is reserved at top of flash on MG21 */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 98304 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapBase + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + * __Vectors_End + * __Vectors_Size + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.vectors)) + __Vectors_End = .; + __Vectors_Size = __Vectors_End - __Vectors; + __end__ = .; + + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + KEEP(*(.application_properties)) + KEEP(*(.gecko_configuration)) + KEEP(*(.xo_configuration)) + KEEP(*(.gatt_header)) + KEEP(*(.gatt_data)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + + KEEP(*(.eh_frame*)) + } > FLASH + + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + /*******************************************************************/ + /* Define flash block for BLE-simee & CHIP-nvm3 */ + /* simee: 9000H (36k) bytes for BLE nvm3 */ + /* chipNvm3_section: 4000H (16k) bytes for CHIP nvm3. */ + /* 8K is reserved for OpenThread's NVM which is mapped directly at */ + /* the top of flash */ + /*******************************************************************/ + + OPENTHREAD_NVM_SIZE = 8192; + + .nvm_dummy (DSECT): + { + __nvm3_dummy_begin = .; + . = ALIGN (8192); + __nvm3_dummy_simee = .; + KEEP(*(.simee)); + . = ALIGN (8192); + __nvm3_dummy_chip = .; + KEEP(*(chipNvm3_section)); + . = ALIGN (8192); + . += OPENTHREAD_NVM_SIZE; + . = ALIGN (8192); + } > FLASH + + /* Set NVM to end of FLASH */ + __nvm3Base = LENGTH(FLASH) - SIZEOF(.nvm_dummy) + (__nvm3_dummy_simee - __nvm3_dummy_begin); + __nvm3ChipBase = LENGTH(FLASH) - SIZEOF(.nvm_dummy) + (__nvm3_dummy_chip - __nvm3_dummy_begin); + + + /*******************************************************************/ + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + . = ALIGN (4); + PROVIDE (__ram_func_section_start = .); + *(.ram) + PROVIDE (__ram_func_section_end = .); + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __HeapBase = .; + __end__ = .; + end = __end__; + _end = __end__; + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + KEEP(*(.stack*)) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") + + + /* Check if FLASH usage exceeds FLASH size */ + ASSERT( LENGTH(FLASH) >= (__etext + SIZEOF(.data)), "FLASH memory overflowed !") + ASSERT((__etext + SIZEOF(.data)) <= __nvm3Base, "FLASH memory overlapped with NVM section.") +} diff --git a/examples/pigweed-app/efr32/src/main.cpp b/examples/pigweed-app/efr32/src/main.cpp new file mode 100644 index 00000000000000..ff36d1f483a35d --- /dev/null +++ b/examples/pigweed-app/efr32/src/main.cpp @@ -0,0 +1,48 @@ +/* + * + * 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 "AppConfig.h" +#include "LEDWidget.h" +#include "init_board.h" +#include "init_mcu.h" + +#include "pw_sys_io/sys_io.h" +#include "pw_sys_io_efr32/init.h" +#include "uart.h" + +static LEDWidget sStatusLED; + +namespace hdlc_example { +extern void Start(); +} // namespace hdlc_example + +using namespace ::pw::sys_io; +int main(void) +{ + initMcu(); + initBoard(); + efr32LogInit(); + EFR32_LOG("***** CHIP EFR32 pigweed example *****\r\n"); + + pw_sys_io_Init(); + // Initialize LEDs + LEDWidget::InitGpio(); + sStatusLED.Init(SYSTEM_STATE_LED); + sStatusLED.Set(true); + + hdlc_example::Start(); +} diff --git a/examples/pigweed-app/efr32/third_party/connectedhomeip b/examples/pigweed-app/efr32/third_party/connectedhomeip new file mode 120000 index 00000000000000..80527d5e8de354 --- /dev/null +++ b/examples/pigweed-app/efr32/third_party/connectedhomeip @@ -0,0 +1 @@ +../../../../../connectedhomeip \ No newline at end of file diff --git a/examples/platform/efr32/args.gni b/examples/platform/efr32/args.gni index f27551634e1b75..233080c6c92570 100644 --- a/examples/platform/efr32/args.gni +++ b/examples/platform/efr32/args.gni @@ -13,18 +13,8 @@ # limitations under the License. import("//build_overrides/chip.gni") - import("${chip_root}/src/platform/EFR32/args.gni") -import("//build_overrides/pigweed.gni") - -declare_args() { - dir_pw_log_chip = "$chip_root/src/lib/support/pw_log_chip" -} - -pw_log_BACKEND = "$dir_pw_log_chip" -pw_assert_BACKEND = "$dir_pw_assert_log" - openthread_project_core_config_file = "OpenThreadConfig.h" openthread_core_config_deps = [] openthread_core_config_deps = [ "${chip_root}/examples/platform/efr32:openthread_core_config_efr32_chip_examples" ] diff --git a/examples/lighting-app/efr32/include/board_features.h b/examples/platform/efr32/board_features.h similarity index 99% rename from examples/lighting-app/efr32/include/board_features.h rename to examples/platform/efr32/board_features.h index e1ccb846160ada..182cdd9bb9ae2c 100644 --- a/examples/lighting-app/efr32/include/board_features.h +++ b/examples/platform/efr32/board_features.h @@ -34,9 +34,6 @@ #pragma once -// Top level macros -#define SILABS_AF_DEVICE_NAME "lighting-example" - // Generated plugin macros #ifdef EMBER_AF_BOARD_TYPE diff --git a/examples/platform/efr32/efr32mg12/BRD4161A/init_board.c b/examples/platform/efr32/efr32mg12/BRD4161A/init_board.c index 75f7074c329a90..517408d5ccd795 100644 --- a/examples/platform/efr32/efr32mg12/BRD4161A/init_board.c +++ b/examples/platform/efr32/efr32mg12/BRD4161A/init_board.c @@ -41,6 +41,7 @@ #include "board_features.h" #include "em_cmu.h" +#include "hal-config-board.h" #include "em_cmu.h" diff --git a/examples/platform/efr32/efr32mg12/BRD4163A/init_board.c b/examples/platform/efr32/efr32mg12/BRD4163A/init_board.c index 75f7074c329a90..517408d5ccd795 100644 --- a/examples/platform/efr32/efr32mg12/BRD4163A/init_board.c +++ b/examples/platform/efr32/efr32mg12/BRD4163A/init_board.c @@ -41,6 +41,7 @@ #include "board_features.h" #include "em_cmu.h" +#include "hal-config-board.h" #include "em_cmu.h" diff --git a/examples/platform/efr32/efr32mg12/BRD4164A/hal-config.h b/examples/platform/efr32/efr32mg12/BRD4164A/hal-config.h index 889ca2b8ce7730..d31f1e5c098728 100644 --- a/examples/platform/efr32/efr32mg12/BRD4164A/hal-config.h +++ b/examples/platform/efr32/efr32mg12/BRD4164A/hal-config.h @@ -82,7 +82,7 @@ #define HAL_USART0_RX_QUEUE_SIZE (128UL) #ifndef HAL_VCOM_ENABLE -#define HAL_VCOM_ENABLE (0) +#define HAL_VCOM_ENABLE (1) #endif #ifndef HAL_I2CSENSOR_ENABLE #define HAL_I2CSENSOR_ENABLE (0) diff --git a/examples/platform/efr32/efr32mg12/BRD4164A/init_board.c b/examples/platform/efr32/efr32mg12/BRD4164A/init_board.c index 75f7074c329a90..517408d5ccd795 100644 --- a/examples/platform/efr32/efr32mg12/BRD4164A/init_board.c +++ b/examples/platform/efr32/efr32mg12/BRD4164A/init_board.c @@ -41,6 +41,7 @@ #include "board_features.h" #include "em_cmu.h" +#include "hal-config-board.h" #include "em_cmu.h" diff --git a/examples/platform/efr32/efr32mg12/BRD4166A/init_board.c b/examples/platform/efr32/efr32mg12/BRD4166A/init_board.c index 4a74535b5c7f09..bc7c3b99efe1bb 100644 --- a/examples/platform/efr32/efr32mg12/BRD4166A/init_board.c +++ b/examples/platform/efr32/efr32mg12/BRD4166A/init_board.c @@ -41,6 +41,7 @@ #include "board_features.h" #include "em_cmu.h" +#include "hal-config-board.h" #include "em_cmu.h" diff --git a/examples/platform/efr32/efr32mg12/BRD4170A/init_board.c b/examples/platform/efr32/efr32mg12/BRD4170A/init_board.c index 75f7074c329a90..517408d5ccd795 100644 --- a/examples/platform/efr32/efr32mg12/BRD4170A/init_board.c +++ b/examples/platform/efr32/efr32mg12/BRD4170A/init_board.c @@ -41,6 +41,7 @@ #include "board_features.h" #include "em_cmu.h" +#include "hal-config-board.h" #include "em_cmu.h" diff --git a/examples/platform/efr32/efr32mg12/BRD4304A/init_board.c b/examples/platform/efr32/efr32mg12/BRD4304A/init_board.c index e57a3735c90d5f..609aad15e5dab5 100644 --- a/examples/platform/efr32/efr32mg12/BRD4304A/init_board.c +++ b/examples/platform/efr32/efr32mg12/BRD4304A/init_board.c @@ -41,6 +41,7 @@ #include "board_features.h" #include "em_cmu.h" +#include "hal-config-board.h" #include "em_cmu.h" diff --git a/examples/platform/efr32/efr32mg21/BRD4180A/init_board.c b/examples/platform/efr32/efr32mg21/BRD4180A/init_board.c index 0d05740062b16f..cdaead06790bee 100644 --- a/examples/platform/efr32/efr32mg21/BRD4180A/init_board.c +++ b/examples/platform/efr32/efr32mg21/BRD4180A/init_board.c @@ -41,6 +41,7 @@ #include "board_features.h" #include "em_cmu.h" +#include "hal-config-board.h" #include "bsp.h" diff --git a/examples/lighting-app/efr32/include/hal-config-app-common.h b/examples/platform/efr32/hal-config-app-common.h similarity index 100% rename from examples/lighting-app/efr32/include/hal-config-app-common.h rename to examples/platform/efr32/hal-config-app-common.h diff --git a/examples/platform/efr32/pw_sys_io/BUILD.gn b/examples/platform/efr32/pw_sys_io/BUILD.gn new file mode 100644 index 00000000000000..9028bbc4eabca9 --- /dev/null +++ b/examples/platform/efr32/pw_sys_io/BUILD.gn @@ -0,0 +1,37 @@ +# 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. + +import("//build_overrides/chip.gni") +import("//build_overrides/pigweed.gni") +import("$dir_pw_build/target_types.gni") + +examples_plat_dir = "${chip_root}/examples/platform/efr32" + +config("default_config") { + include_dirs = [ "public" ] +} + +pw_source_set("pw_sys_io_efr32") { + public_configs = [ ":default_config" ] + + public_deps = [] + + deps = [ + "$dir_pw_sys_io:default_putget_bytes", + "$dir_pw_sys_io:facade", + ] + + include_dirs = [ "${examples_plat_dir}" ] + sources = [ "sys_io_efr32.cc" ] +} diff --git a/examples/platform/efr32/pw_sys_io/public/pw_sys_io_efr32/init.h b/examples/platform/efr32/pw_sys_io/public/pw_sys_io_efr32/init.h new file mode 100644 index 00000000000000..f11f5e928f3e14 --- /dev/null +++ b/examples/platform/efr32/pw_sys_io/public/pw_sys_io_efr32/init.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 + +#include "pw_preprocessor/util.h" + +PW_EXTERN_C_START + +// The actual implement of PreMainInit() in sys_io_BACKEND. +void pw_sys_io_Init(); + +PW_EXTERN_C_END diff --git a/examples/platform/efr32/pw_sys_io/sys_io_efr32.cc b/examples/platform/efr32/pw_sys_io/sys_io_efr32.cc new file mode 100644 index 00000000000000..a7a99d06db86e2 --- /dev/null +++ b/examples/platform/efr32/pw_sys_io/sys_io_efr32.cc @@ -0,0 +1,74 @@ +/* + * + * 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 "pw_sys_io/sys_io.h" +#include +#include +#include +#include + +#include "uart.h" + +int16_t console_getchar(char * chr) +{ + return uartConsoleRead(chr, 1); +} + +int16_t console_putchar(const char * chr) +{ + return uartConsoleWrite(chr, 1); +} + +extern "C" void pw_sys_io_Init() +{ + uartConsoleInit(); +} + +namespace pw::sys_io { + +Status ReadByte(std::byte * dest) +{ + if (!dest) + return Status::InvalidArgument(); + + int16_t ret = console_getchar(reinterpret_cast(dest)); + return ret < 0 ? Status::FailedPrecondition() : OkStatus(); +} + +Status WriteByte(std::byte b) +{ + int16_t ret = console_putchar(reinterpret_cast(&b)); + return ret < 0 ? Status::FailedPrecondition() : OkStatus(); +} + +// Writes a string using pw::sys_io, and add newline characters at the end. +StatusWithSize WriteLine(const std::string_view & s) +{ + size_t chars_written = 0; + StatusWithSize result = WriteBytes(std::as_bytes(std::span(s))); + if (!result.ok()) + { + return result; + } + chars_written += result.size(); + result = WriteBytes(std::as_bytes(std::span("\r\n", 2))); + chars_written += result.size(); + + return StatusWithSize(result.status(), chars_written); +} + +} // namespace pw::sys_io diff --git a/examples/platform/efr32/uart.c b/examples/platform/efr32/uart.c new file mode 100644 index 00000000000000..1099555319e70c --- /dev/null +++ b/examples/platform/efr32/uart.c @@ -0,0 +1,66 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * All rights reserved. + * + * 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 "uart.h" +#include "em_core.h" +#include "em_usart.h" +#include "hal-config-board.h" +#include "hal-config.h" +#include "init_board.h" +#include "uartdrv.h" +#include +#include + +void uartConsoleInit(void) +{ + RETARGET_SerialCrLf(0); + RETARGET_SerialInit(); + initVcomEnable(); +} + +int16_t uartConsoleWrite(const char * Buf, uint16_t BufLength) +{ + if (Buf == NULL || BufLength < 1) + { + return -1; + } + + for (int i = 0; i < BufLength; i++) + { + RETARGET_WriteChar(Buf[i]); + } + return (int16_t) BufLength; +} + +int16_t uartConsoleRead(char * Buf, uint16_t BufLength) +{ + if (Buf == NULL || BufLength < 1) + { + return -1; + } + + for (int i = 0; i < BufLength; i++) + { + int readVal = -1; + while (readVal == -1) + { + readVal = RETARGET_ReadChar(); + } + Buf[i] = (char) readVal; + } + return (int16_t) BufLength; +} diff --git a/examples/platform/efr32/uart.h b/examples/platform/efr32/uart.h new file mode 100644 index 00000000000000..76e83b7a879ae7 --- /dev/null +++ b/examples/platform/efr32/uart.h @@ -0,0 +1,33 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * All rights reserved. + * + * 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 + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void uartConsoleInit(void); +int16_t uartConsoleWrite(const char * Buf, uint16_t BufLength); +int16_t uartConsoleRead(char * Buf, uint16_t BufLength); + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/src/platform/EFR32/Logging.cpp b/src/platform/EFR32/Logging.cpp index d9e0c43b77c9db..d7f13e9ce890a0 100644 --- a/src/platform/EFR32/Logging.cpp +++ b/src/platform/EFR32/Logging.cpp @@ -43,10 +43,25 @@ #define LOG_RTT_BUFFER_INDEX 0 #endif +/** + * @def LOG_RTT_BUFFER_NAME + * + * RTT's name. Only used if LOG_RTT_BUFFER_INDEX is not 0. Otherwise, + * the buffer name is fixed to "Terminal". + * + */ #ifndef LOG_RTT_BUFFER_NAME #define LOG_RTT_BUFFER_NAME "Terminal" #endif +/** + * @def LOG_RTT_BUFFER_SIZE + * + * LOG RTT's buffer size. Only used if LOG_RTT_BUFFER_INDEX is not 0. To + * configure buffer #0 size, check the BUFFER_SIZE_UP definition in + * SEGGER_RTT_Conf.h + * + */ #ifndef LOG_RTT_BUFFER_SIZE #define LOG_RTT_BUFFER_SIZE 256 #endif @@ -67,7 +82,10 @@ using namespace ::chip::DeviceLayer; using namespace ::chip::DeviceLayer::Internal; static bool sLogInitialized = false; +#if LOG_RTT_BUFFER_INDEX != 0 static uint8_t sLogBuffer[LOG_RTT_BUFFER_SIZE]; +static uint8_t sCmdLineBuffer[LOG_RTT_BUFFER_SIZE]; +#endif /** * Print a log message to RTT @@ -79,11 +97,11 @@ static void PrintLog(const char * msg) { size_t sz; sz = strlen(msg); - SEGGER_RTT_WriteNoLock(0, msg, sz); + SEGGER_RTT_WriteNoLock(LOG_RTT_BUFFER_INDEX, msg, sz); const char * newline = "\r\n"; sz = strlen(newline); - SEGGER_RTT_WriteNoLock(0, newline, sz); + SEGGER_RTT_WriteNoLock(LOG_RTT_BUFFER_INDEX, newline, sz); } #endif // EFR32_LOG_ENABLED } @@ -94,8 +112,15 @@ static void PrintLog(const char * msg) extern "C" void efr32LogInit(void) { #if EFR32_LOG_ENABLED +#if LOG_RTT_BUFFER_INDEX != 0 SEGGER_RTT_ConfigUpBuffer(LOG_RTT_BUFFER_INDEX, LOG_RTT_BUFFER_NAME, sLogBuffer, LOG_RTT_BUFFER_SIZE, SEGGER_RTT_MODE_NO_BLOCK_TRIM); + + SEGGER_RTT_ConfigDownBuffer(LOG_RTT_BUFFER_INDEX, LOG_RTT_BUFFER_NAME, sCmdLineBuffer, LOG_RTT_BUFFER_SIZE, + SEGGER_RTT_MODE_NO_BLOCK_SKIP); +#else + SEGGER_RTT_SetFlagsUpBuffer(LOG_RTT_BUFFER_INDEX, SEGGER_RTT_MODE_NO_BLOCK_TRIM); +#endif sLogInitialized = true; #endif // EFR32_LOG_ENABLED }