Skip to content

Releases: memfault/memfault-firmware-sdk

1.25.0

10 Jun 14:17
Compare
Choose a tag to compare

This is a feature release of the Memfault Firmware SDK. The main new feature
released in this version is support for tracking metrics through deep sleep on
ESP32 devices. Full release notes are below.

📈 Added

  • Zephyr:

    • Add a new choice config CONFIG_MEMFAULT_REBOOT_REASON_GET. By default,
      CONFIG_MEMFAULT_REBOOT_REASON_GET_HWINFO=y, which is supported by
      imply CONFIG_HWINFO in the overarching MEMFAULT symbol. This default
      enables better reboot reasons out-of-the-box via Zephyr's hwinfo module.
      The fall-back option is CONFIG_MEMFAULT_REBOOT_REASON_GET_BASIC, which
      provides a simple implementation. As before, users can override the default
      implementations with CONFIG_MEMFAULT_REBOOT_REASON_GET_CUSTOM=y.

    • Add a new Kconfig setting, CONFIG_MEMFAULT_ENABLE_REBOOT_DIAG_DUMP, to
      print the reboot reason code on system boot, for debugging purposes. This
      feature is enabled by default. It can be disabled with
      CONFIG_MEMFAULT_ENABLE_REBOOT_DIAG_DUMP=n.

    • Add a boot_time_ms metric, which tracks how long the system takes to boot
      the application. Can be disabled with CONFIG_MEMFAULT_METRICS_BOOT_TIME=n.

    • Add new builtin Wi-Fi metrics, enabled by default when CONFIG_WIFI=y, and
      can be disabled with CONFIG_MEMFAULT_METRICS_WIFI=n:

      • wifi_beacon_interval
      • wifi_dtim_interval
      • wifi_frequency_band
      • wifi_primary_channel
      • wifi_security_type
      • wifi_sta_rssi
      • wifi_standard_version
      • wifi_twt_capable
      • wifi_tx_rate_mbps (Zephyr 4.1.0+ only)

      These add on top of the existing Zephyr Wi-Fi metrics:

      • wifi_ap_oui
      • wifi_connected_time_ms
      • wifi_disconnect_count
    • Add an option to upload logs by default when using
      MEMFAULT_HTTP_PERIODIC_UPLOAD, controlled with the Kconfig symbol
      MEMFAULT_HTTP_PERIODIC_UPLOAD_LOGS. This can also be controlled at runtime
      with the included API
      memfault_zephyr_port_http_periodic_upload_logs(bool enable)

    • Add a new Kconfig option, CONFIG_MEMFAULT_PLATFORM_TIME_SINCE_BOOT_CUSTOM,
      to provide a custom implementation of
      memfault_platform_get_time_since_boot_ms() in your application. The
      default is an implementation using k_uptime_get().

  • ESP-IDF:

    • Add a boot_time_ms metric, which tracks how long the system takes to boot
      the application. Can be disabled with CONFIG_MEMFAULT_METRICS_BOOT_TIME=n.

    • Add support for tracking metrics across ESP32 deep sleep cycles, enabled
      with the Kconfig CONFIG_MEMFAULT_DEEP_SLEEP_SUPPORT=y. To utilize this
      feature, these functions must be called by the application:

      • memfault_platform_deep_sleep_save_state()

        Must be called just prior to entering deep sleep
        (esp_deep_sleep_start())

      • memfault_platform_deep_sleep_restore_state()

        Must be called before memfault_platform_boot() in the application
        startup sequence.

      This feature includes built-in metrics for tracking deep sleep:

      • deep_sleep_time_ms - time spent in deep sleep
      • active_time_ms - time spent out of deep sleep
      • deep_sleep_wakeup_count - number of times the device woke up from deep
        sleep

      There are several Kconfig options for controlling the deep sleep feature,
      including controlling the heartbeat trigger and HTTP periodic upload. See
      menuconfig "Memfault deep sleep support" or
      ports/esp_idf/memfault/Kconfig for
      details.

    • Add new metrics tracking flash usage:

      • flash_spi_erase_bytes
      • flash_spi_write_bytes
      • flash_spi_total_size_bytes
    • Add capture of the ESP-IDF Task Watchdog stuck task list in coredumps. This
      is enabled by default if ESP-IDF Task Watchdog is enabled, and can be
      disabled with the Kconfig
      CONFIG_MEMFAULT_COREDUMP_CAPTURE_TASK_WATCHDOG=n.

