Skip to content

Releases: memfault/memfault-firmware-sdk

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.

1.17.0

15 Nov 01:31
Compare
Choose a tag to compare

📈 Added

  • General:

    • Add parsing of an optional log message argument for the test_trace command
      in the core demo cli. This argument will be inserted as a
      custom log message with the trace event, which can be useful for testing the
      insertion of custom log messages into trace events at runtime.

    • Add the following built-in metrics, enabled by default (and quota-exempt):

      • MemfaultSDKMetric_log_recorded_lines : the total number of log lines
        written into the Memfault log buffer during the heartbeat interval
      • MemfaultSDKMetric_log_dropped_lines : the total number of log lines
        dropped (overwritten or not recorded) due to buffer exhaustion during the
        heartbeat interval

      For example, if the buffer is sufficiently large to store 10 logs, and 15
      logs are written:

      • MemfaultSDKMetric_log_recorded_lines will be 15
      • MemfaultSDKMetric_log_dropped_lines will be 5

      If 5 more logs are written:

      • MemfaultSDKMetric_log_recorded_lines will be 20
      • MemfaultSDKMetric_log_dropped_lines will be 10
    • Cosmetic updates to the examples/freertos/ app log format, including
      applying ANSI color codes based on log level.

      # Before:
      mflt> test_log
      Raw log!
      2024-11-14T17:01:12Z|4284 I Info log!
      2024-11-14T17:01:12Z|4284 W Warning log!
      2024-11-14T17:01:12Z|4284 E Error log!
      
      # After:
      mflt> test_log
      Raw log!
      MFLT:[INFO] Info log!
      MFLT:[WARN] Warning log!
      MFLT:[ERRO] Error log!
  • ESP-IDF:

    • Enable NTP time synchronization by default, controlled with the Kconfig
      option CONFIG_MEMFAULT_NTP_SYNC. After NTP synchronization, events
      (heartbeats and trace events) will be timestamped with the current device
      time.

    • Add a test_trace command to the ESP-IDF demo cli to capture an example
      trace event. This behaves the same as the test_trace command in the
      core demo cli.

    • Mark coredumps with the Software Watchdog crash reason if the IWDT
      triggered the fault, instead of marking them as Hard Fault.

    • Add OTA update check-ins to the HTTP client's periodic upload, controlled
      with the Kconfig option CONFIG_MEMFAULT_HTTP_PERIODIC_UPLOAD_OTA. When
      enabled, the system will be restarted after downloading the update. To
      customize this behavior, enable
      CONFIG_MEMFAULT_HTTP_PERIODIC_UPLOAD_OTA_CUSTOM_CBS, and implement the
      global callback struct g_memfault_ota_update_handler. This feature is
      disabled by default.

🐛 Fixed

  • General:

    • Add missing type promotion rules for variants of char pointers when
      encoding compact logs. Previously, these types that should promote to a
      string in the compact logging encoding fell into the default case of int,
      causing compact logging decode to fail when processed by the Memfault
      backend.
  • ESP-IDF:

    • Fix an issue when using compact logs with
      CONFIG_MEMFAULT_USE_MEMFAULT_BUILD_ID=y (default). The command would
      always run (was always out-of-date) when any idf.py [build|flash] command
      is run, even if the original .elf file did not change. This caused the
      log_fmt section (used for decoding compact logs) to be removed from the
      /memfault-esp32-demo-app.elf.memfault_log_fmt file, which causes Memfault
      Compact Logs to fail to decode. The command is fixed to only run when the
      .elf file changes.

1.16.0

24 Oct 19:41
Compare
Choose a tag to compare

🔥 Removed

  • Removed support for Zephyr < 2.7.0
  • Removed support for nRF-Connect SDK < 1.9.2
  • Removed support for ESP-IDF < 4.4.0

Please contact us if you need support for
earlier versions!

🐛 Fixed

  • General:

    • Correct an issue where eMemfaultRebootReason is expressed as a 4-byte type
      instead of 2-bytes when compiling with Clang with high optimization, when
      targeting ARM. This results in Coredumps tagged as Unknown instead of the
      correct reason code.

📈 Added

  • General:

    • Add a pair of optional user-provided functions,
      memfault_reboot_tracking_load() / memfault_reboot_tracking_save(), to
      allow users to provide their own implementations for saving and loading
      reboot tracking data. This is useful when the default implementation is not
      suitable for the platform or when the user wants to store the data in a
      different location.

    • The
      Stable Sessions Device Vital
      added in SDK version 1.15.0 is fully available and no longer considered
      experimental.

    • Add an optional memfault_port_coredump_save_begin() callback, for use by
      Memfault ports. This allows memfault_platform_coredump_save_begin() to be
      implemented by the platform instead, for custom pre-coredump operations.
      Thanks to @finger563 for reporting this issue in
      #77!

    • Improved API docs for events and data packetizer components by noting
      restrictions for use in ISR contexts

  • Zephyr:

    • Update the Qemu app to support the nucleo_l496zg board, with support for
      the Zephyr bbram subsystem, and implement the new
      memfault_reboot_tracking_load() / memfault_reboot_tracking_save()
      functions to demonstrate the functionality.
  • ESP-IDF:

    • New Kconfig setting, CONFIG_MEMFAULT_ENABLE_REBOOT_DIAG_DUMP, to print the
      ESP-IDF reboot reason code on system boot, for debugging purposes. This
      feature is disabled by default.

