Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/ResolveLinker_ReenableCI' into R…
Browse files Browse the repository at this point in the history
…esolveLinker_ReenableCI
  • Loading branch information
adabreuti committed Aug 24, 2023
2 parents 2946feb + 434be86 commit 953ee75
Show file tree
Hide file tree
Showing 76 changed files with 23,136 additions and 6,684 deletions.
13 changes: 13 additions & 0 deletions config/esp32/components/chip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,10 @@ if (CONFIG_SEC_CERT_DAC_PROVIDER)
chip_gn_arg_append("chip_use_secure_cert_dac_provider" "true")
endif()

if (CONFIG_ENABLE_ESP_INSIGHTS_TRACE)
chip_gn_arg_append("matter_enable_esp_insights_trace" "true")
endif()

if (CONFIG_USE_ESP32_ECDSA_PERIPHERAL)
chip_gn_arg_append("chip_use_esp32_ecdsa_peripheral" "true")
endif()
Expand Down Expand Up @@ -367,6 +371,10 @@ target_include_directories(${COMPONENT_LIB} INTERFACE
"${CHIP_ROOT}/config/esp32/${CONFIG_CHIP_EXTERNAL_PLATFORM_DIR}/../../"
)

if (CONFIG_ENABLE_ESP_INSIGHTS_TRACE)
target_include_directories(${COMPONENT_LIB} INTERFACE "${CHIP_ROOT}/src/tracing/esp32_trace/include")
endif()

idf_component_get_property(mbedtls_lib mbedtls COMPONENT_LIB)

idf_build_get_property(idf_target IDF_TARGET)
Expand Down Expand Up @@ -422,6 +430,11 @@ if (CONFIG_SEC_CERT_DAC_PROVIDER)
list(APPEND chip_libraries $<TARGET_FILE:${esp32_secure_cert_mgr_lib}>)
endif()

if (CONFIG_ENABLE_ESP_INSIGHTS_TRACE)
idf_component_get_property(esp_insights_lib espressif__esp_insights COMPONENT_LIB)
list(APPEND chip_libraries $<TARGET_FILE:${esp_insights_lib}>)
endif()

idf_component_get_property(lwip_lib lwip COMPONENT_LIB)
list(APPEND chip_libraries $<TARGET_FILE:${lwip_lib}>)

Expand Down
9 changes: 9 additions & 0 deletions config/esp32/components/chip/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,15 @@ menu "CHIP Device Layer"
then this option gets enabled.
Also, please disable ESP_SECURE_CERT_DS_PERIPHERAL from the menuconfig when this option is disabled

config ENABLE_ESP_INSIGHTS_TRACE
bool "Enable Matter ESP Insights"
depends on ESP_INSIGHTS_ENABLED
default y
help
ESP Insights is a remote diagnostics solution to monitor the health of ESP devices in the field.
Enabling the above option will enable the esp32 specific tracing functionality and report the
diagnostic information to the insights cloud.

endmenu


Expand Down
4 changes: 4 additions & 0 deletions config/esp32/components/chip/idf_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ dependencies:
version: "2.0.3"
rules:
- if: "idf_version >=4.4"

espressif/esp_insights:
version: "1.0.1"
require: public
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,5 @@ CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y

# to avoid dram overflow, reduce the critical loggin buffer to 1K
CONFIG_EVENT_LOGGING_CRIT_BUFFER_SIZE=1024

CONFIG_DIAG_USE_EXTERNAL_LOG_WRAP=y
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,5 @@ CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y

# to avoid dram overflow, reduce the critical loggin buffer to 1K
CONFIG_EVENT_LOGGING_CRIT_BUFFER_SIZE=1024

CONFIG_DIAG_USE_EXTERNAL_LOG_WRAP=y
2 changes: 2 additions & 0 deletions examples/chef/esp32/sdkconfig_rpc.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,5 @@ CONFIG_MBEDTLS_HKDF_C=y

# IRAM optimizations
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y