🛠️ Changed

  • nRF Connect SDK:

    • CONFIG_MEMFAULT_REBOOT_REASON_GET_CUSTOM is now a choice in the new choice
      config CONFIG_MEMFAULT_REBOOT_REASON_GET. As a result, it will be the
      default choice if CONFIG_MEMFAULT_NRF_CONNECT_SDK=y instead of being
      imply-ed by CONFIG_MEMFAULT_NRF_CONNECT_SDK to work around the
      restriction that choice configs cannot be selected. As before, users can
      override this behavior with CONFIG_MEMFAULT_REBOOT_REASON_GET_CUSTOM=n.
  • ESP-IDF:

    • Rename CONFIG_MEMFAULT_TIME_SINCE_BOOT_CUSTOM ->
      CONFIG_MEMFAULT_PLATFORM_TIME_SINCE_BOOT_CUSTOM. A new ESP-IDF port choice
      Kconfig CONFIG_MEMFAULT_PLATFORM_TIME_SINCE_BOOT now supports 3 settings
      for platform time since boot:

      1. MEMFAULT_PLATFORM_TIME_SINCE_BOOT_ESP_TIMER default, suitable for most
        applications
      2. MEMFAULT_PLATFORM_TIME_SINCE_BOOT_DEEP_SLEEP applicable for deep-sleep
        applications
      3. MEMFAULT_PLATFORM_TIME_SINCE_BOOT_CUSTOM disable builtin
        implementations and implement a custom
        memfault_platform_get_time_since_boot_ms()
    • Renamed the spi_flash_chip_id metric (added in 1.23.0) to
      flash_spi_manufacturer_id.

    • Renamed the wifi_auth_mode metric to wifi_security_type to more
      accurately indicate the property being measured.

  • General:

    • Add the demo component to the default set of components added to an
      Eclipse project when using the
      eclipse_patch.py utility. The default
      components can be overridden with the --components argument.

    • Coredumps no longer include the device serial by default. The uploading
      serial (passed to the chunks endpoint) is instead used to identify the
      device associated with the coredump. Enabling
      #define MEMFAULT_EVENT_INCLUDE_DEVICE_SERIAL 1 in
      memfault_platform_config.h will include the device serial in coredumps.

🐛 Fixed

  • ESP-IDF:

    • Remove debug logging from memfault_platform_time_get_current(). When log
      timestamps are enabled, and debug level logs are enabled, this function can
      infinitely recurse.

    • Fix Memfault Build ID insertion when
      CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES=y. Previously, the build ID was
      inserted at the wrong build step, resulting in a missing build ID in the
      flashable image.

  • Zephyr:

    • Remove debug logging from the RTC-backed
      memfault_platform_time_get_current() (enabled when
      CONFIG_MEMFAULT_SYSTEM_TIME_SOURCE_RTC=y). When log timestamps are
      enabled, logging from this function can result in infinite recursion under
      certain conditions.

    • Update the west module allowlist to include cmsis_6 in the
      Zephyr QEMU Sample App. The cmsis_6
      module is now used for TF-M and Cortex-M as of
      this PR.

    • Update the Memfault Zephyr logging backend to properly capture log lines
      when CONFIG_LOG_MODE_IMMEDIATE=y on Zephyr 3.7.0+.

  • Wiced:

1.24.0

06 May 18:45
Compare
Choose a tag to compare

📈 Added

  • General:

    • Add a new API, memfault_log_get_unsent_count(), which returns the log
      count and size in bytes of unsent logs in the log buffer. This can be used
      inside memfault_log_handle_saved_callback() for example to drain the
      packetized logs when a certain watermark is reached.
  • ESP-IDF:

    • Add a Kconfig option, CONFIG_MEMFAULT_TIME_SINCE_BOOT_CUSTOM, which when
      set =n, enables using a custom implementation of
      memfault_platform_get_time_since_boot_ms().

    • Add 2 new metrics for tracking raw network bytes rx / tx. These metrics
      track network IO traffic on the default netif:

      • network_rx_bytes
      • network_tx_bytes

      These metrics are enabled by default, and can be disabled with
      CONFIG_MEMFAULT_METRICS_NETWORK_IO=n