🛠️ Changed

  • General:

    • Update support links to refer to the preferred site
      https://mflt.io/contact-support instead of the Memfault support email.
      This link will redirect to a form where questions can be sent to the
      Memfault support team.
  • nRF-Connect SDK:

    • Changed the Kconfig symbol MEMFAULT_REBOOT_REASON_GET_CUSTOM to be imply
      instead of select when the nRF-Connect SDK is enabled. This permits users
      to disable the nrfx-based reboot reason tracking if needed.

1.15.0

15 Oct 19:29
Compare
Choose a tag to compare

📈 Added

  • General:

    • EXPERIMENTAL: Metrics Sessions now include a built-in metric for the
      Stable Sessions Device Vital
      (session.operational_crashes) which tracks crashes that occurred when a
      session is active.

🛠️ Changed

  • General:

    • Minor changes to support compiling with GCC ARM v4.9.3.

🐛 Fixed

  • Corrected a spelling error, renamed MEMFAULT_METRIS_KEY_DEFINE_WITH_SESSION_AND_SCALE_VALUE() to MEMFAULT_METRICS_KEY_DEFINE_WITH_SESSION_AND_SCALE_VALUE()

1.14.0

09 Oct 18:45
Compare
Choose a tag to compare

📈 Added

  • ESP-IDF:

    • The Memfault port will now disable the IWDT (Interrupt Watchdog Timer)
      before starting coredump saving, to prevent interrupting the coredump
      process. The ESP-IDF fault handler enables the WDT_RWDT hardware watchdog
      when a fault occurs, so there is still protection if the fault handling
      hangs.

1.13.0

08 Oct 16:35
Compare
Choose a tag to compare

📈 Added

  • FreeRTOS:

    • The SDK now has a config to control whether to split CPU usage per core when
      building for a multi-core device. Enable this setting by adding
      #define MEMFAULT_FREERTOS_RUNTIME_STATS_MULTI_CORE_SPLIT 1 to
      memfault_platform_config.h. This setting is disabled by default.
  • ESP-IDF:

    • Added a Kconfig, CONFIG_MEMFAULT_FREERTOS_RUNTIME_STATS_MULTI_CORE_SPLIT,
      to control MEMFAULT_FREERTOS_RUNTIME_STATS_MULTI_CORE_SPLIT. This Kconfig
      is enabled by default for multi-core devices.

🛠️ Changed

  • FreeRTOS:

    • Changed previous idle task run time percent metrics to measure CPU usage
      (i.e. the complement of the idle task run time)
    • Renamed the following metrics:
      • Single-Core + Multi-Core Default:
        • idle_task_run_time_percent -> cpu_usage_pct
      • Multi-Core Split:
        • idle0_task_run_time_percent -> cpu_usage_pct
        • idle1_task_run_time_percent -> cpu1_usage_pct
  • ESP-IDF:

    • Unknown or unclassified reboot reason codes returned by get_reset_reason()
      are now correctly recorded as kMfltRebootReason_Unknown instead of
      kMfltRebootReason_UnknownError (UnknownError is reserved for an
      "unexpected" reboot path, where Unknown is used when the reboot reason
      cannot be determined).

🚩 Deprecated

Support for the following vendor platform versions is deprecated in this
release, and will be removed in the following release:

  • ESP-IDF < v4.4 (Jan 26, 2022)
  • Zephyr < v2.7.0 (Oct 16, 2021)
  • nRF-Connect SDK < v1.9.2 (Jul 14, 2022)

Please contact us if you need support for earlier
versions!

1.12.0

25 Sep 19:42
Compare
Choose a tag to compare

📈 Added

  • ESP-IDF:

    • The SDK now supports being installed as an
      ESP Component from the Espressif
      registry, by adding the following lines to an esp-idf project's
      idf_component.yml manifest:

      dependencies:
        memfault/memfault-firmware-sdk:
          version: "1.12.0"
    • Heap Allocation Tracking is
      now enabled by default for ESP-IDF projects, controlled with the Kconfig
      symbol CONFIG_MEMFAULT_HEAP_STATS. The Memfault Trace UI will show
      information about the most recent heap allocations for malloc() calls.

