diff --git a/.github/workflows/darwin.yaml b/.github/workflows/darwin.yaml
index a58617131a035d..0602b735d36b88 100644
--- a/.github/workflows/darwin.yaml
+++ b/.github/workflows/darwin.yaml
@@ -119,13 +119,10 @@ jobs:
run: |
xcodebuild -target "MatterTvCastingBridge" -sdk iphoneos
working-directory: examples/tv-casting-app/darwin/MatterTvCastingBridge
- - name: Uploading .ips files in Xcode derived data to debug the failure
- uses: actions/upload-artifact@v4
- if: ${{ failure() && !env.ACT }}
- with:
- name: darwin-framework-derived-data
- path: ~/Library/Developer/Xcode/DerivedData/**/*.ips
- retention-days: 5
+ - name: Collect crash logs
+ run: |
+ mkdir -p /tmp/darwin/framework-tests
+ find ~/Library/Developer/Xcode/DerivedData /Library/Logs/DiagnosticReports -name '*.ips' -print0 | xargs -0 -J % cp % /tmp/darwin/framework-tests
- name: Uploading log files
uses: actions/upload-artifact@v4
if: ${{ failure() && !env.ACT }}
diff --git a/.github/workflows/java-tests.yaml b/.github/workflows/java-tests.yaml
index 3aa6935d1735c4..8d21ca0bd4c56d 100644
--- a/.github/workflows/java-tests.yaml
+++ b/.github/workflows/java-tests.yaml
@@ -133,7 +133,7 @@ jobs:
--tool-args "onnetwork-long-im-invoke --nodeid 1 --setup-pin-code 20202021 --discriminator 3840 -t 1000" \
--factoryreset \
'
- - name: Run IM Batch Invoke Test
+ - name: Run IM Extendable Invoke Test
run: |
scripts/run_in_python_env.sh out/venv \
'./scripts/tests/run_java_test.py \
@@ -141,7 +141,7 @@ jobs:
--app-args "--discriminator 3840 --interface-id -1" \
--tool-path out/linux-x64-java-matter-controller \
--tool-cluster "im" \
- --tool-args "onnetwork-long-im-batch-invoke --nodeid 1 --setup-pin-code 20202021 --discriminator 3840 -t 1000" \
+ --tool-args "onnetwork-long-im-extendable-invoke --nodeid 1 --setup-pin-code 20202021 --discriminator 3840 -t 1000" \
--factoryreset \
'
- name: Run IM Read Test
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index a5398ccb7567a2..dca562c57bf2f1 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -123,12 +123,10 @@ jobs:
--known-failure app/util/generic-callback-stubs.cpp \
--known-failure app/util/im-client-callbacks.h \
--known-failure app/util/MatterCallbacks.h \
- --known-failure app/util/message.cpp \
--known-failure app/util/odd-sized-integers.h \
--known-failure app/util/util.cpp \
--known-failure app/util/util.h \
--known-failure app/WriteHandler.h \
- --known-failure lib/core/CHIPVendorIdentifiers.hpp \
--known-failure platform/DeviceSafeQueue.cpp \
--known-failure platform/DeviceSafeQueue.h \
--known-failure platform/GLibTypeDeleter.h \
diff --git a/build/chip/chip_codegen.gni b/build/chip/chip_codegen.gni
index 08d9f17da6c1be..07f24bdc3e6bc0 100644
--- a/build/chip/chip_codegen.gni
+++ b/build/chip/chip_codegen.gni
@@ -35,7 +35,7 @@ template("_chip_build_time_codegen") {
include_dirs = [ target_gen_dir ]
}
- pw_python_action("${_name}_codegen") {
+ pw_python_action("${_name}_generate") {
script = "${chip_root}/scripts/codegen.py"
# TODO: this seems to touch internals. Is this ok? speeds up builds!
@@ -99,7 +99,7 @@ template("_chip_build_time_codegen") {
if (!defined(deps)) {
deps = []
}
- deps += [ ":${_name}_codegen" ]
+ deps += [ ":${_name}_generate" ]
}
}
@@ -152,7 +152,7 @@ template("_chip_build_time_zapgen") {
_output_subdir = "zap-generated"
}
- pw_python_action("${_name}_zap") {
+ pw_python_action("${_name}_generate") {
script = "${chip_root}/scripts/tools/zap/generate.py"
# TODO: this seems to touch internals. Is this ok? speeds up builds!
@@ -211,7 +211,7 @@ template("_chip_build_time_zapgen") {
if (!defined(public_deps)) {
public_deps = []
}
- public_deps += [ ":${_name}_zap" ]
+ public_deps += [ ":${_name}_generate" ]
}
}
diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn
index 01626726e0b9af..7eb09b79c4c22d 100644
--- a/build/config/BUILDCONFIG.gn
+++ b/build/config/BUILDCONFIG.gn
@@ -76,11 +76,11 @@ if (_chip_defaults.custom_toolchain != "") {
} else {
_target_compiler = "gcc"
}
-
_default_toolchain = "${_build_overrides.build_root}/toolchain/linux:linux_${target_cpu}_${_target_compiler}"
-} else if (target_os == host_os &&
- (target_cpu == host_cpu ||
- (target_cpu == "arm64e" && host_cpu == "arm64"))) {
+} else if (host_os == "mac" && (target_os == "mac" || target_os == "ios")) {
+ # On Mac the host toolchain supports building for all mac and ios targets
+ _default_toolchain = host_toolchain
+} else if (target_os == host_os && target_cpu == host_cpu) {
_default_toolchain = host_toolchain
} else if (target_os == "freertos") {
if (_chip_defaults.is_clang) {
@@ -113,9 +113,6 @@ if (_chip_defaults.custom_toolchain != "") {
} else {
assert(false, "Unsupported target_cpu: ${current_cpu}")
}
-} else if (target_os == "ios") {
- _default_toolchain =
- "${_build_overrides.build_root}/toolchain/ios:ios_${target_cpu}"
} else if (target_os == "tizen") {
_default_toolchain =
"${_build_overrides.build_root}/toolchain/tizen:tizen_${target_cpu}"
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index 7ada1348f797b4..df85153297cad7 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -343,7 +343,7 @@ config("cosmetic_default") {
}
config("runtime_default") {
- if (is_clang) {
+ if (is_clang) { # Using Pigweed clang instead of Darwin host clang
configs = [
"$dir_pw_toolchain/host_clang:no_system_libcpp",
"$dir_pw_toolchain/host_clang:xcode_sysroot",
@@ -402,7 +402,7 @@ config("sanitize_address") {
]
ldflags = cflags
- if (target_os == "mac" || target_os == "ios") {
+ if ((target_os == "mac" || target_os == "ios") && !is_clang) {
defines += [ "_LIBCPP_HAS_NO_ASAN" ]
}
}
diff --git a/build/toolchain/ios/BUILD.gn b/build/toolchain/ios/BUILD.gn
deleted file mode 100644
index c86dfcb83b38d5..00000000000000
--- a/build/toolchain/ios/BUILD.gn
+++ /dev/null
@@ -1,42 +0,0 @@
-# Copyright 2020 The Pigweed Authors
-# Copyright (c) 2020 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_root}/toolchain/gcc_toolchain.gni")
-
-gcc_toolchain("ios_arm") {
- toolchain_args = {
- current_os = "ios"
- current_cpu = "arm"
- is_clang = false
- }
-}
-
-gcc_toolchain("ios_arm64") {
- toolchain_args = {
- current_os = "ios"
- current_cpu = "arm64"
- is_clang = false
- }
-}
-
-gcc_toolchain("ios_x64") {
- toolchain_args = {
- current_os = "ios"
- current_cpu = "x86_64"
- is_clang = false
- }
-}
diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter
index 5a7b510b05b0c8..89823f18e7896f 100644
--- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter
+++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter
@@ -7761,7 +7761,7 @@ endpoint 1 {
callback attribute eventList;
callback attribute attributeList;
ram attribute featureMap default = 0x0001;
- ram attribute clusterRevision default = 5;
+ ram attribute clusterRevision default = 6;
handle command Off;
handle command On;
@@ -9134,7 +9134,7 @@ endpoint 2 {
callback attribute eventList;
callback attribute attributeList;
ram attribute featureMap default = 0x0001;
- ram attribute clusterRevision default = 5;
+ ram attribute clusterRevision default = 6;
handle command Off;
handle command On;
diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
index 21bcfee37b5e0d..9dde80962f52f1 100644
--- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
+++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
@@ -6659,7 +6659,7 @@
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
- "defaultValue": "5",
+ "defaultValue": "6",
"reportable": 1,
"minInterval": 0,
"maxInterval": 65344,
@@ -6895,7 +6895,7 @@
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
- "defaultValue": "5",
+ "defaultValue": "6",
"reportable": 1,
"minInterval": 0,
"maxInterval": 65344,
@@ -23993,7 +23993,7 @@
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
- "defaultValue": "5",
+ "defaultValue": "6",
"reportable": 1,
"minInterval": 0,
"maxInterval": 65344,
diff --git a/examples/android/CHIPTool/app/src/main/res/layout/wildcard_fragment.xml b/examples/android/CHIPTool/app/src/main/res/layout/wildcard_fragment.xml
index 22ee5d4fb6a5e7..4387724ef847ef 100644
--- a/examples/android/CHIPTool/app/src/main/res/layout/wildcard_fragment.xml
+++ b/examples/android/CHIPTool/app/src/main/res/layout/wildcard_fragment.xml
@@ -181,7 +181,7 @@
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:visibility="gone"
- android:inputType="number" />
+ android:inputType="text" />
+ android:inputType="text"
+ android:hint="@string/wildcard_invoke_value_help_label"/>
Write Value
Data Version
optional
- Invoke Value
+ Invoke Value(Json)
+ Example: {"0:UINT":1}
Please add it to the list using Add Button.
Subscription established
diff --git a/examples/darwin-framework-tool/BUILD.gn b/examples/darwin-framework-tool/BUILD.gn
index 9dcbddbbfd8cbf..6228643a958f81 100644
--- a/examples/darwin-framework-tool/BUILD.gn
+++ b/examples/darwin-framework-tool/BUILD.gn
@@ -139,6 +139,7 @@ action("build-darwin-framework") {
config("config") {
include_dirs = [
".",
+ "include",
"${chip_root}/examples/common",
"${chip_root}/examples/darwin-framework-tool/commands/common",
"${chip_root}/zzz_generated/darwin-framework-tool",
diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkLongImExtendableInvokeCommand.kt b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkLongImExtendableInvokeCommand.kt
index d80e71acb53d73..0b1a2ab7467f5c 100644
--- a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkLongImExtendableInvokeCommand.kt
+++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkLongImExtendableInvokeCommand.kt
@@ -38,7 +38,7 @@ class PairOnNetworkLongImExtendableInvokeCommand(
) :
PairingCommand(
controller,
- "onnetwork-long-im-batch-invoke",
+ "onnetwork-long-im-extendable-invoke",
credsIssue,
PairingModeType.ON_NETWORK,
PairingNetworkType.NONE,
diff --git a/examples/platform/silabs/display/demo-ui-bitmaps.h b/examples/platform/silabs/display/demo-ui-bitmaps.h
index b5a6103a8fddb2..2a46413adad5b9 100644
--- a/examples/platform/silabs/display/demo-ui-bitmaps.h
+++ b/examples/platform/silabs/display/demo-ui-bitmaps.h
@@ -29,6 +29,10 @@
#define ZIGBEE_BITMAP_WIDTH 16
#define ZIGBEE_BITMAP_HEIGHT 16
+#define ZIGBEE_BITMAP \
+ 0x3f, 0xfc, 0x07, 0xf0, 0xff, 0xc7, 0xff, 0x9f, 0x01, 0x9c, 0x00, 0x0e, 0x00, 0x07, 0x80, 0x03, 0xc0, 0x01, 0xe0, 0x00, 0x70, \
+ 0x80, 0x39, 0x80, 0xf9, 0xff, 0xfb, 0xff, 0x07, 0xe0, 0x1f, 0xfc
+
#define RAIL_BITMAP_WIDTH 16
#define RAIL_BITMAP_HEIGHT 16
diff --git a/examples/platform/silabs/display/demo-ui.c b/examples/platform/silabs/display/demo-ui.c
index a525ca9c231195..bccde3e3eaa449 100644
--- a/examples/platform/silabs/display/demo-ui.c
+++ b/examples/platform/silabs/display/demo-ui.c
@@ -23,6 +23,7 @@
#include "dmd/dmd.h"
#include "em_types.h"
#include "glib.h"
+#include "sl_component_catalog.h"
#include "sl_memlcd.h"
#if SL_WIFI && !SIWX_917
#include "spi_multiplex.h"
@@ -41,12 +42,8 @@
#define PROT2_ID_X_POSITION 79
// Matter Logo
-#define PROT2_BITMAP_WIDTH MATTER_LOGO_WIDTH
-#define PROT2_BITMAP_HEIGHT MATTER_LOGO_HEIGHT
#define PROT2_X_POSITION 104
#define PROT2_Y_POSITION (APP_Y_POSITION + (APP_Y_POSITION / 2))
-#define PROT2_BITMAP (matterLogoBitmap)
-#define PROT2_BITMAP_CONN (matterLogoBitmap)
// Networking Protocol Logo
#ifdef SL_WIFI
@@ -54,15 +51,16 @@
#define PROT1_BITMAP_HEIGHT WIFI_BITMAP_HEIGHT
#define PROT1_X_POSITION 8
#define PROT1_Y_POSITION (APP_Y_POSITION + (APP_Y_POSITION / 2))
-#define PROT1_BITMAP (networkBitMap)
-#define PROT1_BITMAP_CONN (networkBitMap)
#else
#define PROT1_BITMAP_WIDTH THREAD_BITMAP_WIDTH
#define PROT1_BITMAP_HEIGHT THREAD_BITMAP_HEIGHT
#define PROT1_X_POSITION 8
+#ifdef SL_CATALOG_ZIGBEE_ZCL_FRAMEWORK_CORE_PRESENT
+#define ZIGBEE_POSITION_Y (APP_Y_POSITION + (APP_Y_POSITION / 2) + (ZIGBEE_BITMAP_HEIGHT / 2))
+#define PROT1_Y_POSITION (APP_Y_POSITION + (APP_Y_POSITION / 2) - (ZIGBEE_BITMAP_HEIGHT / 2))
+#else
#define PROT1_Y_POSITION (APP_Y_POSITION + (APP_Y_POSITION / 2))
-#define PROT1_BITMAP (networkBitMap)
-#define PROT1_BITMAP_CONN (networkBitMap)
+#endif
#endif
/*******************************************************************************
@@ -82,6 +80,10 @@ static const uint8_t networkBitMap[] = { WIFI_BITMAP };
static const uint8_t networkBitMap[] = { THREAD_BITMAP };
#endif
+#ifdef SL_CATALOG_ZIGBEE_ZCL_FRAMEWORK_CORE_PRESENT
+static const uint8_t zigbeeBitMap[] = { ZIGBEE_BITMAP };
+#endif
+
// Future usage
// static const uint8_t unconnectedBitMap[] = { QUESTION_MARK_BITMAP };
@@ -141,14 +143,13 @@ void demoUIDisplayApp(bool on)
updateDisplay();
}
-void demoUIDisplayProtocol(demoUIProtocol protocol, bool isConnected)
+void demoUIDisplayProtocols()
{
- GLIB_drawBitmap(&glibContext, (protocol == DEMO_UI_PROTOCOL1 ? PROT1_X_POSITION : PROT2_X_POSITION),
- (protocol == DEMO_UI_PROTOCOL1 ? PROT1_Y_POSITION : PROT2_Y_POSITION),
- (protocol == DEMO_UI_PROTOCOL1 ? PROT1_BITMAP_WIDTH : PROT2_BITMAP_WIDTH),
- (protocol == DEMO_UI_PROTOCOL1 ? PROT1_BITMAP_HEIGHT : PROT2_BITMAP_HEIGHT),
- (protocol == DEMO_UI_PROTOCOL1 ? (isConnected ? PROT1_BITMAP_CONN : PROT1_BITMAP)
- : (isConnected ? PROT2_BITMAP_CONN : PROT2_BITMAP)));
+ GLIB_drawBitmap(&glibContext, PROT2_X_POSITION, PROT2_Y_POSITION, MATTER_LOGO_WIDTH, MATTER_LOGO_HEIGHT, matterLogoBitmap);
+ GLIB_drawBitmap(&glibContext, PROT1_X_POSITION, PROT1_Y_POSITION, PROT1_BITMAP_WIDTH, PROT1_BITMAP_HEIGHT, networkBitMap);
+#ifdef SL_CATALOG_ZIGBEE_ZCL_FRAMEWORK_CORE_PRESENT
+ GLIB_drawBitmap(&glibContext, PROT1_X_POSITION, ZIGBEE_POSITION_Y, ZIGBEE_BITMAP_WIDTH, ZIGBEE_BITMAP_HEIGHT, zigbeeBitMap);
+#endif
updateDisplay();
}
@@ -157,6 +158,5 @@ void demoUIClearMainScreen(uint8_t * name)
GLIB_clear(&glibContext);
demoUIDisplayHeader((char *) name);
demoUIDisplayApp(false);
- demoUIDisplayProtocol(DEMO_UI_PROTOCOL1, false);
- demoUIDisplayProtocol(DEMO_UI_PROTOCOL2, false);
+ demoUIDisplayProtocols();
}
diff --git a/examples/platform/silabs/display/demo-ui.h b/examples/platform/silabs/display/demo-ui.h
index baf4902ef6184b..aac7d4aa4640c9 100644
--- a/examples/platform/silabs/display/demo-ui.h
+++ b/examples/platform/silabs/display/demo-ui.h
@@ -126,7 +126,7 @@ void demoUIDisplayApp(bool on);
* @return
* void
*****************************************************************************/
-void demoUIDisplayProtocol(demoUIProtocol protocol, bool isConnected);
+void demoUIDisplayProtocols();
/**************************************************************************/
/**
diff --git a/examples/temperature-measurement-app/esp32/README.md b/examples/temperature-measurement-app/esp32/README.md
index 99347fc6ead9f4..71210102d932bd 100644
--- a/examples/temperature-measurement-app/esp32/README.md
+++ b/examples/temperature-measurement-app/esp32/README.md
@@ -34,7 +34,6 @@ contains three files:
```
main/diagnostic_logs
-├── crash.log
├── end_user_support.log
└── network_diag.log
```
@@ -53,8 +52,8 @@ chip-tool diagnosticlogs retrieve-logs-request 0 0 1 0
# Read network diagnostic using BDX protocol
chip-tool interactive start
> diagnosticlogs retrieve-logs-request 1 1 1 0 --TransferFileDesignator network-diag.log
-# Retrieve crash over BDX
-> diagnosticlogs retrieve-logs-request 1 1 1 0 --TransferFileDesignator crash.bin
+# Retrieve crash summary over BDX
+> diagnosticlogs retrieve-logs-request 2 1 1 0 --TransferFileDesignator crash-summary.bin
```
esp-idf supports storing and retrieving
@@ -73,15 +72,9 @@ This example's partition table and sdkconfig.default are already modified
- Retrieve the core dump using diagnostic logs cluster
```
- # Read crash logs over BDX
+ # Read crash summary over BDX
chip-tool interactive start
- > diagnosticlogs retrieve-logs-request 1 1 1 0 --TransferFileDesignator crash.bin
- ```
-
-- Decode the crash logs, using espcoredump.py
- ```
- espcoredump.py --chip (CHIP) info_corefile --core /tmp/crash.bin \
- --core-format elf build/chip-temperature-measurement-app.elf
+ > diagnosticlogs retrieve-logs-request 2 1 1 0 --TransferFileDesignator crash-summary.bin
```
## Optimization
diff --git a/examples/temperature-measurement-app/esp32/main/CMakeLists.txt b/examples/temperature-measurement-app/esp32/main/CMakeLists.txt
index 062266652dc303..89fa5e9f755455 100644
--- a/examples/temperature-measurement-app/esp32/main/CMakeLists.txt
+++ b/examples/temperature-measurement-app/esp32/main/CMakeLists.txt
@@ -55,7 +55,7 @@ set(SRC_DIRS_LIST
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers"
)
-set(PRIV_REQUIRES_LIST chip QRCode bt nvs_flash bootloader_support espcoredump)
+set(PRIV_REQUIRES_LIST chip QRCode bt nvs_flash espcoredump)
if (CONFIG_ENABLE_PW_RPC)
# Append additional directories for RPC build
diff --git a/examples/temperature-measurement-app/esp32/main/diagnostic-logs-provider-delegate-impl.cpp b/examples/temperature-measurement-app/esp32/main/diagnostic-logs-provider-delegate-impl.cpp
index 5034e3f928788f..55336ea76030dd 100644
--- a/examples/temperature-measurement-app/esp32/main/diagnostic-logs-provider-delegate-impl.cpp
+++ b/examples/temperature-measurement-app/esp32/main/diagnostic-logs-provider-delegate-impl.cpp
@@ -21,10 +21,6 @@
#if defined(CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH) && defined(CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF)
#include
-#include
-// Its a bit hackish but we need this in order to pull in the sizeof(core_dump_header_t)
-// we can even use the static 20 but, what if that gets chagned?
-#include "../include_core_dump/esp_core_dump_types.h"
#endif // defined(CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH) && defined(CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF)
using namespace chip;
@@ -95,34 +91,16 @@ size_t LogProvider::GetCrashSize()
size_t outSize = 0;
#if defined(CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH) && defined(CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF)
- size_t unusedOutAddr;
- esp_err_t esp_err = esp_core_dump_image_get(&unusedOutAddr, &outSize);
- VerifyOrReturnValue(esp_err == ESP_OK, 0, ChipLogError(DeviceLayer, "Failed to get core dump image, esp_err:%d", esp_err));
+ // Verify that the crash is present and sane
+ esp_err_t esp_err = esp_core_dump_image_check();
+ VerifyOrReturnValue(esp_err == ESP_OK, 0, ChipLogError(DeviceLayer, "Core dump image check failed, esp_err:%d", esp_err));
+
+ outSize = sizeof(esp_core_dump_summary_t);
#endif // defined(CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH) && defined(CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF)
return outSize;
}
-CHIP_ERROR LogProvider::MapCrashPartition(CrashLogContext * context)
-{
-#if defined(CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH) && defined(CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF)
- size_t outAddr, outSize;
- esp_err_t esp_err = esp_core_dump_image_get(&outAddr, &outSize);
- VerifyOrReturnError(esp_err == ESP_OK, CHIP_ERROR(ChipError::Range::kPlatform, esp_err),
- ChipLogError(DeviceLayer, "Failed to get core dump image, esp_err:%d", esp_err));
-
- /* map the full core dump parition, including the checksum. */
- esp_err = spi_flash_mmap(outAddr, outSize, SPI_FLASH_MMAP_DATA, &context->mappedAddress, &context->mappedHandle);
- VerifyOrReturnError(esp_err == ESP_OK, CHIP_ERROR(ChipError::Range::kPlatform, esp_err),
- ChipLogError(DeviceLayer, "Failed to mmap the crash partition, esp_err:%d", esp_err));
-
- context->crashSize = static_cast(outSize);
- return CHIP_NO_ERROR;
-#else
- return CHIP_ERROR_NOT_FOUND;
-#endif // defined(CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH) && defined(CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF)
-}
-
CHIP_ERROR LogProvider::PrepareLogContextForIntent(LogContext * context, IntentEnum intent)
{
context->intent = intent;
@@ -146,11 +124,24 @@ CHIP_ERROR LogProvider::PrepareLogContextForIntent(LogContext * context, IntentE
sCrashLogContext.Reset();
context->Crash.logContext = &sCrashLogContext;
- CHIP_ERROR err = MapCrashPartition(context->Crash.logContext);
- VerifyOrReturnError(err == CHIP_NO_ERROR, err, context->Crash.logContext = nullptr);
+ size_t crashSize = GetCrashSize();
+ VerifyOrReturnError(crashSize > 0, CHIP_ERROR_NOT_FOUND);
+
+ esp_core_dump_summary_t * summary =
+ reinterpret_cast(Platform::MemoryCalloc(1, sizeof(esp_core_dump_summary_t)));
+ VerifyOrReturnError(summary != nullptr, CHIP_ERROR_NO_MEMORY);
+
+ esp_err_t esp_err = esp_core_dump_get_summary(summary);
+ if (esp_err != ESP_OK)
+ {
+ ChipLogError(DeviceLayer, "Failed to get core dump image, esp_err:%d", esp_err);
+ Platform::MemoryFree(summary);
+ return CHIP_ERROR_NOT_FOUND;
+ }
- context->Crash.logContext->readOffset = sizeof(core_dump_header_t);
- context->Crash.logContext->isMapped = true;
+ context->Crash.logContext->crashSize = crashSize;
+ context->Crash.logContext->readOffset = 0;
+ context->Crash.logContext->summary = summary;
#else
return CHIP_ERROR_NOT_FOUND;
#endif // defined(CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH) && defined(CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF)
@@ -177,7 +168,7 @@ void LogProvider::CleanupLogContextForIntent(LogContext * context)
case IntentEnum::kCrashLogs: {
#if defined(CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH) && defined(CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF)
CrashLogContext * logContext = context->Crash.logContext;
- spi_flash_munmap(logContext->mappedHandle);
+ // Reset() frees the summary if allocated
logContext->Reset();
#endif // defined(CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH) && defined(CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF)
}
@@ -227,12 +218,15 @@ CHIP_ERROR LogProvider::GetDataForIntent(LogContext * context, MutableByteSpan &
case IntentEnum::kCrashLogs: {
#if defined(CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH) && defined(CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF)
CrashLogContext * logContext = context->Crash.logContext;
- size_t dataSize = logContext->crashSize - logContext->readOffset;
- auto count = std::min(dataSize, outBuffer.size());
+
+ VerifyOrReturnError(logContext->readOffset < logContext->crashSize, CHIP_ERROR_INCORRECT_STATE, outBuffer.reduce_size(0));
+
+ size_t dataSize = logContext->crashSize - logContext->readOffset;
+ auto count = std::min(dataSize, outBuffer.size());
VerifyOrReturnError(CanCastTo(count), CHIP_ERROR_INVALID_ARGUMENT, outBuffer.reduce_size(0));
- const uint8_t * readAddr = reinterpret_cast(logContext->mappedAddress) + logContext->readOffset;
+ const uint8_t * readAddr = reinterpret_cast(logContext->summary) + logContext->readOffset;
memcpy(outBuffer.data(), readAddr, count);
outBuffer.reduce_size(count);
@@ -257,12 +251,14 @@ CHIP_ERROR LogProvider::StartLogCollection(IntentEnum intent, LogSessionHandle &
{
VerifyOrReturnValue(IsValidIntent(intent), CHIP_ERROR_INVALID_ARGUMENT);
+#if defined(CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH) && defined(CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF)
// In case of crash logs we can only mmap at max once, so check before doing anything
if (intent == IntentEnum::kCrashLogs)
{
- VerifyOrReturnError(sCrashLogContext.isMapped == false, CHIP_ERROR_INCORRECT_STATE,
- ChipLogError(DeviceLayer, "Crash partition already mapped"));
+ VerifyOrReturnError(sCrashLogContext.summary == nullptr, CHIP_ERROR_INCORRECT_STATE,
+ ChipLogError(DeviceLayer, "Crash summary already allocated"));
}
+#endif // defined(CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH) && defined(CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF)
LogContext * context = reinterpret_cast(Platform::MemoryCalloc(1, sizeof(LogContext)));
VerifyOrReturnValue(context != nullptr, CHIP_ERROR_NO_MEMORY);
diff --git a/examples/temperature-measurement-app/esp32/main/include/diagnostic-logs-provider-delegate-impl.h b/examples/temperature-measurement-app/esp32/main/include/diagnostic-logs-provider-delegate-impl.h
index c3d1bd389fb39b..3431a54adc86a8 100644
--- a/examples/temperature-measurement-app/esp32/main/include/diagnostic-logs-provider-delegate-impl.h
+++ b/examples/temperature-measurement-app/esp32/main/include/diagnostic-logs-provider-delegate-impl.h
@@ -20,7 +20,10 @@
#include
#include