🛠️ Changed

  • FreeRTOS (including ESP-IDF):

    • Rename the thread stack usage measurement variable included in coredumps
      when MEMFAULT_COREDUMP_COMPUTE_THREAD_STACK_USAGE is enabled from
      high_watermark to stack_unused. This change is to make the
      implementation more readable. The Memfault backend is updated to process
      both the old and new formats.

    • FreeRTOS-detected stack overflows (via vApplicationStackOverflowHook) will
      now be correctly tagged as Stack Overflow for the trace reason in
      Memfault, instead of Assert.

🐛 Fixed

  • Zephyr:

    • Fix a null dereference when calling
      memfault_coredump_storage_compute_size_required() (eg the shell command
      mflt coredump_size).
  • General:

    • For the emlib WDOG port implementation,
      ports/emlib/wdog_software_watchdog.c,
      enable the WDOG when in EM1 mode for series2 chips.

    • Added support for MEMFAULT_REBOOT_REASON_CLEAR in the
      ports/nrf5_sdk/resetreas_reboot_tracking.c
      implementation, by default enabled (like other ports). This permits opting
      out of the auto-clearing of the NRF_POWER->RESETREAS register, in case the
      user needs it after the function runs.

  • FreeRTOS (including ESP-IDF):

    • Fix incorrect computation of per-thread stack usage metrics
      (MEMFAULT_FREERTOS_COLLECT_THREAD_METRICS). Before this fix, the returned
      values had 2 errors:

      1. the value is the unused stack space, not the used stack space
      2. on platforms where sizeof(StackType_t) is not 1 byte, the numerator
        when computing percentage is incorrectly scaled down by
        sizeof(StackType_t), resulting in significant under-reporting of the
        stack usage percentage.

      Users can apply device and software version filtering on dashboards to
      filter out reports from devices that are running an old version of the SDK.

  • ESP-IDF:

    • Fix a potential issue that would cause the wrong implementation of
      memfault_platform_time_get_current() to be included in the final link,
      when CONFIG_MEMFAULT_SYSTEM_TIME=y is enabled (default).

🛠️ Changed

  • ESP-IDF:

    • CONFIG_MEMFAULT_ENABLE_REBOOT_DIAG_DUMP now defaults to y instead of
      n, to print out the reboot reason on boot. Disable it with
      CONFIG_MEMFAULT_ENABLE_REBOOT_DIAG_DUMP=n.

1.23.1

17 Apr 22:17
Compare
Choose a tag to compare

🐛 Fixed

  • Modify the test command used in our public CircleCI job, to work around an
    issue with
    CircleCI's v2 container runtime,
    which uses cgroupv2 instead of cgroupv1.

1.23.0

16 Apr 14:22
Compare
Choose a tag to compare

📈 Added

  • General:

    • Improved support for run time tracking on FreeRTOS kernel version v11 and
      later, by adding compile-time checks for possible configuration issues.

    • Add reboot reason decoding for the NXP RW61x chip series, using the
      PMU.SYS_RST_STATUS register to determine the reset reason. Add the file at
      ports/nxp/rw61x/pmu_reboot_tracking.c
      to your project to make use of it!

    • Add reboot reason decoding for the SiLabs SiWx91x chip series. This
      implementation supports Power On Reset, Pin Reset, and Software Reset
      causes only. Please reach out if you are interested in
      other reset reasons. Add the file at
      sdk/embedded/ports/silabs/wiseconnect/siwx91x/siwx91x_reboot_tracking.c
      to your project to make use of it.

    • Add an
      implementation of memfault_reboot_reason_get()
      for the STM32H5xx series of MCUs, using the RCC-RSR register to determine
      the reset reason. Add the file to your project to make use of it!

  • ESP-IDF:

    • Add 2 new out-of-box metrics:

      • spi_flash_chip_id : the 24-bit RDID value of the SPI flash chip, for
        example "c84017" = GigaDevice GD25Q64 8MiB
      • esp_chip_revision : the ESP32 chip and revision, for example
        esp32c6-0.0 or esp32s3-0.2
    • For ESP-IDF v5.5 and later, enable -ggdb3 by default for enhanced
      debugging. This is controlled with the Kconfig CONFIG_MEMFAULT_GGDB3.

    • Set the User-Agent to MemfaultSDK/<version> when sending HTTP requests to
      Memfault.