🛠️ Changed

  • ESP-IDF:

    • The Memfault Build ID will be
      applied by default, controlled by the Kconfig setting
      CONFIG_MEMFAULT_USE_MEMFAULT_BUILD_ID. This is only valid for ESP-IDF
      versions >= 4.2.5 , and will cause a build error on older versions,
      requiring it to be set to n. Updating to this version of the SDK will
      require removing the similar logic in the project's CMakeLists.txt
      file (a build error will occur if both are present).

    • The Memfault Core Vital for
      Periodic Connectivity
      will now count failures to sync Memfault data if the HTTP connection cannot
      be established, but WiFi connectivity is available. This can occur when the
      WAN connection is down but the access point is still up, or if there is an
      external DNS failure. Previously this was not counted as a failure.

  • Zephyr

    • The Memfault HTTP client, enabled with Kconfig
      CONFIG_MEMFAULT_HTTP_ENABLE, requires POSIX_API to be enabled on newer
      versions of Zephyr. Previously, not explicitly enabling POSIX_API would
      result in a build error. Update it to be enabled by default in the Zephyr
      SDK, via Kconfig imply POSIX_API.

    • Zephyr 3.7.0+ requires enabling CONFIG_MBEDTLS_SHA1 when using Zephyr's
      mbedtls implementation. Memfault added a build-time check for this setting
      in Memfault SDK 1.11.2, but that check would also trip when not using
      Zephyr's mbedtls implementation. Update the build check to be more precise.

  • nRF-Connect SDK:

    • Minor changes to provide compatibility with NCS versions > 2.7.0, which
      target a Zephyr fork that is compatible with 3.7.0 but provides a
      "development" version number, 3.6.99.

🐛 Fixed

  • ESP-IDF:

    • Corrected a theoretical integer overflow issue in the demo CLI crash
      command, detected by static analysis tools. The impacted function was and is
      exclusively called with an argument of 10, so this issue was not
      exploitable in practice.

1.11.5

18 Sep 20:37
Compare
Choose a tag to compare

📈 Added

  • Zephyr:

    • Add the following built-in WiFi metrics for Zephyr devices, enabled by
      default on systems with WiFi:

      • wifi_connected_time_ms : time in milliseconds the device has been
        connected to a WiFi network
      • wifi_disconnect_count : number of times the device has disconnected from
        a WiFi network
      • wifi_ap_oui : the OUI of the WiFi AP the device is connected to

      The metrics can be disabled by setting CONFIG_MEMFAULT_METRICS_WIFI=n.

    • The Memfault Zephyr fault handler now labels faults as Stack Overflow, Bus
      Fault, MemManage Fault, and Usage Fault, among others, in addition to the
      existing Hard Fault label. Note that this does not change the types of
      faults collected (all these faults are already supported), but it does
      correct the label presented in the Memfault UI.

    • Add a new test command, mflt test stack_overflow, that will trigger a
      stack overflow fault when CONFIG_STACK_SENTINEL or
      CONFIG_MPU_STACK_GUARD is enabled.

    • The cpu_temp metric has been renamed to thermal_cpu_c to better reflect
      the metric's purpose. The metric is still collected by default on platforms
      with an enabled die-temp0 sensor, and can be disabled by setting
      CONFIG_MEMFAULT_METRICS_CPU_TEMP=n.

    • Add a new metric, memory_pct_max, which captures the max percentage of the
      heap used. It is enabled by default. This metric and the existing
      Heap_BytesFree metric are controlled with
      CONFIG_MEMFAULT_METRICS_MEMORY_USAGE.

  • ESP-IDF:

    • 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_esp_port_http_periodic_upload_logs(bool enable)

    • Add a new metric, memory_pct_max, which captures the max percentage of the
      heap used. It is enabled by default. This metric and the existing heap_*
      metrics are now controlled with CONFIG_MEMFAULT_METRICS_MEMORY_USAGE.

    • Print the Memfault OTA URL from memfault_esp_port_ota_update() when a new
      update is available, for example:

      esp32> memfault_ota_check
      I (98125) mflt: Checking for OTA Update
      Download URL: https://ota-cdn.memfault.com/2950/9757/19036619757?token=0123456789abcdef&expires=1726192800&v=2
      I (98775) mflt: Update available!
      
      esp32> memfault_ota_perform
      I (15515) mflt: Checking for OTA Update
      Download URL: https://ota-cdn.memfault.com/2950/9757/19036619757?token=0123456789abcdef&expires=1726192800&v=2
      I (16205) mflt: Starting OTA download ...

🛠️ Changed

  • Zephyr:

    • The cpu_temp metric has been renamed to thermal_cpu_c to better reflect
      the metric's purpose. The metric is still collected by default on platforms
      with an enabled die-temp0 sensor, and can be disabled by setting
      CONFIG_MEMFAULT_METRICS_CPU_TEMP=n.
  • ESP-IDF:

    • The cpu_temp metric has been renamed to thermal_cpu_c to better reflect
      the metric's purpose. The metric is still collected by default on ESP32
      variants that support it (all but ESP32), and can be disabled by setting
      CONFIG_MEMFAULT_METRICS_CPU_TEMP=n.

    • The Kconfig CONFIG_MEMFAULT_ESP_HEAP_METRICS has been replaced with
      CONFIG_MEMFAULT_METRICS_MEMORY_USAGE.

1.11.4

10 Sep 17:20
Compare
Choose a tag to compare

See CHANGELOG.md for release notes.