CONFIG_DIAG_USE_EXTERNAL_LOG_WRAP=y
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ def __get_arguments(self, request):
arguments, request.min_interval, "min-interval")
arguments = self.__maybe_add(
arguments, request.max_interval, "max-interval")
arguments = self.__maybe_add(
arguments, request.keep_subscriptions, "keepSubscriptions")
arguments = self.__maybe_add(arguments, request.timed_interaction_timeout_ms,
"timedInteractionTimeoutMs")
arguments = self.__maybe_add(
Expand Down
15 changes: 11 additions & 4 deletions examples/chip-tool/templates/commands.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include <type_traits>

#include <app-common/zap-generated/cluster-objects.h>
#include <app-common/zap-generated/ids/Clusters.h>
#include <app-common/zap-generated/ids/Commands.h>
#include <commands/clusters/ComplexArgument.h>
#include <commands/clusters/ClusterCommand.h>
#include <commands/clusters/ReportCommand.h>
Expand Down Expand Up @@ -40,16 +42,21 @@ public:

CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector<chip::EndpointId> endpointIds) override
{
ChipLogProgress(chipTool, "Sending cluster ({{asHex parent.code 8}}) command ({{asHex code 8}}) on endpoint %u", endpointIds.at(0));
constexpr chip::ClusterId clusterId = chip::app::Clusters::{{asUpperCamelCase parent.name}}::Id;
constexpr chip::CommandId commandId = chip::app::Clusters::{{asUpperCamelCase parent.name}}::Commands::{{asUpperCamelCase name}}::Id;

return ClusterCommand::SendCommand(device, endpointIds.at(0), {{asHex parent.code 8}}, {{asHex code 8}}, mRequest);
ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointIds.at(0));
return ClusterCommand::SendCommand(device, endpointIds.at(0), clusterId, commandId, mRequest);
}

CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override
{
ChipLogProgress(chipTool, "Sending cluster ({{asHex parent.code 8}}) command ({{asHex code 8}}) on Group %u", groupId);
constexpr chip::ClusterId clusterId = chip::app::Clusters::{{asUpperCamelCase parent.name}}::Id;
constexpr chip::CommandId commandId = chip::app::Clusters::{{asUpperCamelCase parent.name}}::Commands::{{asUpperCamelCase name}}::Id;

return ClusterCommand::SendGroupCommand(groupId, fabricIndex, {{asHex parent.code 8}}, {{asHex code 8}}, mRequest);
ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on Group %u", clusterId, commandId, groupId);

return ClusterCommand::SendGroupCommand(groupId, fabricIndex, clusterId, commandId, mRequest);
}

private:
Expand Down
22 changes: 18 additions & 4 deletions examples/darwin-framework-tool/templates/commands.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include <commands/clusters/ReportCommandBridge.h>
#include <commands/clusters/WriteAttributeCommandBridge.h>
#include <app-common/zap-generated/cluster-objects.h>
#include <app-common/zap-generated/ids/Clusters.h>
#include <app-common/zap-generated/ids/Commands.h>

{{> clusters_header}}

Expand Down Expand Up @@ -52,7 +54,10 @@ public:

CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override
{
ChipLogProgress(chipTool, "Sending cluster ({{asHex parent.code 8}}) command ({{asHex code 8}}) on endpoint %u", endpointId);
constexpr chip::ClusterId clusterId = chip::app::Clusters::{{asUpperCamelCase parent.name}}::Id;
constexpr chip::CommandId commandId = chip::app::Clusters::{{asUpperCamelCase parent.name}}::Commands::{{asUpperCamelCase name}}::Id;

ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId);

dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL);
__auto_type * cluster = [[MTRBaseCluster{{asUpperCamelCase parent.name preserveAcronyms=true}} alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue];
Expand Down Expand Up @@ -127,7 +132,10 @@ public:

CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override
{
ChipLogProgress(chipTool, "Sending cluster ({{asHex parent.code 8}}) ReadAttribute ({{asHex code 8}}) on endpoint %u", endpointId);
constexpr chip::ClusterId clusterId = chip::app::Clusters::{{asUpperCamelCase parent.name}}::Id;
constexpr chip::AttributeId attributeId = chip::app::Clusters::{{asUpperCamelCase parent.name}}::Attributes::{{asUpperCamelCase name}}::Id;

ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId);

dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL);
__auto_type * cluster = [[MTRBase{{>cluster}} alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue];
Expand Down Expand Up @@ -180,7 +188,10 @@ public:

CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override
{
ChipLogProgress(chipTool, "Sending cluster ({{asHex parent.code 8}}) WriteAttribute ({{asHex code 8}}) on endpoint %u", endpointId);
constexpr chip::ClusterId clusterId = chip::app::Clusters::{{asUpperCamelCase parent.name}}::Id;
constexpr chip::AttributeId attributeId = chip::app::Clusters::{{asUpperCamelCase parent.name}}::Attributes::{{asUpperCamelCase name}}::Id;

ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId);
dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL);
__auto_type * cluster = [[MTRBase{{>cluster}} alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue];
__auto_type * params = [[MTRWriteParams alloc] init];
Expand Down Expand Up @@ -234,7 +245,10 @@ public:

CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override
{
ChipLogProgress(chipTool, "Sending cluster ({{asHex parent.code 8}}) ReportAttribute ({{asHex code 8}}) on endpoint %u", endpointId);
constexpr chip::ClusterId clusterId = chip::app::Clusters::{{asUpperCamelCase parent.name}}::Id;
constexpr chip::CommandId attributeId = chip::app::Clusters::{{asUpperCamelCase parent.name}}::Attributes::{{asUpperCamelCase name}}::Id;

ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId);
dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL);
__auto_type * cluster = [[MTRBase{{>cluster}} alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue];
__auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package com.matter.controller.commands.pairing
import chip.devicecontroller.ChipDeviceController
import com.matter.controller.commands.common.CredentialsIssuer

class PairCodeCommand(controller: ChipDeviceController, credsIssue: CredentialsIssuer?) :
class PairCodeCommand(val controller: ChipDeviceController, credsIssue: CredentialsIssuer?) :
PairingCommand(controller, "code", credsIssue, PairingModeType.CODE, PairingNetworkType.NONE) {
override fun runCommand() {
currentCommissioner()
Expand All @@ -34,5 +34,7 @@ class PairCodeCommand(controller: ChipDeviceController, credsIssue: CredentialsI
)
currentCommissioner().setCompletionListener(this)
waitCompleteMs(getTimeoutMillis())

println("Commissioner Node ID : ${controller.getControllerNodeId()}")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ import com.matter.controller.commands.common.CredentialsIssuer

private const val MATTER_PORT = 5540

class PairOnNetworkLongCommand(controller: ChipDeviceController, credsIssue: CredentialsIssuer?) :
class PairOnNetworkLongCommand(
val controller: ChipDeviceController,
credsIssue: CredentialsIssuer?
) :
PairingCommand(
controller,
"onnetwork-long",
Expand All @@ -43,5 +46,7 @@ class PairOnNetworkLongCommand(controller: ChipDeviceController, credsIssue: Cre
)
currentCommissioner().setCompletionListener(this)
waitCompleteMs(getTimeoutMillis())

println("Commissioner Node ID : ${controller.getControllerNodeId()}")
}
}
19 changes: 19 additions & 0 deletions examples/lighting-app/esp32/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,25 @@ and refer
[building and commissioning](../../../docs/guides/esp32/build_app_and_commission.md)
guides to get started.

### Enabling ESP-Insights:

- Before building the app, enable the option: ESP_INSIGHTS_ENABLED through
menuconfig.

- Create a file named insights_auth_key.txt in the main directory of the
example.

- Follow the steps
present[here](https://github.com/espressif/esp-insights/blob/main/examples/README.md#set-up-esp-insights-account)
to set up an insights_account and the auth key created while setting it up
will be used in the example.

- Download the auth key and copy Auth Key to the example

```
cp /path/to/auth/key.txt path/to/connectedhomeip/examples/lighting-app/esp32/main/insights_auth_key.txt
```

---

- [Cluster Control](#cluster-control)
Expand Down
4 changes: 4 additions & 0 deletions examples/lighting-app/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ include("${CHIP_ROOT}/build/chip/esp32/esp32_codegen.cmake")
chip_app_component_codegen("${CHIP_ROOT}/examples/lighting-app/lighting-common/lighting-app.matter")
chip_app_component_zapgen("${CHIP_ROOT}/examples/lighting-app/lighting-common/lighting-app.zap")

if (CONFIG_ENABLE_ESP_INSIGHTS_TRACE)
target_add_binary_data(${COMPONENT_TARGET} "insights_auth_key.txt" TEXT)
endif()

set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17)
target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H")
target_compile_options(${COMPONENT_LIB} PUBLIC
Expand Down
23 changes: 23 additions & 0 deletions examples/lighting-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,20 @@
#include <platform/ESP32/ESP32SecureCertDACProvider.h>
#endif

#if CONFIG_ENABLE_ESP_INSIGHTS_TRACE
#include <esp_insights.h>
#endif

using namespace ::chip;
using namespace ::chip::Credentials;
using namespace ::chip::DeviceManager;
using namespace ::chip::DeviceLayer;

#if CONFIG_ENABLE_ESP_INSIGHTS_TRACE
extern const char insights_auth_key_start[] asm("_binary_insights_auth_key_txt_start");
extern const char insights_auth_key_end[] asm("_binary_insights_auth_key_txt_end");
#endif

static const char * TAG = "light-app";

static AppDeviceCallbacks EchoCallbacks;
Expand Down Expand Up @@ -125,6 +134,20 @@ extern "C" void app_main()
chip::rpc::Init();
#endif

#if CONFIG_ENABLE_ESP_INSIGHTS_TRACE
esp_insights_config_t config = {
.log_type = ESP_DIAG_LOG_TYPE_ERROR | ESP_DIAG_LOG_TYPE_WARNING | ESP_DIAG_LOG_TYPE_EVENT,
.auth_key = insights_auth_key_start,
};

esp_err_t ret = esp_insights_init(&config);

if (ret != ESP_OK)
{
ESP_LOGE(TAG, "Failed to initialize ESP Insights, err:0x%x", ret);
}
#endif

ESP_LOGI(TAG, "==================================================");
ESP_LOGI(TAG, "chip-esp32-light-example starting");
ESP_LOGI(TAG, "==================================================");
Expand Down
2 changes: 2 additions & 0 deletions examples/lighting-app/esp32/sdkconfig_rpc.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,5 @@ CONFIG_ENABLE_PW_RPC=y

# Enable HKDF in mbedtls
CONFIG_MBEDTLS_HKDF_C=y

CONFIG_DIAG_USE_EXTERNAL_LOG_WRAP=y
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,5 @@ CONFIG_ENABLE_PW_RPC=y

# Enable HKDF in mbedtls
CONFIG_MBEDTLS_HKDF_C=y

CONFIG_DIAG_USE_EXTERNAL_LOG_WRAP=y
2 changes: 2 additions & 0 deletions examples/ota-requestor-app/esp32/sdkconfig_rpc.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,5 @@ CONFIG_ENABLE_PW_RPC=y

# Enable HKDF in mbedtls
CONFIG_MBEDTLS_HKDF_C=y

CONFIG_DIAG_USE_EXTERNAL_LOG_WRAP=y
2 changes: 2 additions & 0 deletions examples/pigweed-app/esp32/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,5 @@ CONFIG_DEVICE_PRODUCT_ID=0x800B

# Enable HKDF in mbedtls
CONFIG_MBEDTLS_HKDF_C=y

CONFIG_DIAG_USE_EXTERNAL_LOG_WRAP=y
12 changes: 12 additions & 0 deletions examples/platform/esp32/PigweedLogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
#include <pw_hdlc/encoder.h>
#include <pw_stream/sys_io_stream.h>

#if CONFIG_ENABLE_ESP_INSIGHTS_TRACE && CONFIG_DIAG_USE_EXTERNAL_LOG_WRAP
#include <esp_diagnostics.h>
#endif

namespace PigweedLogger {
namespace {

Expand Down Expand Up @@ -126,6 +130,10 @@ extern "C" void __wrap_esp_log_write(esp_log_level_t level, const char * tag, co
}
#endif

#if CONFIG_ENABLE_ESP_INSIGHTS_TRACE && CONFIG_DIAG_USE_EXTERNAL_LOG_WRAP
esp_diag_log_writev(level, tag, format, v);
#endif

va_end(v);
}

Expand Down Expand Up @@ -153,6 +161,10 @@ extern "C" void __wrap_esp_log_writev(esp_log_level_t level, const char * tag, c
PigweedLogger::putString(logResetColor, strlen(logResetColor));
}
#endif

#if CONFIG_ENABLE_ESP_INSIGHTS_TRACE && CONFIG_DIAG_USE_EXTERNAL_LOG_WRAP
esp_diag_log_write(level, tag, format, v);
#endif
}

} // namespace PigweedLogger
6 changes: 3 additions & 3 deletions examples/platform/silabs/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ extern "C" {
#include <stdint.h>

#ifdef SIWX_917
#include "RS1xxxx_9117.h"
#include "si91x_device.h"
extern uint32_t SystemCoreClock;
#else // For EFR32
#include "RTE_Components.h"
Expand Down Expand Up @@ -227,9 +227,9 @@ See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
#endif // DIC
#else // SL_WIFI
#if SL_CONFIG_OPENTHREAD_LIB == 1
#define configTOTAL_HEAP_SIZE ((size_t)(28 * 1024))
#define configTOTAL_HEAP_SIZE ((size_t)(29 * 1024))
#else
#define configTOTAL_HEAP_SIZE ((size_t)(26 * 1024))
#define configTOTAL_HEAP_SIZE ((size_t)(27 * 1024))
#endif // SL_CONFIG_OPENTHREAD_LIB
#endif // configTOTAL_HEAP_SIZE
#endif // configTOTAL_HEAP_SIZE
Expand Down
5 changes: 1 addition & 4 deletions examples/platform/silabs/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,10 @@ if (chip_enable_wifi) {
assert(use_rs9116 || use_wf200 || use_SiWx917)
import("${chip_root}/src/platform/silabs/wifi_args.gni")

if (use_rs9116) {
if (use_rs9116 || use_SiWx917) {
wiseconnect_sdk_root =
"${chip_root}/third_party/silabs/wiseconnect-wifi-bt-sdk"
import("rs911x/rs911x.gni")
} else if (use_SiWx917) {
wisemcu_sdk_root = "${chip_root}/third_party/silabs/wisemcu-wifi-bt-sdk"
import("rs911x/rs9117.gni")
}
if (use_wf200) {
import("wf200/wf200.gni")
Expand Down
Loading

0 comments on commit 953ee75

Please sign in to comment.