🛠️ Changed

  • General:

    • Updated the internally used clang-format version to 20.1.0, latest at time
      of writing. This resulted in a few minor format changes in the SDK.
  • Zephyr:

  • nRF-Connect SDK:

    • Update the nRF-Connect SDK examples to use the
      latest nRF-Connect SDK version, v2.9.1.

    • Update the nRF91 example to enable the
      DATETIME subsystem, to tag SDK event and log data with timestamps once the
      network connection is activated.

  • ESP-IDF:

    • Update the prv_panic_safe_putstr() implementation to perform better on
      modern ESP-IDF versions (>=4.4.0). This function is used to output local
      prints during panic handling.

    • Add a Kconfig CONFIG_MEMFAULT_DATA_CHUNK_HANDLERS_CUSTOM to allow
      overriding memfault_esp_port_data_available() and
      memfault_esp_port_get_chunk(). If other MCUs are forwarding data to an
      ESP32 for transport, enable this option and provide definitions to handle
      additional sources. By default, these functions only check the local device
      for available chunks.

🐛 Fixed

  • ESP-IDF:

    • Correctly print the initial delay and period in seconds for the periodic
      upload task. Previously, this info log print was using the value in
      milliseconds.

1.22.0

19 Mar 21:10
Compare
Choose a tag to compare

📈 Added

  • General

    • Enable building the SDK on aarch64. Note that this only adds support for
      building the SDK on that target, full end-to-end support is not yet
      available.
  • Zephyr:

    • For SOC's with a data cache, flush the cache prior to performing a system
      reboot, to ensure data integrity of the RAM-backed reboot tracking data.
      This is added to the memfault_platform_reboot() default implementation,
      which can be overridden by the user if needed.

      SOC's without a cache will have no effect from this change.

🛠️ Changed

  • General:

    • MEMFAULT_LOG_TIMESTAMPS_ENABLE is now enabled by default. When enabled,
      and memfault_platform_time_get_current() returns a valid timestamp, logs
      will include a second-precision timestamp. This applies to both:

      • logs captured as part of a coredump
      • logs sent to Memfault after invoking memfault_log_trigger_collection()
    • Remove some 64-bit integer divides used when computing the built-in
      uptime_s metric, and in the FreeRTOS
      memfault_platform_get_time_since_boot_ms() implementation.

  • ESP-IDF:

    • Log lines that are only a single '\n' character are no longer recorded in
      the Memfault Log Buffer.

🚩 Deprecated

🔥 Removed

🐛 Fixed

  • Zephyr:

    • The hwinfo-based Reset Reason implementation did not clear the reset
      reason register after reading the data. Updated to properly call
      hwinfo_clear_reset_cause() after reading the reset reason.

🔒 Security

1.21.1

07 Mar 01:02
Compare
Choose a tag to compare

🐛 Fixed

  • General:

    • Disable MEMFAULT_LOG_TIMESTAMPS_ENABLE by default. The new timestamped log
      feature was enabled by default in the previous release, but only logs
      embedded in coredumps are fully supported. Logs captured with
      memfault_log_trigger_collection() do not yet support timestamps, so the
      feature should not be used in production until that support is added.

1.21.0

06 Mar 14:38
Compare
Choose a tag to compare

