From 3215cd8aab018f90039b495fb3f15458b8fec77a Mon Sep 17 00:00:00 2001 From: Douglas Rocha Ferraz Date: Mon, 2 May 2022 17:08:54 -0400 Subject: [PATCH] Chef - Extended Pigweed RPC support (#17781) * Build flash_script package for ESP32 Change-Id: I4e0375c9b9837b3b9f8a3d2570635536e7e34e42 Reviewed-on: https://team-review.git.corp.google.com/c/npe-tse-chip-sdk/third_party/connectedhomeip/+/1419520 Reviewed-by: Doug Ferraz * new: Wifi and Descriptor clusters on ESP32 Change-Id: I37b61425a55d8210c2286becce47917fddf54a3f Reviewed-on: https://team-review.git.corp.google.com/c/npe-tse-chip-sdk/third_party/connectedhomeip/+/1418359 Reviewed-by: Rob Oliver Reviewed-by: Kevin Cheung Reviewed-by: Jerry Lee * new: added stub file. Included callbacks for successful operation of lock/unlock commands Change-Id: I9f4d601feb3b043d3c6689775bcaf40a8c5564d2 Reviewed-on: https://team-review.git.corp.google.com/c/npe-tse-chip-sdk/third_party/connectedhomeip/+/1420959 Reviewed-by: Michael Spang Reviewed-by: Jerry Lee * Enable PW RPC server on chef-built virtual device app Change-Id: I878955e9df26e893c136650654019a8fa14e2a8b Reviewed-on: https://team-review.git.corp.google.com/c/npe-tse-chip-sdk/third_party/connectedhomeip/+/1417979 Reviewed-by: Doug Ferraz * cosmetic change Change-Id: Ia2063a395a8d3f16965356d4a76b0d9df0834e57 * changes to linux pigweed dependencies. Still has issues building Pigweed Change-Id: I2be4e81f6c2e14112e31a0803813ef56d012b206 * Fix nrfconnect compilation errors (#17713) * Fix nrfconnect compilation errors * Chef: fix arguments for clean build * Build flash_script package for ESP32 Change-Id: I4e0375c9b9837b3b9f8a3d2570635536e7e34e42 Reviewed-on: https://team-review.git.corp.google.com/c/npe-tse-chip-sdk/third_party/connectedhomeip/+/1419520 Reviewed-by: Doug Ferraz * new: Wifi and Descriptor clusters on ESP32 Change-Id: I37b61425a55d8210c2286becce47917fddf54a3f Reviewed-on: https://team-review.git.corp.google.com/c/npe-tse-chip-sdk/third_party/connectedhomeip/+/1418359 Reviewed-by: Rob Oliver Reviewed-by: Kevin Cheung Reviewed-by: Jerry Lee * new: added stub file. Included callbacks for successful operation of lock/unlock commands Change-Id: I9f4d601feb3b043d3c6689775bcaf40a8c5564d2 Reviewed-on: https://team-review.git.corp.google.com/c/npe-tse-chip-sdk/third_party/connectedhomeip/+/1420959 Reviewed-by: Michael Spang Reviewed-by: Jerry Lee * Enable PW RPC server on chef-built virtual device app Change-Id: I878955e9df26e893c136650654019a8fa14e2a8b Reviewed-on: https://team-review.git.corp.google.com/c/npe-tse-chip-sdk/third_party/connectedhomeip/+/1417979 Reviewed-by: Doug Ferraz * cosmetic change Change-Id: Ia2063a395a8d3f16965356d4a76b0d9df0834e57 * changes to linux pigweed dependencies. Still has issues building Pigweed Change-Id: I2be4e81f6c2e14112e31a0803813ef56d012b206 * Restyled by gn * Restyled by autopep8 * Restyled by gn Co-authored-by: Sebastian Mauer Co-authored-by: MT Tsai Co-authored-by: vinitg1 <62729931+vinitg1@users.noreply.github.com> Co-authored-by: Restyled.io Change-Id: I827aa39ea41b8084d6fdca202e5a87e0f29cb4f3 --- examples/chef/chef.py | 10 ++++++++- examples/chef/common/stubs.cpp | 16 ++++++++++++++ examples/chef/esp32/main/CMakeLists.txt | 29 +++++++++++++++++++++++++ examples/chef/linux/BUILD.gn | 6 +++-- examples/chef/nrfconnect/CMakeLists.txt | 1 + 5 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 examples/chef/common/stubs.cpp diff --git a/examples/chef/chef.py b/examples/chef/chef.py index f9df2847e35070..5effa544cde5cd 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -311,6 +311,11 @@ def main(argv: Sequence[str]) -> None: shell.run_cmd(f"rm -rf {_CHEF_SCRIPT_PATH}/esp32/build") shell.run_cmd("idf.py fullclean") shell.run_cmd("idf.py build") + shell.run_cmd("idf.py build flashing_script") + shell.run_cmd( + f"(cd build/ && tar cJvf $(git rev-parse HEAD)-{options.sample_device_type_name}.tar.xz --files-from=chip-shell.flashbundle.txt)") + shell.run_cmd( + f"cp build/$(git rev-parse HEAD)-{options.sample_device_type_name}.tar.xz {_CHEF_SCRIPT_PATH}") elif options.build_target == "nrfconnect": shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}/nrfconnect") nrf_build_cmds = ["west build -b nrf52840dk_nrf52840"] @@ -335,6 +340,8 @@ def main(argv: Sequence[str]) -> None: import("//build_overrides/chip.gni") import("${{chip_root}}/config/standalone/args.gni") chip_shell_cmd_server = false + chip_build_libshell = true + chip_config_network_layer_ble = false target_defines = ["CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID={options.vid}", "CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID={options.pid}", "CONFIG_ENABLE_PW_RPC={'1' if options.do_rpc else '0'}"] """)) with open(f"{_CHEF_SCRIPT_PATH}/linux/sample.gni", "w") as f: @@ -345,7 +352,8 @@ def main(argv: Sequence[str]) -> None: if options.do_clean: shell.run_cmd(f"rm -rf out") if options.do_rpc: - shell.run_cmd("gn gen out --args='import(\"//with_pw_rpc.gni\")'") + shell.run_cmd( + "gn gen out --args='import(\"//with_pw_rpc.gni\")'") else: shell.run_cmd("gn gen out --args=''") shell.run_cmd("ninja -C out") diff --git a/examples/chef/common/stubs.cpp b/examples/chef/common/stubs.cpp new file mode 100644 index 00000000000000..ecc3ef52766d55 --- /dev/null +++ b/examples/chef/common/stubs.cpp @@ -0,0 +1,16 @@ +#include +#include +#include +#include +#include +#include + +bool emberAfPluginDoorLockOnDoorLockCommand(chip::EndpointId endpointId, chip::Optional pinCode) +{ + return true; +} + +bool emberAfPluginDoorLockOnDoorUnlockCommand(chip::EndpointId endpointId, chip::Optional pinCode) +{ + return true; +} diff --git a/examples/chef/esp32/main/CMakeLists.txt b/examples/chef/esp32/main/CMakeLists.txt index f242768177544e..6ebd23b7da224f 100644 --- a/examples/chef/esp32/main/CMakeLists.txt +++ b/examples/chef/esp32/main/CMakeLists.txt @@ -67,6 +67,7 @@ set(SRC_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/util" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/reporting" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated/attributes" + "${CMAKE_SOURCE_DIR}/../common" ) if (CONFIG_ENABLE_CHIP_SHELL) @@ -145,6 +146,17 @@ pw_proto_library(button_service pw_protobuf.common_protos ) +pw_proto_library(descriptor_service + SOURCES + ${CHIP_ROOT}/examples/common/pigweed/protos/descriptor_service.proto + PREFIX + descriptor_service + STRIP_PREFIX + ${CHIP_ROOT}/examples/common/pigweed/protos + DEPS + pw_protobuf.common_protos +) + pw_proto_library(device_service SOURCES ${CHIP_ROOT}/examples/common/pigweed/protos/device_service.proto @@ -158,9 +170,23 @@ pw_proto_library(device_service pw_protobuf.common_protos ) +pw_proto_library(wifi_service + SOURCES + ${CHIP_ROOT}/examples/common/pigweed/protos/wifi_service.proto + INPUTS + ${CHIP_ROOT}/examples/common/pigweed/protos/wifi_service.options + PREFIX + wifi_service + DEPS + pw_protobuf.common_protos + STRIP_PREFIX + ${CHIP_ROOT}/examples/common/pigweed/protos +) + target_link_libraries(${COMPONENT_LIB} PUBLIC attributes_service.nanopb_rpc button_service.nanopb_rpc + descriptor_service.nanopb_rpc device_service.nanopb_rpc pw_checksum pw_hdlc @@ -170,6 +196,7 @@ target_link_libraries(${COMPONENT_LIB} PUBLIC pw_trace_tokenized.trace_buffer pw_trace_tokenized.rpc_service pw_trace_tokenized.protos.nanopb_rpc + wifi_service.nanopb_rpc ) target_link_options(${COMPONENT_LIB} @@ -181,6 +208,8 @@ target_compile_options(${COMPONENT_LIB} PRIVATE "-DPW_RPC_ATTRIBUTE_SERVICE=1" "-DPW_RPC_BUTTON_SERVICE=1" "-DPW_RPC_DEVICE_SERVICE=1" + "-DPW_RPC_DESCRIPTOR_SERVICE=1" + "-DPW_RPC_WIFI_SERVICE=1" "-DPW_RPC_TRACING_SERVICE=1") endif (CONFIG_ENABLE_PW_RPC) diff --git a/examples/chef/linux/BUILD.gn b/examples/chef/linux/BUILD.gn index 9bd88e4b53c03d..769bcef34d5777 100644 --- a/examples/chef/linux/BUILD.gn +++ b/examples/chef/linux/BUILD.gn @@ -33,14 +33,16 @@ project_dir = "./.." chip_data_model("chef-data-model") { zap_file = "${project_dir}/devices/${sample_zap_file}" - zap_pregenerated_dir = "${chip_root}/examples/chef/out/${sample_name}/zap-generated/" is_server = true } executable("${sample_name}") { - sources = [ "${project_dir}/linux/main.cpp" ] + sources = [ + "${project_dir}/common/stubs.cpp", + "${project_dir}/linux/main.cpp", + ] deps = [ ":chef-data-model", diff --git a/examples/chef/nrfconnect/CMakeLists.txt b/examples/chef/nrfconnect/CMakeLists.txt index 921458db215900..574102ac1555f7 100644 --- a/examples/chef/nrfconnect/CMakeLists.txt +++ b/examples/chef/nrfconnect/CMakeLists.txt @@ -83,6 +83,7 @@ endif (CONFIG_ENABLE_CHIP_SHELL) target_sources(app PRIVATE ${CHEF}/nrfconnect/main.cpp + ${CHEF}/common/stubs.cpp ${GEN_DIR}/callback-stub.cpp ${GEN_DIR}/IMClusterCommandHandler.cpp ${NRFCONNECT_COMMON}/util/ThreadUtil.cpp