📈 Added

  • General:

    • Logs captured by Memfault now include a timestamp by default, when the
      platform implements memfault_platform_time_get_current(). This feature can
      be disabled by setting #define MEMFAULT_LOG_TIMESTAMPS_ENABLE 0 in
      memfault_platform_config.h.
  • ESP-IDF:

    • Add new built-in Wi-Fi metrics:

      • wifi_primary_channel - the primary channel ID of the associated Wi-Fi
        access point
      • wifi_auth_mode - the authentication mode of the associated Wi-Fi access
        point, for example WPA2_PSK
      • wifi_standard_version - the Wi-Fi version of the associated Wi-Fi access
        point, for example 802.11n

      These metrics are enabled by default and can be disabled (along with other
      built-in Wi-Fi metrics) with the Kconfig option
      CONFIG_MEMFAULT_ESP_WIFI_METRICS

🛠️ Changed

  • ESP-IDF:

    • Support cases where the IDF_VER build variable is set to
      "HEAD-HASH-NOTFOUND" (i.e. using an ESP-IDF SDK that is not a git repo),
      when setting the built-in metric MemfaultSdkMetric_os_version. In this
      case, the value is taken from the ESP_IDF_VERSION_x macros, which are less
      precise.

    • Use more specific Memfault reset reason codes for these watchdog reset
      types, previously all categorized as HardwareWatchdog

      • ESP_RST_INT_WDT -> SoftwareWatchdog
      • ESP_RST_TASK_WDT -> TaskWatchdog
      • ESP_RST_WDT (RTC watchdog, the real hardware watchdog), stays as
        HardwareWatchdog

🐛 Fixed

  • ESP-IDF:

    • Correctly set the Memfault Firmware SDK version inside the
      espressif component
      version of the SDK. Prior to this fix, the SDK version reports as
      "MemfaultSdkMetric_sdk_version": "0.0.0". No change to the SDK, only a
      tooling/release change.

1.20.0

09 Feb 21:19
Compare
Choose a tag to compare

📈 Added

  • General:

    • Make memfault_reboot_reason_get() and
      memfault_platform_metrics_timer_boot() weakly defined in the
      platform templates to make removing them optional when
      first integrating

    • Added a configuration option, MEMFAULT_CRC16_BUILTIN, that permits
      disabling the built-in crc16
      implementation. The user should provide a compatible implementation of
      memfault_crc16_compute(). For example, if the Zephyr CRC library is used,
      a compatible implementation would be:

      #include <zephyr/sys/crc.h>
      
      uint16_t memfault_crc16_compute(uint16_t crc_initial_value, const void *data,
                                      size_t data_len_bytes) {
        return crc16_itu_t(crc_initial_value, data, data_len_bytes);
      }

      A Zephyr Kconfig setting, CONFIG_MEMFAULT_CRC16_BUILTIN, is also provided
      to control this option.

      Thanks to @JordanYates for submitting this
      feature request in
      #84 !

    • Added an example daily_heartbeat session to the
      FreeRTOS QEMU example, which demonstrates
      how to send a daily heartbeat session to Memfault. Daily Heartbeats are a
      special category of Session Metrics, and can be used to track device
      properties over a longer interval than heartbeat metrics.

    • Added an optional field to the built-in
      FreeRTOS task stack usage metrics,
      .get_task_handle, which allows the user to provide a custom function to
      get the task handle for a given thread name, instead of using the thread
      name to identify the thread. This is useful in systems where there are
      threads with ambiguous names. The
      ESP32 example app is
      updated to use this feature for ESP-IDF <5.3, where on dual-core SOCs, the
      per-core idle threads are both named IDLE.

  • nRF Connect SDK:

    • Added a new Kconfig symbol CONFIG_MEMFAULT_FOTA_HTTP_FRAG_SIZE to enable
      controlling the HTTP fragment size when using NCS >=2.9.9. Previously,
      CONFIG_DOWNLOAD_CLIENT_HTTP_FRAG_SIZE_1024=y was required, but this option
      was deprecated in NCS 2.9.9.

    • Add built-in support for the thermal_cpu_c (CPU temperature) metric for
      nRF5x chips (nRF52 and nRF54 app core supported). Use the Kconfig setting
      MEMFAULT_METRICS_CPU_TEMP to disable the metric.

  • Zephyr

    • Add a new Kconfig setting, CONFIG_MEMFAULT_HTTP_CLIENT_TIMEOUT_MS, which
      controls the timeout for the Memfault HTTP client, used both for chunk
      upload and OTA operations. The default timeout is 5 seconds. Connections
      with poor latency may require a longer timeout to avoid premature
      disconnection. Thanks to @chirambaht for
      submitting this in
      #86!

🐛 Fixed

  • ESP-IDF:

    • Use the configuration MEMFAULT_LOG_MAX_LINE_SAVE_LEN to set the max length
      of a log line when CONFIG_MEMFAULT_LOG_USE_VPRINTF_HOOK=y, which is the
      default setting in ESP-IDF. Previously, the log line was arbitrarily
      truncated in the Memfault vprintf hook before being saved to the Memfault
      log buffer.
  • General:

    • Remove the MEMFAULT_PACKED attribute for the eMemfaultRebootReason
      declaration; this compiler extension is not supported on IAR EWARM's
      compiler. Change the assembly shim to properly zero-extend the enum constant
      to avoid ABI issues when invoking the C fault handling code.

🛠️ Changed

  • General:

    • Remove an extra underscore in the folder name when using the
      eclipse_patch.py utility with a port name that
      is one folder deep (e.g. freertos)

    • Rename the memfault_crc16_ccitt_compute() function to
      memfault_crc16_compute(). The CRC-16 algorithm used is canonically named
      CRC-16/XMODEM, not CRC-16/CCITT (aka CRC-16/KERMIT). The file
      implementing that function is left as memfault_crc16_ccitt.c for backwards
      compatibility. Thanks to @JordanYates for
      reporting this issue in
      #83!

  • Zephyr:

    • Add a missing Kconfig dependency to MEMFAULT_METRICS_THREADS,
      INIT_STACKS. Also add missing dependencies to the Kconfig option
      MEMFAULT_METRICS_DEFAULT_SET_ENABLE:

      • INIT_STACKS
      • THREAD_RUNTIME_STATS
      • THREAD_STACK_INFO

      Thanks to @JordanYates for reporting this
      problem in
      #86 !

    • Update the
      memfault_zephyr_port_post_data()/memfault_zephyr_port_post_data_return_size()
      functions to only open the TLS socket if there is data ready to send, which
      is otherwise wasteful, as the socket will be closed without sending any
      Memfault data.

    • Add an explicit module name, memfault-firmware-sdk, to the module
      manifest. This avoids issues when the SDK is registered in a Zephyr manifest
      under a directory name other than memfault-firmware-sdk. Thanks to
      @JordanYates for reporting this issue in
      #81!

    • Exclude unused stack space when capturing thread stacks, via the
      thread.stack_info.delta property. This reduces the amount of coredump
      storage used to capture thread stacks, especially when
      CONFIG_STACK_POINTER_RANDOM or CONFIG_THREAD_LOCAL_STORAGE is enabled.
      Thanks to @JordanYates for reporting this
      issue in #81!

  • nRF Connect SDK:

    • Remove use of child and parent image functionality in the nRF9160 sample
      app, and replace with sysbuild support. Child image support was deprecated
      in NCS 2.7.0 in favor of sysbuild.

    • Use the downloader library instead of the download client library when using
      NCS >= 2.9.9. The download_client was recently deprecated in favor of the
      downloader. Download client support is now in memfault_fota_legacy.c.

1.19.0

10 Jan 14:36
Compare
Choose a tag to compare

📈 Added

  • General:

    • Add an option to set the
      Self Test component output
      log level, MEMFAULT_SELF_TEST_OUTPUT_LOG, to control the verbosity of the
      Self Test output. Set it by selecting the Memfault Log macro to use, for
      example #define MEMFAULT_SELF_TEST_OUTPUT_LOG MEMFAULT_LOG_DEBUG. The
      default level is the same as before, MEMFAULT_LOG_INFO.

    • Add an
      implementation of memfault_reboot_reason_get()
      for the STM32U5xx series of MCUs, using the RCC-CSR register to determine
      the reset reason. Add the file to your project to make use of it!

    • Add an
      implementation for flash-backed coredump storage
      for the STM32U5xx series of MCUs, using the internal flash memory to store
      coredumps. Add the file to your project to make use of it!

    • Enable the MPU (Memory Protection Unit) in the
      FreeRTOS QEMU example, to demonstrate Memfault's
      MPU region analysis feature.
      This feature is enabled in a Memfault project by setting
      #define MEMFAULT_COLLECT_MPU_STATE 1 in memfault_platform_config.h. The
      MPU registers are captured as part of a coredump, and Memfault will analyze
      the configuration and include the result in the Trace viewer.

    • Add a new reboot reason code, kMfltRebootReason_TaskWatchdog, for marking
      crashes due to a Task Watchdog. Memfault has a
      built-in Task Watchdog system,
      and
      Zephyr
      and
      ESP-IDF
      both implement Task Watchdog systems.

  • FreeRTOS:

    • Add support for tracking per-thread stack usage in the
      Memfault FreeRTOS port.
      This feature is enabled by default and can be disabled by setting
      #define MEMFAULT_FREERTOS_COLLECT_THREAD_METRICS 0 in
      memfault_platform_config.h. The default threads monitored are IDLE and
      Tmr Svc.

      Threads are registered for tracking by defining
      MEMFAULT_METRICS_DEFINE_THREAD_METRICS() in the application. For example:

      //! Set the list of threads to monitor for stack usage. The metric keys must
      //! be defined in memfault_metrics_heartbeat_config.def, ex:
      //!
      //! MEMFAULT_METRICS_KEY_DEFINE_WITH_SCALE_VALUE(
      //!   memory_main_pct_max, kMemfaultMetricType_Unsigned,
      //!   CONFIG_MEMFAULT_METRICS_THREADS_MEMORY_SCALE_FACTOR
      //! )
      #include "memfault/ports/zephyr/thread_metrics.h"
      MEMFAULT_METRICS_DEFINE_THREAD_METRICS (
        // monitor the main thread stack usage
        {
          .thread_name = "main",
          .stack_usage_metric_key = MEMFAULT_METRICS_KEY(memory_main_pct_max),
        },
        // monitor the shell_uart thread stack usage
        {
          .thread_name = "shell_uart",
          .stack_usage_metric_key = MEMFAULT_METRICS_KEY(memory_shell_uart_pct_max),
        });
    • Add example usage of per-thread stack usage support to the
      FreeRTOS QEMU example for the idle, timer service,
      console input, metrics, and heap tasks.

    • Add tracking of libc heap usage via the memory_pct_max metric to the
      FreeRTOS QEMU example

  • Zephyr:

    • Add support for tracking per-thread stack usage in the
      Memfault Zephyr port.
      This feature is enabled by default and can be disabled by setting
      CONFIG_MEMFAULT_METRICS_THREADS=n. The default threads monitored are
      main and sysworkq.

      Threads are registered for tracking by defining
      MEMFAULT_METRICS_DEFINE_THREAD_METRICS() in the application. For example:

      //! Set the list of threads to monitor for stack usage. The metric keys must
      //! be defined in memfault_metrics_heartbeat_config.def, ex:
      //!
      //! MEMFAULT_METRICS_KEY_DEFINE_WITH_SCALE_VALUE(
      //!   memory_main_pct_max, kMemfaultMetricType_Unsigned,
      //!   CONFIG_MEMFAULT_METRICS_THREADS_MEMORY_SCALE_FACTOR
      //! )
      #include "memfault/ports/zephyr/thread_metrics.h"
      MEMFAULT_METRICS_DEFINE_THREAD_METRICS (
        {
          .thread_name = "main",
          .stack_usage_metric_key = MEMFAULT_METRICS_KEY(memory_main_pct_max),
        },
        {
          .thread_name = "shell_uart",
          .stack_usage_metric_key = MEMFAULT_METRICS_KEY(memory_shell_uart_pct_max),
        });
    • Update to support removal of the global CSTD compiler property (deprecated
      in Zephyr v3.7.0, and just removed in Zephyr main), when
      CONFIG_MEMFAULT_COMPACT_LOG is enabled. Thanks to
      @fouge for providing this fix in
      #78 !

    • Add a new built-in metric, cpu_usage_pct, which reports the percentage of
      the CPU used. This metric is enabled by default as part of the default set
      of metrics, controlled with CONFIG_MEMFAULT_METRICS_DEFAULT_SET_ENABLE.

    • For ARM targets implementing and enabling the MPU, automatically capture the
      and
      analyze the MPU configuration
      as part of a coredump. This can be controlled with the
      CONFIG_MEMFAULT_COREDUMP_COLLECT_MPU_STATE Kconfig option.

    • Add a new Kconfig option, CONFIG_MEMFAULT_METRICS_HEARTBEAT_INTERVAL_SECS,
      which should be used instead of
      #define MEMFAULT_METRICS_HEARTBEAT_INTERVAL_SECS xxx in
      memfault_platform_config.h. A build error will occur if the value is set
      in memfault_platform_config.h to enforce migrating the setting. Thanks to
      @JordanYates for reporting this feature
      request in
      #80

  • ESP-IDF:

    • Add support for correctly marking crashes triggered due to a Task Watchdog.
      A test command, esp_task_watchdog <cpuid>, has been added to the
      esp32 sample app to trigger a Task Watchdog fault on the
      specified core. Be sure to enable the Kconfig option
      CONFIG_ESP_TASK_WDT_PANIC=y to have the system panic when a Task Watchdog
      fault occurs. Memfault will capture and tag the fault appropriately, as for
      other fault types.

    • Add a new Kconfig option, CONFIG_MEMFAULT_METRICS_HEARTBEAT_INTERVAL_SECS,
      which should be used instead of
      #define MEMFAULT_METRICS_HEARTBEAT_INTERVAL_SECS xxx in
      memfault_platform_config.h. A build error will occur if the value is set
      in memfault_platform_config.h to enforce migrating the setting.

  • nRF-Connect SDK:

    • Add an implementation for reboot reason tracking on the nRF54Lx series of
      MCUs, using the RESETREAS register to determine the reset reason. This
      will be automatically enabled when building for an nRF54Lx series device
      (CONFIG_SOC_SERIES_NRF54LX=y).

    • Add example usage of per-thread stack usage support to the
      nRF9160 example for the idle, sysworkq,
      mflt http, WDT, and shell uart tasks.

🐛 Fixed

  • Zephyr:

    • Fix the MEMFAULT_METRICS_CPU_TEMP Kconfig dependencies, to correctly check
      for presence of the DT die-temp0 alias, and remove the dependency on
      ADC, which doesn't apply to all boards implementing a temp sensor. Thanks
      to @JordanYates for reporting this issue
      in #79 !

🛠️ Changed

  • General:

    • The eclipse_patch.py utility
      --memfault-sdk-dir argument is now optional, and defaults to the parent
      directory of the script folder.
  • FreeRTOS:

    • Renamed the FreeRTOS QEMU sample app heap metrics from
      Example_HeapFreeBytes and Example_HeapMinFreeBytes to
      FreeRTOS_HeapFreeBytes and FreeRTOS_HeapMinFreeBytes.
  • nRF-Connect SDK:

    • Update the nRF91 sample app to only enable
      the UART log backend. Previously both the SHELL and UART log backends were
      enabled, resulting in duplicate log lines emitted to the console.

    • Update the nRF91 sample app and the
      nRF5x sample app to use the latest version
      of the nRF-Connect SDK, v2.9.0.

  • Zephyr:

    • Renamed the QEMU sample app metric
      main_thread_cpu_time_permille -> cpu_usage_main_pct.

1.18.0

25 Nov 22:03
Compare
Choose a tag to compare

📈 Added

  • General:

    • Add a new built-in metric, uptime_s, which reports the total uptime of the
      device in seconds. This metrics is enabled by default, and can be disabled
      with #define MEMFAULT_METRICS_UPTIME_ENABLE 0 in
      memfault_platform_config.h.
  • Zephyr:

  • ESP-IDF:

    • Added support for dual-core coredumps on ESP32 and ESP32-S3. This feature is
      enabled by default and can be disabled with the Kconfig option
      CONFIG_MEMFAULT_COREDUMP_CPU_COUNT=1. Note: not all fault conditions will
      cause both CPU cores to be captured in the coredump. The SDK will always
      capture the core that triggered the fault, and if the non-faulting core is
      available for capture, it will be included as well.