All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
This is a minor update release. Highlights:
Zephyr:
Add a new test command, mflt test isr_hang
, which will cause a busy loop hang inside a k_timer
, which normally is executing from an ISR context. The system will only exit this condition if there is a watchdog or other higher-priority interrupt capable of preempting the k_timer
ISR. The qemu
sample app is updated to enable a watchdog which generates an NMI exception, caught by Memfault.
Added a debug print when uploading data using CONFIG_MEMFAULT_HTTP_PERIODIC_UPLOAD
that shows the bytes sent:
[00:09:45.821,000] <dbg> mflt: memfault_platform_log: Uploaded 118 bytes of Memfault data
Only enabled when debug level prints are enabled for Memfault (CONFIG_MEMFAULT_LOG_LEVEL_DBG=y
).
Zephyr:
NMI exceptions are now properly handled. Prior to this change, a coredump was captured on NMI exceptions but the MSP context was not fully unwound and the NVIC state was not included in the trace data.
Add a new Kconfig option, CONFIG_MEMFAULT_COREDUMP_NVIC_INTERRUPTS_TO_COLLECT
, which controls the existing memfault_platform_config.h
setting MEMFAULT_NVIC_INTERRUPTS_TO_COLLECT
for Cortex-M targets. The default now is to collect all NUM_IRQS
as defined by Zephyr, which on many platforms will increase from the previous default of 32
. This improves the out-of-the-box information at the cost of 44 bytes in coredump storage consumed per additional 32 interrupts. Some example deltas shown below, including the byte delta in the stored coredump:
Platform | Previous Default | New Default | Byte Delta |
---|---|---|---|
nRF52840 | 32 | 64 (*48, rounded up to nearest multiple of 32) | +44 |
nRF91 | 32 | 96 (*65 rounded up) | +88 |
nRF53 | 32 | 96 (*69 rounded up) | +88 |
STM32F407 | 32 | 96 (*82 rounded up) | +88 |
STM32H7B0 | 32 | 160 (*155 rounded up) | +176 |
STM32H563 | 32 | 160 (*155 rounded up) | +176 |
To restore the previous default, set CONFIG_MEMFAULT_COREDUMP_NVIC_INTERRUPTS_TO_COLLECT=32
.
nRF-Connect SDK:
General:
Add a reference software watchdog port for the STM32L4 series LPTIM peripheral. Users of the STM32 HAL can now compile in the reference port and the MemfaultWatchdog_Handler
. The handler will save a coredump so the full system state can be recovered when a watchdog takes place. More details can be found in ports/include/memfault/ports/watchdog.h
.
Add CLI commands wdg_enable
, wdg_disable
, and wdog_update <timeout_ms>
for testing a software watchdog port. These commands are disabled by default and can be enabled for platforms using the minimal shell/console with MEMFAULT_DEMO_CLI_WATCHDOG
.
Zephyr:
Add a new Kconfig option, CONFIG_MEMFAULT_HTTP_MAX_MESSAGES_TO_SEND
, which controls the max number of messages that will be sent in a single invocation of memfault_zephyr_port_post_data()
or similar APIs. The default is 100
, which is suitable for most applications. Before this change, the limit was hard coded to 5 messages, which was too low for systems with infrequent upload intervals.
Support building for native_sim
on arm64 hosts (specifically, the native_sim/native/64
target), in addition to x86 hosts.
Zephyr:
Improve the default implementation of memfault_platform_sanitize_address_range()
to include all memory accessible by the kernel. This enables collection of heap-allocated task control blocks, which was previously unsupported. Users with discontiguous memory regions should provide their own implementation, as before.
Prioritize the thread bookkeeping array when collecting thread information in a coredump (when CONFIG_MEMFAULT_COREDUMP_COLLECT_TASKS_REGIONS=y
, the default). This improves the quality of the processed coredump if the coredump region is too small to collect all stacks for all threads in the system (impacts systems with many threads and limited coredump storage space).
Add a new Kconfig option, CONFIG_MEMFAULT_HTTP_PACKETIZER_BUFFER_SIZE
, which controls the size of the intermediate buffer used when reading data from the underlying data source (coredump storage, log buffer, CDR, etc) when uploading data to Memfault via HTTP. The default size is 128 bytes, and 1024 bytes on nRF91x series SOCs to better support modem trace CDR upload. Thanks to @DematteisGiacomo for submitting this in #92.
ESP-IDF:
Handle deprecated Deep Sleep API calls for upcoming ESP-IDF v5.5 and v6.
Supporting building with the Memfault CLI commands disabled, CONFIG_MEMFAULT_CLI_ENABLED=n
. Thanks to @finger563 for reporting this issue and providing a fix in #93 š!
Zephyr:
This is a minor fix release, addressing one future compatibility issue with the Zephyr port.
Zephyr:
net_mgmt
callback mgmt_event
parameter. Thanks to @rlubos for providing the fix in #91 š!This is a feature release, primarily addressing future compatibility changes for the next nRF-Connect SDK release.
Zephyr:
Add support for the ESP32 chip on Zephyr, adding to the existing support for ESP32-S3 and ESP32 C series chips.
Add support for building the Memfault SDK on the native_sim
board. Note that Memfault does not support reboot tracking or coredumps on this target, but other features are supported.
General:
MEMFAULT_ENABLE_WARNING(warning)
macro complementing the existing MEMFAULT_DISABLE_WARNING(warning)
macro. This macro is only implemented for GCC + Clang.Zephyr:
Remove the External Module logic, used to support multiple Zephyr versions, and instead use the normal Zephyr module Kconfig path specifier. There should be no user-facing changes from this change. It addresses an issue with Kconfig symbol linting.
In the Zephyr QEMU sample app, add the --param=min-pagesize=0x1000
compiler option, which will catch dereferences to low memory addresses. This is only for static analysis purposes and does not affect any behavior.
ESP-IDF:
CONFIG_MEMFAULT_DEEP_SLEEP_SUPPORT=y
. Version 1.25.0
, which added deep sleep support, had disabled the normal heartbeat metrics timer by default. The default behavior can be overridden with the Kconfig option CONFIG_MEMFAULT_METRICS_HEARTBEAT_TIMER_ENABLE
.nRF-Connect SDK:
LTE_LC_ON_CFUN
with NRF_MODEM_LIB_ON_CFUN
for nRF-Connect SDK v2.8.0+. This deprecated API is scheduled to be removed in the next nRF-Connect SDK release.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.
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 sleepactive_time_ms
- time spent out of deep sleepdeep_sleep_wakeup_count
- number of times the device woke up from deep sleepThere 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
.
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:
MEMFAULT_PLATFORM_TIME_SINCE_BOOT_ESP_TIMER
default, suitable for most applicationsMEMFAULT_PLATFORM_TIME_SINCE_BOOT_DEEP_SLEEP
applicable for deep-sleep applicationsMEMFAULT_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.
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:
General:
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
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
.
Zephyr:
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:
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:
memfault_platform_time_get_current()
to be included in the final link, when CONFIG_MEMFAULT_SYSTEM_TIME=y
is enabled (default).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
.cgroupv2
instead of cgroupv1
.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 8MiBesp_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.
Zephyr:
CONFIG_DCACHE
enabled.General:
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.
ESP-IDF:
General
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.
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:
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:
'\n'
character are no longer recorded in the Memfault Log Buffer.Zephyr:
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.General:
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.General:
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 pointwifi_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
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
ESP-IDF:
"MemfaultSdkMetric_sdk_version": "0.0.0"
. No change to the SDK, only a tooling/release change.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
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!ESP-IDF:
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:
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.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!
Fix a configuration issue when building for any of the following parts, but NOT using nRF-Connect SDK (i.e. using Zephyr instead):
The Memfault SDK now correctly enables nRF-Connect-SDK-specific functionality ONLY when that SDK is included as a Zephyr module. 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
.
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/freertos/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.
Zephyr:
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 !General:
eclipse_patch.py
utility --memfault-sdk-dir
argument is now optional, and defaults to the parent directory of the script folder.FreeRTOS:
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:
main_thread_cpu_time_permille
-> cpu_usage_main_pct
.General:
uptime_s
, which reports the total uptime of the device in seconds. This metric is enabled by default, and can be disabled with #define MEMFAULT_METRICS_UPTIME_ENABLE 0
in memfault_platform_config.h
.Zephyr:
ESP-IDF:
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.ESP-IDF:
main
thread by about 350 bytes.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 intervalMemfaultSDKMetric_log_dropped_lines
: the total number of log lines dropped (overwritten or not recorded) due to buffer exhaustion during the heartbeat intervalFor example, if the buffer is sufficiently large to store 10 logs, and 15 logs are written:
MemfaultSDKMetric_log_recorded_lines
will be 15MemfaultSDKMetric_log_dropped_lines
will be 5If 5 more logs are written:
MemfaultSDKMetric_log_recorded_lines
will be 20MemfaultSDKMetric_log_dropped_lines
will be 10Cosmetic updates to the examples/freertos/
app log format, including applying ANSI color codes based on log level.
# Before: mflt> test_log Raw log! MFLT:[INFO] Info log! MFLT:[WARN] Warning log! MFLT:[ERRO] Error log! # After: 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!
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.
General:
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:
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.Please contact us if you need support for earlier versions!
General:
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.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.
Added a Kconfig flag, CONFIG_MEMFAULT_METRICS_LOGS_ENABLE
, to control the new log lines metrics.
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.
Added a Kconfig flag, CONFIG_MEMFAULT_METRICS_LOGS_ENABLE
, to control the new log lines metrics.
General:
nRF-Connect SDK:
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.General:
session.operational_crashes
) which tracks crashes that occurred when a session is active.General:
MEMFAULT_METRIS_KEY_DEFINE_WITH_SESSION_AND_SCALE_VALUE()
toMEMFAULT_METRICS_KEY_DEFINE_WITH_SESSION_AND_SCALE_VALUE()
ESP-IDF:
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.FreeRTOS:
#define MEMFAULT_FREERTOS_RUNTIME_STATS_MULTI_CORE_SPLIT 1
to memfault_platform_config.h
. This setting is disabled by default.ESP-IDF:
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.FreeRTOS:
idle_task_run_time_percent
-> cpu_usage_pct
idle0_task_run_time_percent
-> cpu_usage_pct
idle1_task_run_time_percent
-> cpu1_usage_pct
ESP-IDF:
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).Support for the following vendor platform versions is deprecated in this release, and will be removed in a future release:
v4.4
(Jan 26, 2022)v2.7.0
(Oct 16, 2021)v1.9.2
(Jul 14, 2022)Please contact us if you need support for earlier versions!
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.
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:
ESP-IDF:
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.General:
MemfaultSdkMetric_os_name
and MemfaultSdkMetric_os_version
. These are string metrics that map to the OS / platform name and version string respectively, and are included in the the ELF at build time, and processed out-of-band by Memfault for NCS, Zephyr, and ESP-IDF. They are not ever transmitted over the air (no bandwidth impact). For example, for Zephyr these metric string values would be zephyr
and 3.7.0
for a project on Zephyr v3.7.0. These metrics are attributes by default and will not be counted towards attribute quotas.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 networkwifi_disconnect_count
: number of times the device has disconnected from a WiFi networkwifi_ap_oui
: the OUI of the WiFi AP the device is connected toThe 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 ...
Zephyr:
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
.
ESP-IDF:
General:
-Wc11-c2x-compat
compiler warning flag. This flag is not valid for the C++ compiler, and has been changed to be enabled only for the C compiler.nRF-Connect SDK:
General:
-flto
is enabled.Zephyr:
Add a new Kconfig option, CONFIG_MEMFAULT_SOC_FAMILY_ESP32
, to resolve an error when referencing the deprecated CONFIG_SOC_FAMILY_ESP32
Kconfig (removed in Zephyr 3.7.0 as part of Hardware Model V2). This new option is used in the Memfault Zephyr port to check if an ESP32 SOC is being used.
Remove references to the deprecated BOOTLOADER_ESP_IDF
Kconfig symbol in the Memfault Zephyr port (removed in Zephyr 3.7.0).
nRF-Connect SDK:
Add support for the following reboot reasons on nRF series SOCs. These reboot reasons are tracked as kMfltRebootReason_DeepSleep
.
NRF_POWER_RESETREAS_OFF_MASK
NRF_POWER_RESETREAS_NFC_MASK
NRF_POWER_RESETREAS_CTRLAP_MASK
Zephyr:
Use MEMFAULT_ASSERT_HALT_IF_DEBUGGING_ENABLED
to control whether coredumps trigger a halt when a debugger is attached.
Add a new Kconfig option, CONFIG_MEMFAULT_RAM_BACKED_COREDUMP_REGION
, to set the RAM region used for storing RAM-backed coredumps.
Fix a š when trying to communicate via HTTPS with Memfault on the nRF91x. On the nRF91x, socket operations are offloaded to the nRF modem lib, which does not currently support the socket option TLS_CERT_NO_COPY
. In v1.9.4, this socket option was applied when TLS was enabled (!g_mflt_http_client_config.disable_tls
) and Zephyr version was >=3.0.0 (when support for this socket option was added). Therefore, devices on SDK versions >=1.9.4 and <1.11.2 trying to communicate with Memfault will run into a no protocol support error (ENOPROTOOPT
) in the nRF modem lib. Since this option is only required to use the DER format, CONFIG_MEMFAULT_TLS_CERTS_USE_DER
now depends on the Zephyr-implemented socket operations being used (!NET_SOCKET_OFFLOAD
).
Fix the build when using Zephyr 3.7.0 and leveraging the HTTP client and/or ESP32 port. The Memfault HTTP client would fail to build due to the wrong crypto.h
header getting picked up in the build. Additionally, due to the removal of default support for mbedTLS hash algorithms in Zephyr, CONFIG_MBEDTLS_SHA1
now must be enabled explicitly when using any of Memfault‘s CA certificates. When using PEM and leveraging Zephyr’s in-tree mbedTLS and config file (CONFIG_MBEDTLS_BUILTIN=y && CONFIG_MBEDTLS_CFG_FILE="config-tls-generic.h"
), CONFIG_MBEDTLS_PEM_CERTIFICATE_FORMAT=y
is required for PEM certificate support. To simplify certificate format selection, a new choice Kconfig called CONFIG_MEMFAULT_TLS_CERTS_FORMAT
has been added. Use the configs CONFIG_MEMFAULT_TLS_CERTS_USE_PEM
and CONFIG_MEMFAULT_TLS_CERTS_USE_DER
to choose the certificate format.CONFIG_MEMFAULT_TLS_CERTS_USE_DER
is the default choice config. Finally, the Kconfig CONFIG_SOC_FAMILY_ESP32
is now deprecated. References of this Kconfig now also check the new Kconfig CONFIG_SOC_FAMILY_ESPRESSIF_ESP32
. See Zephyr's 3.7 Migration guide for more details.
Dialog
Add support to the existing DA145xx port for the DA14535 by adding the correct memory region for memfault_platform_sanitize_address_range()
.
Fix several šs in memfault_reboot_reason_get()
and memfault_platform_reboot()
implementations in the DA146x port. In memfault_reboot_reason_get()
, the bit masks were incorrectly applied and a block was missing to reset the reboot reason register if MEMFAULT_REBOOT_REASON_CLEAR
is set. In memfault_platform_reboot()
, the mechanism to reboot the system has been updated from hw_cpm_reboot_system()
to SWRESET
.
General:
ports/templates/memfault_platform_port.c
to help when integrating on a new platformESP-IDF:
BOOT
button is pressed on the ESP32 example app. This is useful for testing the Memfault crash handling functionality without using the serial console.Add support for namespacing Session Metrics to support duplicate key names across heartbeats and sessions (eg heartbeat.cpu_temp
and session.cpu_temp
). This requires a change to how Session Metrics keys are set:
MEMFAULT_METRIC_SET_SIGNED(cpu_temp, 25)
(only 1 metric key cpu_temp
supported across heartbeats/sessions)MEMFAULT_METRIC_SET_SIGNED(cpu_temp, 25)
for setting heartbeat.cpu_temp
MEMFAULT_METRIC_SESSION_SET_SIGNED(cpu_temp, session, 25)
for setting session.cpu_temp
General:
Fix a š in reboot tracking classification when calling memfault_reboot_tracking_boot()
with a bootup_info
parameter containing an unexpected type of reboot reason (or no reboot reason) after a previously recorded expected reason. This results in “Expected Reboots” recorded using MEMFAULT_REBOOT_MARK_RESET_IMMINENT()
to be incorrectly flagged as an “Unexpected Reboot” and causes an incorrect operational_crashfree_hours
metric getting reported and a lower Stability score.
Cleanup comment to old packetizer API
Add -fdebug-prefix-map
to FreeRTOS QEMU example
ESP-IDF:
Improved the CLI results when running the post_chunks
test command (used to trigger an upload to Memfault) to be more informative, for example:
esp32> post_chunks I (12593) mflt: Data posted successfully, 262285 bytes sent esp32> post_chunks I (204093) mflt: No new data found
Zephyr
Update samples to use the newly-released Zephyr v3.7.0 š„³
Add explanatory output to Memfault test busfault|hardfault
shell commands when Trusted Firmware-M (TF-M) is in use
The RTC-based implementation of memfault_platform_time_get_current()
used a define named RTC
, which conflicts with the STM32 HAL definition here. Rename the define to MFLT_RTC_NODE
to avoid the conflict.
nRF-Connect SDK:
General:
Removed a warning when compiling the SDK for Cortex-A targets (ARM v7a). Support for this target is no longer experimental.
Improve coredump capture on ARMv7-A/R (Cortex-A/R), capturing additional CPU registers r8
+ r9
in the coredump.
Fix a compilation issue with older versions of gcc-arm-none-eabi
that do not support the PRIu64
format specifier (or are missing C99 format specifiers). Thanks to @iotengtr for reporting this issue in #72 !
Zephyr:
CONFIG_MEMFAULT_DTS_IN_ELF
, enabled by default.Zephyr:
Add support for Memfault Logging when CONFIG_LOG_MODE_MINIMAL=y
, in addition to the previously supported LOG_MODE_DEFERRED
(Zephyr default) and LOG_MODE_IMMEDIATE
. Zephyr minimal log mode disables all backends- logs are simply sent to printk
.
For ESP32 chips, place the reboot reason tracking into a dedicated section, .rtc_noinit
, to ensure the reboot reason is preserved across reboots. This was previously only supported on Zephyr ESP32-S3/S2 devices (all ESP32 devices on ESP-IDF already support this).
Fix a bug where the default memfault_platform_get_device_info()
, which uses the hwinfo subsystem, when available, was incorrectly disabled when CONFIG_MEMFAULT_REBOOT_REASON_GET_CUSTOM=y
.
General:
memfault_demo_cli_cmd_busfault()
function (accessed via test_busfault
/mflt test busfault
demo CLI commands) to produce BusFaults on more devices. Previously, certain chips would either not produce a fault, or would produce a MemManage exception instead.Zephyr:
Updated the Memfault fault handler to support deprecated exception info structure coming in Zephyr v3.7.0. This change is backward compatible with older Zephyr versions.
By default, include the zephyr.meta
build metadata in the output ELF file as an unallocated section. This provides a list of module SHAs, useful when reconstructing the dependencies used to build a particular ELF file. This feature is controlled with CONFIG_MEMFAULT_BUILD_META_IN_ELF
.
Add a new Kconfig option, CONFIG_MEMFAULT_USE_MEMFAULT_BUILD_ID
, which will apply a Memfault Build ID instead of a GNU Build ID when enabled. It defaults to enabled when CONFIG_BOOTLOADER_ESP_IDF
is enabled- this applies to ESP32 boards that are using the ESP-IDF bootloader, instead of an MCUBoot bootloader. MCUBoot bootable images are compatible with the standard GNU Build IDs.
Add a new API, memfault_zephyr_fota_download_callback()
, to the Zephyr FOTA implementation to allow users to write their own callback that is invoked when the download of a OTA payload is complete. The default download callback will mark the new image as pending, set a firmware update reboot reason, and reboot the system. Custom callbacks may, for example, be used to perform application-specific system shutdown procedures, or allow the FOTA update call to return to the calling context so a testing framework could mark the operation successful. Users can override the default callback with their own implementation using a new Kconfig option CONFIG_MEMFAULT_ZEPHYR_FOTA_DOWNLOAD_CALLBACK_CUSTOM
.
ESP-IDF:
CONFIG_MEMFAULT_HTTP_PERIODIC_UPLOAD=y
.General:
ESP-IDF:
The default Device Info Software Version (Kconfig CONFIG_MEMFAULT_DEVICE_INFO_SOFTWARE_VERSION
) has been updated to 0.0.0
from 1.0.0-dev
for the built-in Device Info implementation. See menuconfig
or ports/esp_idf/memfault/Kconfig
for details. This should only affect users who are using the default value for that Kconfig.
Fix a bug when CONFIG_MEMFAULT_LWIP_METRICS=y
that may cause invalid metric values. LwIP stats by default are only 16-bits wide and this can cause underflow when calculating heartbeat values. This fix forces LWIP_STATS_LARGE=1
to make LwIP use 32-bit counters.
Add a feature to the esp32 example app to enable overriding the Memfault server URLs (ex: for a proxy).
Improve docs and comments in example app
General:
Updated the default exception handler name for Memory Management exceptions from MemoryManagement_Handler
to MemManage_Handler
(set by MEMFAULT_EXC_HANDLER_MEMORY_MANAGEMENT
in default_config.h
when not overridden by the user). This aligns with the more recent CMSIS naming convention for exception handlers. A backwards-compatible implementation is included to avoid breaking users relying on the previous default.
Add libcurl
-based samples for posting chunks to Memfault and checking for latest OTA release.
ESP-IDF:
Fix CLI command, memfault_ota_check
, to return 0 to the console component when an update is available.
Add the temperature metric cpu_temp
which is measured using an internal temperature sensor that many ESP32 boards have built-in. This metric is collected by default with the Kconfig CONFIG_MEMFAULT_METRICS_CPU_TEMP=y
.
Enable recording vprintf data into the Memfault log buffer through a vprintf hook. Users can call memfault_esp_port_vprintf_log_hook()
from their vprintf handler so they can use both their vprintf handler and record logs into Memfault's log buffer. To use this feature, set CONFIG_MEMFAULT_LOG_USE_VPRINTF_HOOK=n
.
Zephyr:
Fix a bug in memfault_zephyr_port_post_data_return_size()
where a positive value could be returned in the event of a failure instead of a negative value. This would result in mflt post_chunks
returning a successful post message even though there was a failure such as a DNS lookup failure.
Add the temperature metric cpu_temp
which is measured using an internal temperature sensor that some Zephyr boards have. Similar to ESP-IDF, this metric is collected by default with the Kconfig CONFIG_MEMFAULT_METRICS_CPU_TEMP=y
, but the board must have the device tree node die-temp0
for this option to be used.
Add an example for collecting thread stack usage metrics when the thread handles are not accessible in the desired scope. Users can leverage the Zephyr routine k_thread_foreach()
to register a callback that will be called with each thread's k_thread
handle. In the callback, users can read the stack usage via the handle and set their metrics.
Zephyr:
memfault_zephyr_port_http_upload_sdk_data()
to a negative value instead of 1. This change aligns with the error return value for the other Zephyr HTTP client APIs, and simplifies logic in the HTTP client.ESP-IDF:
esp_http_client_cleanup()
was not called in certain scenarios (for example, if the access point is connected, but there is no outside internet access), which resulted in a memory leak. Thanks to @mykmelez for providing the fix in #71 š!ESP-IDF:
Zephyr:
Add support for tracking ESP32 reboots in .rtc_noinit
section. This improves tracking of the OTA Reboot Reason when the device reboots after an OTA update.
Fix compilation warnings when CONFIG_MEMFAULT_COREDUMP_FULL_THREAD_STACKS=y
is enabled. Thanks to @fouge for providing this fix in #70 š!
General:
eclipse_patch.py
to support adding the Memfault SDK files to an STM32Cube IDE project.General:
MEMFAULT_EVENT_STORAGE_NV_SUPPORT_ENABLED
is set to 0
. This feature was previously not fully disabled, leaving some unused code in the final executable. This is a minor code size improvement (approximately 300 bytes) when the system is disabled (default).Zephyr:
Improve support for event timestamps using Zephyr RTC devices, by adding support for RTC nodes identified using DT_ALIAS()
in addition to DT_NODELABEL()
. Thanks to @corytodd for providing the fix in #68!
Add a Memfault HTTP OTA client backend for Zephyr MCUBoot platforms. This is enabled with the CONFIG_MEMFAULT_ZEPHYR_FOTA_BACKEND_MCUBOOT
Kconfig flag. The OTA process is triggered by calling the memfault_zephyr_fota_start()
function, which is also exposed in the shell via the mflt get_latest_release
command.
Add basic support for Xtensa targets in the Memfault Zephyr port. This specifically targets the ESP32-S3 SOC.
Add a success message when the Zephyr HTTP client posts data to Memfault.
ESP-IDF:
Wrap calls to esp_event_loop_create_default()
to prevent crashes if called multiple times. This feature is enabled by default and is disabled with CONFIG_MEMFAULT_WRAP_EVENT_LOOP_CREATE_DEFAULT=n
Add an example Session Metric to the ESP32 example app, which tracks statistics during the ESP32 OTA session (bytes sent + received, etc).
nRF Connect SDK:
Enable periodic upload, CONFIG_MEMFAULT_HTTP_PERIODIC_UPLOAD=y
, by default for nRF91x builds
Default to CONFIG_MEMFAULT_HTTP_PERIODIC_UPLOAD_USE_DEDICATED_WORKQUEUE
when periodic upload is enabled
Improve the stability of the nRF9160 sample app, by increasing the CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE
to 2048
.
Zephyr:
g_mflt_http_client_config
for Zephyr devices using the Memfault HTTP client, which holds the Memfault Project Key set via the Kconfig symbol CONFIG_MEMFAULT_PROJECT_KEY
. Users updating from a previous version will have to set this Kconfig symbol when building, and any existing implementation of g_mflt_http_client_config
should be removed.General:
memfault_platform_metrics_connectivity_boot()
, can be enabled to be called from the Memfault SDK metrics_boot()
function after the metrics subsystem is initialized. This platform function is used for setting any initial state information for Connectivity metrics, and has default implementations for ESP-IDF (WiFi) and nRF9160 (LTE) devices.ESP-IDF:
CONFIG_MEMFAULT_COREDUMP_STORAGE_WRITE_OFFSET_SECTORS
, which can be used to set an offset into the coredump storage area where coredumps are written. The full partition will still be erased, but coredumps will be written starting at the sector offset selected with this setting. The skipped sector will remain at the erased value, 0xff
for all bytes.Zephyr:
Added a built-in weakly defined implementation of memfault_platform_get_device_info()
, which provides:
.device_serial
: A default device serial based on the SOC's unique ID registers, via the hwinfo
subsystem. This is the default device serial when CONFIG_HWINFO=y
. If CONFIG_HWINFO=n
, the fallback device serial is CONFIG_SOC "-testserial"
..software_type
: Configurable with CONFIG_MEMFAULT_BUILTIN_DEVICE_INFO_SOFTWARE_TYPE
, defaults to "app"
.software_version
: Configurable with CONFIG_MEMFAULT_BUILTIN_DEVICE_INFO_SOFTWARE_VERSION
. Defaults to an identifier based on the VERSION
file in the application, using the Zephyr Application Version feature, or "0.0.0"
if unavailable..hardware_version
: Configurable with CONFIG_MEMFAULT_BUILTIN_DEVICE_INFO_HARDWARE_VERSION
. Defaults to an identifier based on CONFIG_BOARD
and CONFIG_BOARD_REVISION
(if set).Add a new Zephyr example app for the ST NUCLEO-WBA55CG board, under examples/zephyr/nucleo_wba55cg
. This example demonstrates the Memfault SDK integration on the NUCLEO-WBA55CG board.
nRF-Connect SDK:
CONFIG_MEMFAULT_NRF_CONNECTIVITY_CONNECTED_TIME_NRF91X
, enabled by default.FreeRTOS:
ports/freertos/config/memfault_metrics_heartbeat_freertos_config.def
file is not included from the user memfault_metrics_heartbeat_config.def
file. Compilation would fail previously with hard-to-follow errors due to missing metrics definitions. This change makes the compilation error explicit.ESP-IDF:
Permit disabling the Memfault logging hook into esp_log_set_vprintf()
(by default this is enabled on system boot). Use CONFIG_MEMFAULT_LOG_USE_VPRINTF_HOOK=n
to disable the Memfault hook. Note that this will disable capturing ESP-IDF logs in Memfault.
Allow disabling the built-in Connectivity Core Metric collection, which is enabled by default to track WiFi uptime. Use CONFIG_MEMFAULT_ESP_WIFI_CONNECTIVITY_TIME_METRICS=n
to disable the built-in implementation.
General:
EXPERIMENTAL: Add the option to set a scale factor when defining a Metric. The scale factor will in the future be used to divide the uploaded metric values. For example, if a Metric is defined with a scale factor of 10
, all values reported for that Metric will be divided by 10
when received by Memfault. The resulting value is stored as a floating point number in Memfault.
Minor tweak to the Eclipse patcher script to better handler folders with partially common path prefixes.
ESP-IDF:
memfault_boot()
in the ESP32 example app that was causing the device to not boot correctly. This was a regression in v1.7.4.FreeRTOS:
timer_task_stack_free_bytes
. This metric is enabled by default and can be disabled by setting #define MEMFAULT_FREERTOS_COLLECT_TIMER_STACK_FREE_BYTES 0
in memfault_platform_config.h
.ESP-IDF:
FreeRTOS:
pdMS_TO_TICKS()
in older FreeRTOS versions. Newer version of FreeRTOS (as of V11.0.0
published December 2023) have fixed this issue.nRF-Connect SDK:
Update the Memfault SDK's nRF-Connect SDK example apps to nRF-Connect SDK v2.6.0
In the Memfault SDK nRF9160 example app, set the Kconfig flag CONFIG_DOWNLOAD_CLIENT_HTTP_FRAG_SIZE_1024=y
in prj.conf
instead of via a conditional CMakeLists.txt
expression. This makes the setting more explicit for users that are referencing the sample app.
ESP-IDF:
MEMFAULT_DISABLE=1
environment variable in the build environment (ex: MEMFAULT_DISABLE=1 idf.py build
). This is useful in cases where the Memfault component can not be n-selected in the application's root CMakeLists.txt
but needs to be conditionally excluded, for example when building a reduced factory firmware image.Zephyr:
Add new Kconfig flags for the following Memfault Core Metrics:
MEMFAULT_METRICS_SYNC_SUCCESS
(default=y)MEMFAULT_METRICS_MEMFAULT_SYNC_SUCCESS
(default=y)MEMFAULT_METRICS_CONNECTIVITY_CONNECTED_TIME
(default=y)MEMFAULT_METRICS_BATTERY_ENABLE
(default=n)Additionally, a Kconfig flag MEMFAULT_BATTERY_METRICS_BOOT_ON_SYSTEM_INIT
will enable auto-initialization of battery metrics on system init (requires memfault_platform_get_stateofcharge()
to be implemented).
See https://mflt.io/core-metrics for more information on Core Metrics.
ESP-IDF:
General:
The Memfault Self Test component boot check now prints all components that are booted (previously only un-booted components would print):
MFLT:[INFO] ============================= MFLT:[INFO] Component Boot Test MFLT:[INFO] ============================= MFLT:[INFO] Component | Booted?| MFLT:[INFO] ----------------------------- MFLT:[INFO] Event Storage | yes| MFLT:[INFO] Logging | yes| MFLT:[INFO] Reboot Tracking | yes| MFLT:[INFO] Trace Event | yes| MFLT:[INFO] All components booted MFLT:[INFO] =============================
Restore the Memfault Demo CLI heartbeat
command, which was unintentionally removed in v1.7.1. This command triggers a heartbeat on-demand, for testing heartbeat functionality.
Zephyr:
ESP-IDF:
CONFIG_MEMFAULT_COMPACT_LOG_ENABLE
. Updating from older versions of the SDK would require opting in to that option, even if Compact Logging was enabled via the Memfault config flag, MEMFAULT_COMPACT_LOG_ENABLE
. Instead, support enabling Compact Logs both via the Memfault config flag or the Kconfig flag, to require no changes when updating the SDK for existing users.General:
MEMFAULT_REBOOT_MARK_RESET_IMMINENT_CUSTOM()
that is more concise for custom reboot reasons by taking the reboot reason name directly. Previously, MEMFAULT_REBOOT_MARK_RESET_IMMINENT()
was the only option, which requires passing a key with MEMFAULT_REBOOT_REASON_KEY()
.memfault_metrics_session_register_start_cb()
. This change enables, for example, tracking battery percent drop across sessions; battery state tracking variables can now be initialized at the start of a session.CONFIG_MEMFAULT_SHELL_SELF_TEST_COREDUMP_STORAGE=y
on Zephyr, CONFIG_MEMFAULT_CLI_SELF_TEST_COREDUMP_STORAGE=y
on ESP-IDF, or by adding #define MEMFAULT_DEMO_CLI_SELF_TEST_COREDUMP_STORAGE 1
to your memfault_platform_config.h
for other platforms.heartbeat_dump
command to metrics_dump
that can either dump all current heartbeat metrics with metrics_dump heartbeat
or all session metrics with metrics_dump sessions
that haven't yet been exported. These commands help with testing metrics collection locally without needing to push chunks to Memfault.README.md
s in example apps to point to the Demo CLI page on the Memfault docs website where comprehensive information is available on commands and their outputnRF-Connect SDK:
General:
components/include/memfault/core/reboot_reason_types.h
. Users can create custom reboot reasons for both expected and unexpected reboots. For more information see components/include/memfault/core/reboot_tracking.h
. Enable this feature with Kconfigs in Zephyr and ESP-IDF (CONFIG_MEMFAULT_REBOOT_REASON_CUSTOM_ENABLE=y
) or by adding #define MEMFAULT_REBOOT_REASON_CUSTOM_ENABLE 1
to your memfault_platform_config.h
.#define MEMFAULT_MESSAGE_HEADER_CONTAINS_PROJECT_KEY 1
and #define MEMFAULT_PROJECT_KEY "<project key string>"
to your memfault_platform_config.h
. Any chunks sent using this configuration will be sent to the project routed with MEMFAULT_PROJECT_KEY
rather than the project routed with the POST header's Project Key.General:
memfault_platform_get_time_since_boot_ms()
and memfault_platform_time_get_current()
. This test will catch errors like non-monotonically increasing counters and current time reported as near epoch time-fsanitize=leak
to the SDK unit tests (Linux only)strnlen()
definition when enabling the self test with some libc implementations. This function is part of a POSIX standard that might be missing from some libc implementations.git-blame-ignore-revs
to allow for better git blame
output since this commit contains only formatting changes.Zephyr:
CONFIG_MEMFAULT_RECORD_REBOOT_ON_SYSTEM_INIT
) to allow deferring reboot reason collection to a later point in time. Setting this option to n
is intended to help when device info is only available after boot completes.CONFIG_MEMFAULT_METRICS_TCP_IP
)CONFIG_MEMFAULT_TLS_CERTS_USE_DER
)ESP-IDF:
CONFIG_MEMFAULT_COMPACT_LOG_ENABLE
)connectivity_connected_time
core metric for WiFi devices, (CONFIG_MEMFAULT_ESP_WIFI_CONNECTIVITY_TIME_METRICS
)General:
clang-format
to the entire codebase, to ensure consistent code formatting. The formatting rules are defined in .clang-format
. No other changes are included in this release. A .git-blame-ignore-revs
entry will be added in the next release, to enable ignoring this commit when running git blame
. Use this ignore file in your local repo with git config blame.ignoreRevsFile=.git-blame-ignore-revs
.General:
Add a reboot reason self test, which validates the reboot reason data is correctly preserved through device reboot. This test first sets a custom reboot reason, then calls memfault_platform_reboot()
to reboot the system. To verify the operation succeeded, the self test is called again to check the reboot reason was saved. The reboot reason self test can be performed by passing the appropriate flags when calling the memfault_self_test_run()
file (see components/include/memfault/core/self_test.h
for details), and from the demo CLI as self_test reboot
/self_test reboot_verify
.
Fix a ti-armcl
compiler warning due to enumeration mismatch in initialization (#190-D
).
Add a compile-time option to enable the self-test module. Enabling the self-test increases code space utilization, and is usually of use during set-up and SDK integration testing. The self-test can be enabled by setting #define MEMFAULT_SELF_TEST_ENABLED 1
in memfault_platform_config.h
, or via CONFIG_MEMFAULT_CLI_SELF_TEST=y
for ESP-IDF and CONFIG_MEMFAULT_SHELL_SELF_TEST=y
for Zephyr.
ESP-IDF:
memfault_esp_port_ota_get_release_url()
for fetching the OTA release URL without performing a download. This is useful for cases where the URL is needed for other purposes, such as for fetching a downstream device OTA artifact. See ports/esp_idf/memfault/include/memfault/esp_port/http_client.h
for details.nRF-Connect SDK:
fota_download_any()
(see documentation here), which accepts a list of certificates to use when executing FOTA downloads. This API is expected to be included in the upcoming nRF-Connect SDK v2.6.0 release.ESP-IDF:
In the ESP32 example app, disable the shell history cache for the FatFS shell command handler, which saves some ~20kB of heap memory.
Also in the ESP32 example app, add a new built-in metric sync_successful
which is set to 1
when a successful Memfault OTA check-in is performed. Primarily added for demonstration purposes for the metric. See more information about Memfault Core Metrics here.
General:
Enhanced the Self-Test component with the following new features:
nRF-Connect SDK:
ports/zephyr/ncs/src/memfault_fota.c
), where the allocated Memfault OTA download URL was freed too early. This issue was introduced in Memfault SDK v1.5.0, where support for FOTA on nRF-Connect SDK v2.4+ was improved.Zephyr:
Fix a concurrent access bug in the Memfault Zephyr Logging Backend. Only affected configurations with CONFIG_LOG_MODE_IMMEDIATE=y
. In certain cases the logging ctx
could be corrupted, causing unpredictable behavior. Replace the synchronization approach with an atomic primitive and correct a potential concurrency issue in the log panic handler.
Fix a build warning for certain Zephyr configurations (when using CONFIG_NEWLIB_LIBC=y
) due to a missing declaration for strnlen
. This warning was introduced with the Memfault Self-Test additions in Memfault SDK v1.5.2.
General:
int memfault_platform_get_stateofcharge(sMfltPlatformBatterySoc *soc)
, where the platform data is loaded into the soc
struct. This should simplify the platform implementation, and enables platforms to return a non-zero value to indicate state-of-charge is unknown. See the new API in the header file memfault/metrics/platform/battery.h
General:
Add a self-test component which checks the device's integration state. This self test is available via the demo cli command self_test
, or can be called directly via memfault_self_test_run()
(see self_test.h
for details). Currently, it validates device info and the build ID.
Add a helper macro called MEMFAULT_REBOOT_MARK_RESET_IMMINENT
in order to make marking an imminent reboot easier. It takes the reboot reason as an argument.
ESP-IDF:
CONFIG_MEMFAULT_ASSERT_ON_ALLOC_FAILURE
. This is useful for tracking heap memory issues. Depending on the design, a system may in general not have any expected malloc failures, and may not be set up to handle them. This feature will generate issues tagged as Out Of Memory
in the Memfault platform.Zephyr:
Adjust the implementation of memfault_zephyr_port_http_upload_sdk_data()
to check the socket before each incremental call to the send()
socket operation and wait for the socket to become available. If the socket takes too long (a healthy 5 second timeout is given), the function will return with an error. Note this function was previously blocking, but may now abort mid-transfer. This check was primarily added to prevent a busy loop that hogs the CPU, preventing lower priority threads from running. This situation could occur with larger HTTP transfers during which the socket may be busy processing tx data when another send request occurs.
Fix a build error in the Zephyr RTC port.
nRF-Connect SDK:
CONFIG_DOWNLOAD_CLIENT=y
+ CONFIG_MEMFAULT_FOTA=n
. This fixes the second issue reported in #66General:
MEMFAULT_EVENT_STORAGE_NV_SUPPORT_ENABLED
now defaults to 0
, disabled. This saves a minor amount of code space. Most implementations don't need the feature; for users that require it, the flag will now need to be set in memfault_platform_config.h
as #define MEMFAULT_EVENT_STORAGE_NV_SUPPORT_ENABLED 1
.General:
Added support for Session Metrics. These are similar to Heartbeat Metrics, except they are set on an arbitrary session interval (not required to be aligned to Heartbeat interval). Session metrics are useful for tracking device operation sessions- for example, measuring properties for a BLE connected stove top during a single cooking session. Session metrics automatically include a “session duration” timer metric.
Session metrics must be defined using the new session-specific APIs, but are set using the same MEMFAULT_METRIC_SET_*
APIs as Heartbeat metrics.
See the metrics.h
header file for usage details.
New built in metrics for measuring the following properties:
crash-free hours: enabled by default, generates operational_hours
and operational_crashfree_hours
metrics, which are automatically processed by Memfault
battery drop: enabled with #define MEMFAULT_METRICS_BATTERY_ENABLE 1
in memfault_platform_config.h
. See more information in the header file for how to use the metric.
connectivity: enabled with MEMFAULT_METRICS_SYNC_SUCCESS
/MEMFAULT_METRICS_MEMFAULT_SYNC_SUCCESS
/MEMFAULT_METRICS_CONNECTIVITY_CONNECTED_TIME
. See more information in the header file for how to use the metric.
These metrics are considered first-class metrics by Memfault, are exempt from quota limits, and are automatically processed by Memfault.
Zephyr:
By default, set the sync_memfault_successful
/sync_memfault_failure
metrics for devices using Memfault's Zephyr HTTP chunk upload functionality. This feature is controlled with the CONFIG_MEMFAULT_SYNC_MEMFAULT_METRICS
Kconfig flag.
Automatically set captured timestamps for events for devices that either implement the RTC subsystem, or use the Nordic date_time
library. The appropriate option is enabled by default based on which features are available, and can be controlled with the Kconfig flags: CONFIG_MEMFAULT_SYSTEM_TIME_SOURCE_DATETIME
or CONFIG_MEMFAULT_SYSTEM_TIME_SOURCE_RTC
.
ESP-IDF:
sync_memfault_successful
/sync_memfault_failure
metrics for devices using Memfault's ESP-IDF HTTP chunk upload functionality. This feature is controlled with the CONFIG_MEMFAULT_SYNC_MEMFAULT_METRICS
Kconfig flag.General:
Add the ability to extend the Memfault Demo Shell command table with custom commands. This is used in the examples/freertos
demo project to add 2 new commands:
freertos_tasks
: print FreeRTOS task information, via vTaskList()
freertos_vassert
: trigger a vAssertCalled
FreeRTOS assert, via configASSERT()
The Shell extension API is documented in components/include/memfault/demo/shell_commands.h
, and must be enabled by setting #define MEMFAULT_DEMO_SHELL_COMMAND_EXTENSIONS 1
in memfault_platform_config.h
.
Zephyr:
Remove a warning in Zephyr 3.5+ where the zephyr/random/rand32.h
header was renamed to zephyr/random/random.h
. This was reported in #66- thanks to @nordicjm for reporting this!
Add test commands for exercising Secure Faults in ARM TrustZone-enabled chips:
mflt test badptr
mflt test isr_badptr
Note that non-TrustZone chips may not trigger a fault when running those commands.
nRF-Connect SDK:
Add the CONFIG_AT_SHELL
setting to the examples/nrf-connect-sdk/nrf9160
sample app. This permits sending raw AT commands, useful for testing.
Specific to nRF-Connect based apps using FOTA, add a warning if CONFIG_DOWNLOAD_CLIENT_HTTP_FRAG_SIZE > 1024
, which can sporadically error out on nRF9160 devices (there is a limitation in the modem, see CONFIG_DOWNLOAD_CLIENT_HTTP_FRAG_SIZE_2048=y
) and DevZone note here.
Improve FOTA support for nRF-Connect SDK 2.4+, by improving the technique used to find the correct Memfault server root cert. Memfault uses a fast CDN to improve OTA payload delivery, which uses a different root cert than the Memfault device server. Please contact support immediately if you encounter any cert-related issues.
MEMFAULT_HEARTBEAT_SET_*
and others) have been renamed to MEMFAULT_METRIC_SET_*
, to better support the new Session Metric feature.General:
Rename this file from [CHANGES.md
] to [CHANGELOG.md
].
For FreeRTOS, add a warning when configRECORD_STACK_HIGH_ADDRESS
is not enabled. Memfault uses this to show stack sizes in the coredump view for coredumps on FreeRTOS systems. The warning can be disabled by enabling the configRECORD_STACK_HIGH_ADDRESS
FreeRTOS config flag, or by setting #define MEMFAULT_FREERTOS_WARN_STACK_HIGH_ADDRESS_UNAVAILABLE 0
.
Make memfault_packetizer_get_chunk()
return false
if the buffer was too small to load a full chunk. Previously the function would return true
but with 0
bytes loaded into the output buffer and *buf_len
set to 0
.
Update all example Metrics implementations to use the new API from v1.4.3 (eg MEMFAULT_METRIC_SET_UNSIGNED
instead of memfault_metrics_heartbeat_set_unsigned
).
Fix compilation for systems not integrating the Metrics component but using the Demo CLI (this regressed in v1.4.3).
General:
Add a new streamlined Metrics setter API:
MEMFAULT_METRIC_SET_SIGNED(key_name, signed_value)
MEMFAULT_METRIC_SET_UNSIGNED(key_name, unsigned_value)
MEMFAULT_METRIC_SET_STRING(key_name, value)
MEMFAULT_METRIC_TIMER_START(key_name)
MEMFAULT_METRIC_TIMER_STOP(key_name)
MEMFAULT_METRIC_ADD(key_name, amount)
These APIs can be used in place of the original APIs:
memfault_metrics_heartbeat_set_signed(MEMFAULT_METRICS_KEY(key_name), signed_value)
memfault_metrics_heartbeat_set_unsigned(MEMFAULT_METRICS_KEY(key_name), unsigned_value)
memfault_metrics_heartbeat_set_string(MEMFAULT_METRICS_KEY(key_name), value)
memfault_metrics_heartbeat_timer_start(MEMFAULT_METRICS_KEY(key_name))
memfault_metrics_heartbeat_timer_stop(MEMFAULT_METRICS_KEY(key_name))
memfault_metrics_heartbeat_add(MEMFAULT_METRICS_KEY(key_name), amount)
Saving some typing!
Add the ability to compute FreeRTOS task stack high watermarks when storing coredumps. This is useful only if the entire RAM (.data
+ .bss
) cannot be saved in the coredump. The feature is opt-in with the config flag #define MEMFAULT_COREDUMP_COMPUTE_THREAD_STACK_USAGE 1
.
Add a heartbeat
command to the core demo cli. This behaves the same as the commands of the same name already present in the Zephyr + ESP-IDF port.
Add a test_cassert
command to the core demo cli. This command executes a C stdlib <assert.h>``assert(0)
call. For platforms that do not implement a assert()
handler, a config flag MEMFAULT_DEMO_DISABLE_CASSERT
can be defined to 0
to disable the command.
ESP-IDF:
wifi_ap_oui
, which will record the associated AP's Organizationally Unique Identifier (OUI) in the Memfault heartbeat.Zephyr:
Memfault Coredump Settings
submenu, for easier navigation when using graphical Kconfig frontends like menuconfig.General:
Disable a warning emitted by the ARM C Compiler v5 (#188-D: enumerated type mixed with another type
) when initializing a structure in components/core/src/memfault_log.c
:314.
Improve the quality of Assert backtraces when using the ARM C Compiler v5. Certain frames in the assert call stack were missing link register information, due to compiler optimizations based on the noreturn
and unreachable compiler hints. These hints have been removed for armcc
, which should permit full stack unwinding for Assert coredumps generated from builds on that toolchain.
Perform an update of the timer when calling the memfault_metrics_heartbeat_timer_read()
debug function. Fixes #65. Thanks to @LuskeyNoah for providing this fix!
ESP-IDF:
1.4.0
)- the memfault_platform_port.h
file was still incorrectly required. This is now fixed.General:
-Oh
)ESP-IDF:
Add the following built-in heap allocation metrics by default. These can be disabled with the CONFIG_MEMFAULT_ESP_HEAP_METRICS
Kconfig flag.
heap_free_bytes
heap_largest_free_block_bytes
heap_allocated_blocks_count
heap_min_free_bytes
Zephyr:
MEMFAULT_LOG_INFO("...")
instead of LOG_INF("...")
).General:
Add a coredump_size
CLI command to the Zephyr, ESP-IDF, and demo CLI implementations. This command will print the computed size of the coredump and the available storage space. Can be used to tune coredump size.
Enable providing the Memfault HTTP Client with a custom memfault_platform_get_device_info()
callback, for when the device is uploading data for a downstream device, with different device info.
When compact logging is enabled, route all MEMFAULT_LOG_x()
statements through the compact serializer (MEMFAULT_COMPACT_LOG_SAVE
). Previously, logs had to explicitly use the MEMFAULT_COMPACT_LOG_SAVE
API to store in the compact form.
Capture C stdlib assert.h
asserts, by implementing the correct assert hooks for Newlib/Picolibc and IAR libc's. This can be disabled with the Memfault platform config MEMFAULT_ASSERT_CSTDLIB_HOOK_ENABLED
. This should improve the Trace quality for systems that are using the C stdlib assert(x)
functions.
ESP-IDF:
ESP-IDF:
Fix a build issue when overriding the default device-info implementation, CONFIG_MEMFAULT_DEFAULT_GET_DEVICE_INFO=n
. This was a regression in 1.3.3.
Add a new Kconfig flag, MEMFAULT_COREDUMP_STORAGE_MAX_SIZE
, which can be used to set the Memfault SDK's built-in ESP-IDF coredump storage implementation to artificially limit the maximum coredump storage size. This is useful for situations where the default memfault_platform_coredump_get_regions()
function is still desirable, but the coredump maximum size needs to be limited (eg for bandwidth reasons).
Switch to using ESP_DRAM_LOGE
when logging an error from Memfault's FreeRTOS task tracking when the number of tasks created on the system exceeds MEMFAULT_PLATFORM_MAX_TRACKED_TASKS
(default of 16).
General:
ESP-IDF:
Fix build errors when building the ESP32 example app project on ESP-IDF versions earlier than v5. This was a regression in 1.3.4.
Conditionally remove a redundant call to esp_timer_init()
during the memfault_boot()
sequence, which was causing a runtime error message. This call was originally required when memfault_boot()
was called as part of ESP-IDF system init, which was disabled by default in 0.31.4 and deprecated in 0.40.0. The redundant call was harmless but generated a nuisance error message.
Fix another build error in the public unit tests caused by the -fanalyzer
flag. The -fanalyzer
static analyzer was generating a false positive on GCC 11. Updating the GCC version to 12 removes the false positive.
ESP-IDF:
Add a missing dependency to the memfault
component, esp_https_ota
. It's only linked into the target project if the memfault_esp_port_ota_update()
API is used. This was previously an implicit dependency from the common
component dependencies, when building memfault
into an ESP-IDF component-style project. This change fixes building for non-component-style ESP-IDF projects, where the default component dependencies might not be included.
Multiple changes to the examples/esp32
sample project:
coredump_size
shell command, which prints out the maximum coredump size and the available coredump storage capacity.settings_[get|set]
shell commands, and enable setting the LED brightness and blink interval to NVS. This is intended as a minor quality-of-life change for internal Memfault users of the example app.Fix a build error in the public unit tests, caused by the recent addition of the -fanalyzer
flag to the unit test compilation options.
Zephyr:
Add a new Kconfig flag, CONFIG_MEMFAULT_FAULT_HANDLER_RETURN
, which will call the normal z_fatal_error
handler at the end of Memfault fault processing instead of rebooting the system. This is useful when user code needs to run within k_sys_fatal_error_handler()
just prior to system shutdown. Thanks to @JordanYates for the patch! Fixes #59.
Add a timeout to the initial send()
socket operation in memfault_zephyr_port_http_upload_sdk_data()
, to abort the transfer if the socket is blocking for too long. That function will execute repeated send()
calls to drain all the buffered Memfault data; this update only changes the initial call to check for a timeout, but otherwise will keep trying until the process completes, or a watchdog triggers. This is to balance the existing behavior, where a badly performing socket will still eventually push data through, but improves the case where the socket fails on the initial send (more common failure mode).
Remove a nuisance build warning generated when configured with CONFIG_LOG_PRINTK=y && CONFIG_LOG_MODE_DEFERRED=y
. This impacts the usability of exporting base64-encoded chunks on the shell for testing (mflt export
command), but is otherwise harmless.
ESP-IDF:
Multiple changes to the examples/esp32
sample project:
CONFIG_ESP_WIFI_SOFTAP_SUPPORT=n
, since it's unused in the sample app. This saves about 40kB flash.project_key
. The key is saved in Non-Volatile Storage on the ESP32 board.General:
__no_alloc
attribute to the compact log symbols, to have the IAR linker set the NO_LOAD
attribute correctly on the compact log output section.ESP-IDF:
memfault_get_device_info()
function, which uses the device MAC address for the Memfault Device Serial. When updating the Memfault SDK in an existing project, this implementation will cause a linker error due to duplicate definition. To disable the built-in definition, set CONFIG_MEMFAULT_DEFAULT_GET_DEVICE_INFO=n
.Zephyr:
<cmsis_core.h>
instead of <nmi.h>
. Thanks @kmeinhar for this change! (see #64)nRF Connect SDK:
CONFIG_FLASH_MAP=y
+ CONFIG_STREAM_FLASH=y
for the examples/nrf-connect-sdk/nrf5/
example app, for compatibility with nRF Connect SDK v2.4.1+. This was required due to an upstream Zephyr change.General:
MEMFAULT_LOG_COMPACT_ENABLE=1
in memfault_platform_config.h
. See the docs for more details.<intrinsics.h>
required by the IAR compilerCONFIG_MEMFAULT_COREDUMP_COMPUTE_THREAD_STACK_USAGE
, to control whether thread stack usage is computed and collected on device during a coredump.nmi.h
header which moved recently.memfault_metrics_heartbeat_collect_data
.heartbeat
cli command to the ESP-IDF port that does the same thing as in Memfault‘s default demo console + Zephyr’s console.CONFIG_MEMFAULT_PLATFORM_EXTRA_CONFIG_FILE=y
, which causes memfault_platform_config_extra.h
to be included in platform configurations. This can be utilized by a third party consumer of Zephyr to more easily extend the platform configurations set by Zephyr and avoid potentially losing a user's platform configurations set in memfault_platform_config.h
, which happened in the nRF Connect SDK recently.Set Memfault SDK version in a string metric on device boot, for easier tracking of SDK versions in the Memfault UI
Support using a different identifier for the GNU build id symbol (previously was fixed to __start_gnu_build_id_start
). Use the MEMFAULT_GNU_BUILD_ID_SYMBOL
define in memfault_platform_config.h
to override the default. For Zephyr, the Kconfig option CONFIG_MEMFAULT_GNU_BUILD_ID_SOURCE_BUILTIN
can be used to override the builtin section specifier + linker fragment for the GNU build ID. Thanks to @JordanYates for posting this change in #60 š
Improvements to the ARMv7-R exception handling when the supervisor processor mode is active
Zephyr:
Improve compatibility in reboot reason tracking and watchdog implementation on Silicon Labs Series 2 MCUs
Zephyr:
CONFIG_MEMFAULT_LOGGING=n
, see #56. Thanks to @JordanYates for reporting this issue!CONFIG_LOG_MODE_IMMEDIATE=y
when flushing of fault logs during a crashNew built-in metrics š !
idle_task_run_time_percent
. This is automatically enabled for FreeRTOS builds with the correct tracing options enabled, see ports/include/memfault/ports/freertos/metrics.h for details on how to enable or disable this metric.mbedtls_mem_max_bytes
and mbedtls_mem_used_bytes
. These are automatically enabled for ESP-IDF projects, see ports/mbedtls/memfault_mbedtls_metrics.c for usage detailsTcp_Drop_Count
/Tcp_Rx_Count
/Tcp_Tx_Count
, Udp_Drop_Count
/Udp_Rx_Count
/Udp_Tx_Count
to be all lowercase tcp_drop_count
/tcp_rx_count
/tcp_tx_count
, udp_drop_count
/udp_rx_count
/udp_tx_count
wifi_connected_time_ms
wifi_disconnect_count
wifi_sta_min_rssi
Fix a bug in the mbedtls port causing an infinite loop under certain error conditions on TLS handshake
Zephyr:
CONFIG_MEMFAULT_LOGGING_ENABLE=y
ESP-IDF:
ESP_ERROR_CHECK()
assert coredumps will now correctly show as assert in the Memfault coredump analysis view, instead of “Hard Fault”Zephyr:
0.43.0
.ESP-IDF:
CONFIG_MEMFAULT_LWIP_METRICS
controls this feature, which is enabled by default. The LwIP metrics helper is available for non-ESP-IDF projects using LwIP, see ports/lwip/memfault_lwip_metrics.c
for detailsššš
The Memfault Firmware SDK is now version 1.0.0
as of this release! Note that this is just a procedural change, there are no breaking backwards-incompatible changes in this release. We forgot to update our major version back in 2019, but better late than never š
! Hopefully the remaining 281,474,976,710,656 versions are enough š¤.
ššš
Zephyr:
FileSystem_BytesFree
for tracking VFS bytes free. This is enabled automatically when CONFIG_FILE_SYSTEM=y
. Use the Kconfig option MEMFAULT_FS_BYTES_FREE_VFS_PATH
to set the VFS mount point to monitor utilization (default value is /lfs1
). The Kconfig option MEMFAULT_FS_BYTES_FREE_METRIC
can be used to disable the metric.shell_print
instead of MEMFAULT_LOG
for command usage errorsZephyr:
Add more granular Kconfig settings to control what's collected in memfault_zephyr_coredump_get_regions()
. Default settings are identical to before this change.
CONFIG_MEMFAULT_COREDUMP_COLLECT_STACK_REGIONS
CONFIG_MEMFAULT_COREDUMP_COLLECT_KERNEL_REGION
CONFIG_MEMFAULT_COREDUMP_COLLECT_TASKS_REGIONS
Fix a build error when an application is configured without CONFIG_HEAP_MEM_POOL_SIZE=y
(i.e. no kmalloc
in use).
Fix a build error when building the nRF9160 example on nRF-Connect SDK v2.3.0.
ESP-IDF:
memfault_metrics_heartbeat_add()
would no longer be included in the serialized heartbeat data. This regression occurred in 0.42.0
.Zephyr:
z_NmiHandlerSet
function is renamed for the upcoming Zephyr 3.4. Support the new name. Fixes #49. Thanks @mbolivar-nordic for filing this issue!Add a QEMU-based FreeRTOS example project, find it under examples/freertos
Switch printf
function attribute to use __printf__
, to avoid collision with user code that redefines the printf
token
Zephyr:
Zephyr:
LEGACY_CONFIG_PATH
Kconfig selection, now that the zephyr.h
header is no longer used as of Memfault SDK 0.42.0
. This option no longer exists after Zephyr v3.3.0. Fixes #48Minor changes to the ESP8266 port to improve out-of-the-box compilation
Add new functionality to output buffered log data via memfault_log_export_logs()
. See the log.h
header for detailed usage.
Zephyr:
CONFIG_MEMFAULT_COREDUMP_FULL_THREAD_STACKS=y
zephyr.h
header in preparation for Zephyr v3.4.0. Thanks to @jfischer-no for the patch!memfault_gdb.py
:
Zephyr / nRF-Connect SDK:
ESP-IDF:
CONFIG_MEMFAULT_AUTOMATIC_INIT
has been deprecated and is no longer supported. Users of this Kconfig should refactor their application to call memfault_boot
during initialization. Use of this Kconfig now results in a build error. For more information please see https://docs.memfault.com/docs/mcu/esp32-guide#initializing-memfaultmemfault_platform_coredump_get_regions
is changed to collect the current active stack, .bss, .data, and .heap regions. Additionally if you are using ESP-IDF >= 4.4.0, the SDK will prioritize collecting FreeRTOS regions containing task TCB and stack data.memfault_freertos_get_task_regions()
function, which can be used to capture FreeRTOS tasks when coredumps are sized smaller than all available RAM. The function will now, by default, capture a truncated copy of each FreeRTOS TCB, instead of the complete structure. This makes better use of coredump storage space; the TCB structures can be very large (>1kB), but Memfault only needs the first few fields for coredump decoding. The configuration flag MEMFAULT_PLATFORM_FREERTOS_TCB_SIZE
(see default_config.h
) can be set to 0
in memfault_platform_config.h
to return to the previous behavior.CONFIG_POSIX_API=y
in the Zephyr port HTTP clientscripts/memfault_gdb.py
:memfault coredump --region x y
, now support parseable GDB expressions for the range arguments instead of requiring integer values. Thanks to @alvarop for this patch #43 !info all-registers
command when dumping registers, instead of the deprecated info registers all
command, which works better on certain arch/monitor setups. Thanks to @alvarop for this patch #44 !MEMFAULT_PLATFORM_FREERTOS_TCB_SIZE
in `memfault_platform_config.h".Built-in Metrics
MemfaultSdkMetric_UnexpectedRebootDidOccur
metric. This metric uses the platform's reboot register and any reasons by the SDK function memfault_reboot_tracking_mark_reset_imminent
to classify a reboot. When reboot tracking determines a reboot is unexpected, this metric is set to 1. Otherwise this metric is 0.Demo CLI
mflt test loadaddr
command. This command is used to test specific faults due to protected regionsMemfaultSdkMetric_UnexpectedRebootDidOccur
, classifies all reboot reasons greater than or equal to kMfltRebootReason_UnknownError
or equal to kMfltRebootReason_Unknown
as “unexpected reboots”. It is recommended to ensure your platform's implementation of memfault_reboot_reason_get
classifies the reboot register values as accurately and precisely as possible to avoid incorrect metric values.ESP-IDF:
The Heap Stats tracing component has been revamped to make more efficient usage of the bookkeeping structure. Usage should be the same as before, but now should provide more data without significantly expanding the memory utilization.
mflt test hang
) in examples/nrf-connect-sdk/nrf5/
CONFIG_QEMU_ICOUNT=n
in examples/zephyr/qemu/
, which fixes the emulated target execution speedexamples/zephyr/qemu/
memfault_demo_cli_cmd_assert()
test command to take a single arg, which is used in MEMFAULT_ASSERT_RECORD()
. This enables testing that assert variant from the CLI.memfault_ota_check
test commandidf.py build && idf.py build
) would report a nuisance failure.ports/mbedtls
is available, which implements a basic Mbed TLS client for performing Memfault data upload.CONFIG_MEMFAULT_HEAP_STATS
Kconfig option (enabled by default), and will track allocations done with k_malloc()
.memfault_metrics.c
when using the ARMCC v5 compiler.g_mflt_http_client_config
in your platform portCONFIG_MEMFAULT_PROJECT_KEY="YOUR_PROJECT_KEY"
to your projects sdkconfig.defaults
examples/nrf-connect-sdk/nrf9160
, to build and run correctly with nRF-Connect SDK v2.1.0LOG_PANIC()
before running the Memfault fault handler, to flush any deferred logs before the rebootLOG_OUTPUT
when MEMFAULT_LOGGING_ENABLE
is enabled- this fixes a build error if all other log backends are disabled. thanks to @balaji-nordic for this fix! closes #33#include <zephyr.h>
ā #include <zephyr/zephyr.h>
). The includes were moved prior to v3.1 of Zephyr, but v3.2 changes the backwards compatibility support to opt-in. The Memfault SDK is now updated to support both.E
prefix (regression introduced in Memfault SDK version 0.32.0)CONFIG_LOG_MODE_IMMEDIATE
and using LOG2 to capture the full log line instead of each logged character as a separate line.v2.x
migrated to common
, now that Zephyr v1.14 support has been removed (done in v0.32.0 of the Memfault SDK)crash 1
ā test_hardfault
, etc).printk
by default when no logging is enabled. This can be disabled by setting CONFIG_MEMFAULT_PLATFORM_LOG_FALLBACK_TO_PRINTK=n
.MEMFAULT_LOG_DEBUG()
etc) are now routed to the Zephyr logging infrastructure. The typical set of Kconfig options for Memfault logs are available (CONFIG_MEMFAULT_LOG_LEVEL_WRN
etc). See details in “Breaking Changes” below for enabling logs in your project.MEMFAULT_ZEPHYR_FATAL_HANDLER
, which can be used to disable the Zephyr fault handler print facilities.MEMFAULT_ROOT_CERT_STORAGE
, to avoid a nuisance build errorUsers will no longer see internal Memfault log output by default, but will have to enable it explicitly to see the output:
# enable LOG CONFIG_LOG=y # not required- enabling the Memfault logging component enables including the # log buffer in coredumps CONFIG_MEMFAULT_LOGGING_ENABLE=y # if on pre-v3.1.0 zephyr, you can choose either the default LOG v1 # implementation, or select a LOG2 mode to enable LOG2. on zephyr 3.1.0+, LOG # v1 is removed and LOG v2 is now the only log implementation # CONFIG_LOG2_MODE_DEFERRED=y # make sure to select a log backend to see the output CONFIG_LOG_BACKEND_UART=y
The log statements affected by this change are likely only the internal Memfault SDK logs (MEMFAULT_LOG_DEBUG()
etc), unless those macros are used in the user application.
Removed support for Zephyr LTS release 1.14 as it was superseded by LTS V2 almost a year ago now. A project using this release of Zephyr must target a memfault-firmware-sdk release less than 0.32.0.
More logically grouped Kconfig settings in Zephyr example app's prj.conf
Fixed a few typos in particle port documentation
Simplified compilation steps for the nRF91 sample test app when compiling with older releases of the nRF Connect SDK and refreshed the example to target the v2.0.2 release by default
Updated default demo CLI commands to better align with our suggested integration test commands. The default set now looks like this:
mflt> help clear_core: Clear an existing coredump drain_chunks: Flushes queued Memfault data. To upload data see https://mflt.io/posting-chunks-with-gdb export: Export base64-encoded chunks. To upload data see https://mflt.io/chunk-data-export get_core: Get coredump info get_device_info: Get device info test_assert: Trigger memfault assert test_busfault: Trigger a busfault test_hardfault: Trigger a hardfault test_memmanage: Trigger a memory management fault test_usagefault: Trigger a usage fault test_log: Writes test logs to log buffer test_log_capture: Trigger capture of current log buffer contents test_reboot: Force system reset and track it with a trace event test_trace: Capture an example trace event help: Lists all commands
Zephyr port: enable proper backtraces for Zephyr __ASSERT()
macro on aarch32/cortex_m. Prior to this fix, crashes from __ASSERT()
triggering would show an incorrect PC/LR for the active thread.
Support for pre-release nRF Connect SDK v2.0.99 and Zephyr > v3.1:
memfault_platform_reboot()
by default. It did not impact the collected backtrace, but it would show a nuisance __ASSERT()
in the console output, if CONFIG_ASSERT=y
.memfault_demo_cli_cmd_print_chunk()
in Memfault SDK release v0.31.4.ESP32 port: add new Kconfig option, CONFIG_MEMFAULT_AUTOMATIC_INIT
, that can be explicitly set to n
to skip automatically initializing the Memfault SDK on boot. This can be useful if Memfault SDK initialization needs to be deferred to application start.
Zephyr port: add Kconfig options, CONFIG_MEMFAULT_INIT_PRIORITY
/CONFIG_MEMFAULT_INIT_LEVEL_POST_KERNEL
for controlling the Memfault SDK initialization level and priority. This can be useful when needing Memfault to initialize earlier in the system startup sequence, for example for diagnosing crashes in an early driver initialization.
Partial support, still in progress, for NRF Connect SDK + Zephyr v3.1:
NET_SOCKETS_OFFLOAD_TLS
to enable building without warnings. NOTE: if mbedtls is enabled (CONFIG_MBEDTLS=y
), but is not being used for HTTP transfers (eg, mbedtls is used for security functions, but the device does not use HTTP for transferring data), it may be necessary to explicitly set CONFIG_MEMFAULT_HTTP_USES_MBEDTLS=n
.Zephyr port: remove an unused header file, ports/zephyr/common/memfault_zephyr_http.h
Remove memfault_demo_cli_cmd_print_chunk()
demo function. memfault_data_export_dump_chunks()
can be used instead, which is intended to be used with the “Chunks Debug” UI in the Memfault web application- see here for more details
MEMFAULT_ASSERT
with the TI ARM Clang Compilermemfault_platform_reboot()
. See details in ports/zephyr/include/memfault/ports/zephyr/coredump.hmemfault_http_client_post_chunk
for more details!examples/esp32
projectMEMFAULT_NRF_CONNECT_SDK
by default when targeting the nrf52 + nrf53 series SOCs (previously only enabled by default for nrf91 series)Added clarifications around licensing in ports and examples folders. See README for more details.
scripts/eclipse_patch.py
to support NXP's MCUXpresso IDEhardware_version
argument when initializing the Memfault libraryPLATFORM_NAME
macro instead of PRODUCT_SERIES
macroports/zephyr/include/memfault/ports/zephyr/http.h
for more detailsCONFIG_MEMFAULT_HTTP_USES_MBEDTLS
CONFIG_NORDIC_SECURITY_BACKEND
enabled. New Kconfig flag CONFIG_MEMFAULT_HTTP_USES_MBEDTLS
can be used to manually control this configuration if necessary (default should be set correctly in most cases)CONFIG_ARM_MPU
flag enabledCONFIG_OPENOCD_SUPPORT=y
in your prj.conf
ports/particle/README.md
.kMfltRebootReason_KernelPanic
for explicitly tracking fatal resets from within a OS or RTOSkMfltRebootReason_FirmwareUpdateError
for explicitly tracking resets due to firmware update failures or rollbacksmemfault_base64_encode_inplace
for more details!MEMFAULT_COREDUMP_INCLUDE_BUILD_ID
, which can be used to disable storing the Build Id in a coredump.README
.lcov
is sourced from when running unit tests in CIports/zephyr/common/memfault_zephyr_ram_regions.c
. Only needed for unusual Zephyr + Memfault configurations prior to Zephyr v2.7 (for example, nRF Connect SDK v1.7.1 with Memfault SDK v0.27.3+)memfault_metrics_heartbeat_set_string()
in components/include/memfault/metrics/metrics.h
for the new API. See the Memfault Docs for general information on using the metrics API.memfault_metrics_heartbeat_debug_print()
to also print current timer values, instead of showing 0
. See components/include/memfault/metrics/metrics.h
for detailsexamples/qp
) to compile and run correctly nowexamples/esp32/README.md
+
). Update the ESP port to check for reserved characters in query params and emit an errorcmake/Memfault.cmake
, as reported in issue #21 (thank you @C47D !)1.0.0-dev
instead of 1.0.0+<6 digits of build id>
for the version specifier. Build id is no longer required for symbol file reconciliation and the +
character is a reserved character for URI schemes; this impacted OTA release requests. See this document for Memfault's recommended versioning strategyblack
and isort
formatters on python codemflt_shell_init()
, see the Mynewt port README.md for details. Huge thanks to @t3zeng for providing this implementation!LOG2
deferred mode on zephyr. This should fix bootloops when enabling LOG2
.MEMFAULT_ASSERT_RECORD()
to MEMFAULT_ASSERT_EXTRA_AND_REASON()
(regression in v0.23.0). This affected the _extra
additional context value passed via this macro.ports/esp_idf/memfault/common/memfault_platform_http_client.c
which caused the OTA example to always return “OTA Update Available” when the current version is already the latest.examples/README.md
os_coredump_cb
implementation when MEMFAULT_COREDUMP_CB=1
memfault_fault_handler
that could arise when compiling with -flto
.memfault_fault_handling_arm.c
that arose when using certain versions of the Clang compiler.modem_key_mgmt_exists
API usage to be compatible with changes upcoming in nRF Connect SDK 1.8.Added preview of the Memfault Diagnostic GATT Service (MDS). This service can be used to transparently forward data collected by the SDK to a Bluetooth Low Energy gateway and proxied to the cloud. See ports/include/memfault/ports/ble/mds.h for more details!
Implemented utility python script which can be used for quickly adding a memfault-firmware-sdk
port to an eclipse project. For more details, run
python scripts/eclipse_patch.py --help
Added example project demonstrating integration of Memfault on Cypress' CY8CKIT-064S0S2-4343W running Amazon-FreeRTOS publishing data using an AWS IoT MQTT broker. For more details about how to run the Memfault example, see examples/cypress/CY8CKIT-064S0S2-4343W/README.md.
Fixed a compiler warning emitted when using TI's GCC Compiler as reported by @albertskog in issue #18
flake8-pytest-style
linter to scripts/tests/test_memfault_gdb.py.event_storage.h
to prevent compilation errors when using the unity test framework to generate mocks.makefiles/MemfaultWorker.mk
to use sort
to guarantee a deterministic file list order irrespestive of make version. A consistent order is useful for reproducible builds.__has_include()
in Zephy port to remove the requirement of always needing to creatememfault_platform_config.h
, memfault_metrics_heartbeat_config.def
, & memfault_trace_reason_user_config.def
for a build to compile. To force a compile failure instead when any of these files do not exist, a user can set CONFIG_MEMFAULT_USER_CONFIG_SILENT_FAIL=n
memfault/version.h
.memfault_packetizer_set_active_sources
, to the data_packetizer module, which let's one control the exact data sources that will get packetized. See description in the header for more detailsMEMFAULT_SOFTWARE_WATCHDOG
macroCONFIG_MEMFAULT_HTTP_ENABLE
& CONFIG_MEMFAULT_ROOT_CERT_STORAGE_NRF9160_MODEM
& CONFIG_MEMFAULT_NRF_CONNECT_SDK
when using nRF91 targets.export
command to the demo cli to better mirror our suggested integration test commandsBOARD_NRF9160DK_NRF9160NS
or BOARD_THINGY91_NRF9160NS
), the following KConfig options will now be enabled by default. The following can be added to your prj.conf
to restore the original behavior:CONFIG_MEMFAULT_HTTP_ENABLE=n
CONFIG_MEMFAULT_NRF_CONNECT_SDK=n
CONFIG_MEMFAULT_ROOT_CERT_STORAGE_TLS_CREDENTIAL_STORAGE=y
MEMFAULT_TRACE_EVENT_WITH_LOG
and an integer along with arguments will be serialized instead. The actual string will recovered and formatted when it arrives in the Memfault cloud. This leads to a massive reduction in space & bandwidth needed to send trace events. For more details about how to set up, check out this guide!-Wshadow
compiler error that would arise in memfault_coredump_regions_armv7.c
when MEMFAULT_COLLECT_MPU_STATE
was enabledmemfault_coredump_storage_debug.c
to guard against potentially printing an uninitialized string.MEMFAULT_SOFTWARE_WATCHDOG
If you were already using MEMFAULT_SOFTWARE_WATCHDOG
, you will need to update your call site invocations to remove the argument being passed. i.e
- MEMFAULT_SOFTWARE_WATCHDOG(0); + MEMFAULT_SOFTWARE_WATCHDOG();
memfault/core/heap_stats.h
MEMFAULT_SOFTWARE_WATCHDOG
. This will result in the issue in the Memfault UI being classified for as a “Software Watchdog” instead of an “Assert” for easier classification.-fsanitize=undefined
memfault_gdb.py
helper script to use latest Memfault API for uploading symbol files.fw_build_id.py
script. The same script can now also be installed via pypi
: pip install mflt_build_id
MEMFAULT_HTTP_PERIODIC_UPLOAD_CONTEXT
, so the default can be overridden from other Kconfig files.MEMFAULT_HTTP_DEDICATED_WORKQUEUE_STACK_SIZE
CONFIG_MEMFAULT_NRF_CONNECT_SDK
is now only enabled by default when CONFIG_MEMFAULT=y
CONFIG_DEBUG_THREAD_INFO=y
is now selected by default (in prep for deprecation of CONFIG_OPENOCD_SUPPORT
)CONFIG_MEMFAULT_USER_CONFIG_ENABLE=y
) which can be used to remove requirement of providing any user specific configuration.CONFIG_MEMFAULT_HTTP_PERIODIC_UPLOAD_USE_SYSTEM_WORKQUEUE
. This is the default and matches previous release behavior of posting data to Memfault from the system work queueCONFIG_MEMFAULT_HTTP_PERIODIC_UPLOAD_USE_DEDICATED_WORKQUEUE
This is a new option which can be used to post data from a dedicated worker queue. This can be useful if the network stack may block for extended periods of time which would stall other system work queue jobs from getting processed.MEMFAULT_SHELL
by default when the Zephyr shell is enabled. CONFIG_SHELL=y
must now be enabled explicitly in your prj.conf
for the Memfault Shell to be enabled.sMemfaultBuildIdStorage
structure to track the build id length used for event serialization and updated fw_build_id.py
script to extract information.MEMFAULT_DEFAULT_REBOOT_REASON_IMPL
Kconfig option with MEMFAULT_REBOOT_REASON_GET_CUSTOM
and updated default configuration for the nRF Connect SDK. This fixes an issue resulting in the generic memfault_reboot_reason_get getting linked rather than the nRF Connect SDK port.CONFIG_MEMFAULT_COREDUMP_COLLECT_DATA_REGIONS
to enable/disable collection of .data
regionCONFIG_MEMFAULT_COREDUMP_COLLECT_BSS_REGIONS
to enable/disable collection of .bss
regionCONFIG_MEMFAULT_COREDUMP_STORAGE_CUSTOM=y
can be used to opt out of the default RAM backed coredump implementation and provide a custom one in the port.Added support for collecting additional register information when a Hardfault takes place when using the Zephyr port. This information will be decoded and displayed in the Memfault UI in the “Exceptions” tab.
Updated buffered_coredump_storage.h
to use memmov
instead of memcpy
since dst
and src
buffers may overlap when all of .bss
is saved in a coredump capture.
Added a new Kconfig option to the Zephyr port, CONFIG_MEMFAULT_METRICS_EXTRA_DEFS_FILE=y
, which causes memfault_metrics_heartbeat_extra.def
to be included in the metric definitions. This can be utilized by a third party consumer of Zephyr to more easily extend the default heartbeat metrics collected when using memfault.
memfault_gdb.py
helper script to use latest Memfault API for uploading symbol files.If you are using nRF Connect SDK / Zephyr port, the SDK will now automatically be picked up as a Zephyr Module! You will need to make two changes:
Remove the ZEPHYR_EXTRA_MODULES
addition from your projects CMakeLists.txt, i.e
--- a/your_application/CMakeLists.txt +++ b/your_application/CMakeLists.txt @@ -3,7 +3,6 @@ - list(APPEND ZEPHYR_EXTRA_MODULES $ENV{ZEPHYR_BASE}/../modules/memfault-firmware-sdk/ports/nrf-connect-sdk)
Add CONFIG_MEMFAULT_NRF_CONNECT_SDK=y
to your projects prj.conf
MEMFAULT_COREDUMP_USE_OTA_SLOT=y
which can be used to save a coredump in an unused OTA slot rather than the default coredump partition. This can be useful in situations where Memfault is being integrated after a product has shipped and updating the partition table is no longer possible.MEMFAULT_EVENT_STORAGE_NV_SUPPORT_ENABLED=0
which can be used to disable dynamic configuration of non-volatile storage. Setting this flag when the non-volatile event storage API is not in use will save several hundred bytes of codespace.memfault_log_save_preformatted()
leading to invalid logs being reported when attempting to save log lines > 128 bytes. (thanks @alvarop for the report!)memfault_create_unique_version_string()
, which can be used for easily appending a build id on the software version reported.MEMFAULT_DEMO_SHELL_RX_BUFFER_SIZE
can be used to shrink the maximum amount of bytes that can be buffered on a single line.memfault_demo_shell_commands.h
public and moved it to memfault/demo/shell_commands.h
to facilitate easier overriding of the default set of commands used in a build.export
command to demonstrate how data can be dumped via the consolememfault_platform_sanitize_address_range()
template example.MEMFAULT_PLATFORM_FAULT_HANDLER_CUSTOM
, which can be used to explicitly disable the stub memfault_platform_fault_handler()
implementationmemfault_fault_handling_assert()
declaration.MEMFAULT_COLLECT_MPU_STATE=1
in your memfault_platform_config.h
. Once enabled, the MPU will be automatically analyzed for configuration errors and results will be presented in the “MPU” tab in the Memfault UI for a coredump.memfault_log_trigger_collection
, which can be used to “freeze” the current contents of the log buffer when unexpected behavior takes place on the device for upload to Memfault. The logs can then be uploaded to Memfault just like any other data and appear in the UI for a device. For more details about the Memfault log subsystem see https://mflt.io/loggingtest_log
& trigger_logs
CLI commands to nRF5 & Zephyr example applications to exercise new log collection functionality.CONFIG_DOWNLOAD_CLIENT=y
& CONFIG_MEMFAULT_NRF_SHELL=y
NVMS_LOG_PART
) can be overridden MEMFAULT_PLATFORM_COREDUMP_STORAGE_PARTITION
MEMFAULT_PLATFORM_COREDUMP_STORAGE_MAX_SIZE_BYTES
memfault_log_save
stub to unit tests to facilitate easier testing of logging dependenciesmsp
& psp
register in Cortex-M fault handler.memfault_circular_buffer_read_with_callback()
, to circular buffer api.memfault_event_storage_bytes_used()
& memfault_event_storage_bytes_free()
, to event storage module.MEMFAULT_ASSERT_HALT_IF_DEBUGGING_ENABLED
. By default, it is off, but when enabled will cause memfault_platform_halt_if_debugging()
to be called prior to triggering the full coredump capture.resetreas_reboot_tracking.c
.memfault_metrics_heartbeat_debug_trigger()
is calledports/dialog/da1468x/reset_stat_reboot_tracking.c
, the memfault_platform_reboot_tracking_boot()
implementation from your memfault_platform_port.c
file can be removed and the one in the port can be picked up.memfault_device_info_dump()
which can be used to pretty print the device information populated in the memfault_platform_get_device_info()
dependency function.memfault_platform_sanitize_address_range()
. This functrions is intended for use in your memfault_platform_coredump_get_regions()
implementation when capturing regions that are not defined at compile time.memfault_coredump_storage_debug_test_*
which would generate a false positive test failure when the coredump storage area was not divisible by 16.ports/templates
directory to facilitate porting.ports/emlib/msc_coredump_storage.c
port in your system, you must add MEMFAULT_PLATFORM_COREDUMP_STORAGE_USE_FLASH=1
to your memfault_platform_config.h
ports/panics/src/memfault_platform_ram_backed_coredump.c
:memfault_platform_sanitize_address_range()
must be implemented.MEMFAULT_PLATFORM_COREDUMP_STORAGE_RAM_SIZE 700
in your memfault_platform_config.h
platforms
folder to examples
to better capture that the folder contains “example” integrations of the Memfault SDK into hello world style apps from various SDKsmemfault_gdb.py
CONFIG_LOG_IMMEDIATE=y
If you were linking any files from the platforms
folder into your project, the path needs to be updated to examples
:
- ${MEMFAULT_FIRMWARE_SDK}/platforms/ + ${MEMFAULT_FIRMWARE_SDK}/examples/
test_coredump_storage_debug
in some environments where const
arrays were getting dynamically built on the stack at runtime.memfault_fault_handling_arm.c
for Cortex-M0 targets.ports/templates
folder that can be copy/pasted into a project and used as a starting point for a Memfault port!Improved documentation in README and components directories.
Added coredump capture support to panics component for the AARCH64 architecture.
Reference platform API implementations for the following MCUs/SDKs:
fw_build_id.py
script improvements
script is now compatible with Python2 environments.
Added new --dump <chars>
option to simplify extraction of build id in automation, i.e:
python scripts/fw_build_id.py <ELF> --dump 7 3a3e81f
memfault_nrf5_coredump.c
in your project:nrf5_coredump_regions.c
(which defines the regions to collect in a coredump) & nrf5_coredump_storage.c
(which implements the port for saving coredumps to internal flash). Both of these files must be added to your build system.__CoreStart
& __MemfaultCoreStorageEnd
to __MemfaultCoreStorageStart
& __MemfaultCoreStorageEnd
in linker script.__MfltCoredumpRamStart
& __MfltCoredumpRamEnd
to __MemfaultCoredumpRamStart
& __MemfaultCoredumpRamEnd
components/include/memfault/config.h
. Platform overrides can be defined in memfault_platform_config.h
components/include/memfault/
. This simplifies adding components to build systems as only a single path is now needed!You must create the file memfault_platform_config.h
and add it to your include path. This file can be used in place of compiler defines to tune the SDK configurations settings.
If you are not using a Memfault build system helper
${MEMFAULT_FIRMWARE_SDK}/components/${COMPONENT}/include
${MEMFAULT_FIRMWARE_SDK}/components/include
to your build systemIf you were linking any of the nRF5 example app files in your project, the directory has changed:
- ${MEMFAULT_FIRMWARE_SDK}/nrf5/libraries/memfault/platform_reference_impl/memfault_platform_reboot_tracking.c + ${MEMFAULT_FIRMWARE_SDK}/ports/nrf5_sdk/resetreas_reboot_tracking.c - ${MEMFAULT_FIRMWARE_SDK}/nrf5/libraries/memfault/platform_reference_impl/memfault_platform_coredump.c + ${MEMFAULT_FIRMWARE_SDK}/ports/nrf5_sdk/memfault_nrf5_coredump.c
make menuconfig
and be used to disable the Memfault integration, CONFIG_MEMFAULT=n
.CONFIG_USING_ESP_CONSOLE=n
and CONFIG_MEMFAULT_CLI_ENABLED=n
MEMFAULT_GET_LR()
, MEMFAULT_GET_PC()
, and MEMFAULT_BREAKPOINT()
to compiler_gcc.h
to facilitate compilations of the SDK against other architectures.memfault_fota_start()
for more detailsmemfault_platform_metrics_timer_boot()
& memfault_platform_get_time_since_boot_ms()
memfault dependencies to Zephyr port. A custom implementation can still be provided by settingMEMFAULT_METRICS_TIMER_CUSTOM=y
CONFIG_MEMFAULT=y
and can be disabled by setting CONFIG_MEMFAULT_METRICS=n
CONFIG_MEMFAULT_HTTP_PERIODIC_UPLOAD=y
optionmemfault_packetizer_abort()
was called after a coredump was partially sent.Added a convenience header for picking up includes for all Memfault components. If you are using the build system helpers, this path will be picked up automatically.
#include "memfault/components.h" // call to any Memfault API in the components folder
Fixed a š leading to Root CAs not get loaded correctly when using the nRF Connect SDK port and the MEMFAULT_ROOT_CERT_STORAGE_TLS_CREDENTIAL_STORAGE=y
Kconfig option.
Applied suggestions from @rerickson1 for the Zephyr and nRF Connect SDK ports:
CONFIG_MEMFAULT_METRICS=y
can now be used to compile the metrics component into the Zephyr and nRF Connect SDK ports.CONFIG_MEMFAULT=y
must now be specified to enable the Memfault integration.memfault_trace_reason_user_config.def
or memfault_metrics_heartbeat_config.def
file, respectively, and add it to your include path.CONFIG_MEMFAULT=y
to your prj.conf
MEMFAULT_ROOT_CERT_STORAGE_*
Kconfig options for more detailsmemfault_freertos_ram_regions.c
port to collect all TCBs and then stacks. This way, the state of all tasks can be recovered even if the coredump storage regin is filled while writing all the task stacks.kMfltRebootReason_PinReset
for explicitly tracking external pin resets.kMfltRebootReason_SoftwareWatchdog
& kMfltRebootReason_HardwareWatchdog
for easier disambiguation between watchdog resets where a coredump was captured versus ones where no software handler ran and hardware reset the device.kMfltRebootReason_ClockFailure
for explicit tracking of resets due to loss of a clock signal or PLL lock.kMfltRebootReason_Lockup
for explicit tracking of faults from within the Hardfault or NMI exceptions on ARM Cortex-M MCUs.panics
component to support ESP8266 (Tensilica Xtensa LX106) MCU architecture.nRF Connect Updates:
memfault_esp_port_ota_update()
. More details can be found in ports/esp_idf/memfault/include/memfault/esp_port/http_client.h
MEMFAULT_CLI_ENABLED=n
Kconfig option.ports/freertos/include/memfault/ports/freertos_coredump.h
MemfaultWatchdog_Handler
. The handler will save a coredump so the full system state can be recovered when a watchdog takes place. More details can be found in ports/include/memfault/ports/watchdog.h
.A log can now be captured alongside a trace event by using a new API: MEMFAULT_TRACE_EVENT_WITH_LOG(reason, ...)
. This can be useful to capture arbitrary diagnostic data with an error event or to capture critical error logs that you would like to be alerted on when they happen. For example:
// @file memfault_trace_reason_user_config.def MEMFAULT_TRACE_REASON_DEFINE(Critical_Log)
// @file your_platform_log_implementation.h #include "memfault/core/trace_event.h" #define YOUR_PLATFORM_LOG_CRITICAL(fmt, ....) \ MEMFAULT_TRACE_EVENT_WITH_LOG(Critical_Log, fmt, __VA_ARGS__)
// @file your_platform_temperature_driver.c void record_temperature(void) { // ... // erase flash to free up space int rv = spi_flash_erase(...); if (rv != 0) { YOUR_PLATFORM_LOG_CRITICAL("Flash Erase Failure: rv=%d, spi_err=0x%x", spi_bus_get_status()); } }
The error tracing facilities are now initialized automatically for the esp-idf
Fixed a š where an erroneous size was reported from memfault_coredump_storage_check_size()
if MEMFAULT_COREDUMP_COLLECT_LOG_REGIONS=1
and memfault_log_boot()
had not yet been called
metrics
component is now included by default in the ESP32 portMEMFAULT_LOG_DEBUG
messages now print by defaultheartbeat_dump
CLI command for easy viewing of current heartbeat metricsmemfault_esp_port_data_available()
& memfault_esp_port_get_chunk()
APIS. This can be useful in scenarios where there are external MCUs forwarding Memfault chunks to the ESP32.memfault_platform_log
dependency). See components/include/memfault/core/debug_log.h
for more details.memfault_metrics_boot()
can now be removedmemfault_platform_metrics_timer_boot()
& memfault_platform_get_time_since_boot_ms()
can be removed as they are now provided as part of the port.memfault_platform_coredump_get_regions()
so it is recommended to order this list from the most to least important regions to capture.configSUPPORT_STATIC_ALLOCATION=1
configuration is used.kMfltRebootReason_SoftwareReset
& kMfltRebootReason_DeepSleep
.memfault_coredump_storage_check_size()
, to check that coredump storage is appropriately sized.MEMFAULT_TRACE_REASON_USER_DEFS_FILE
as part of the compiler flags.MEMFAULT_EVENT_STORAGE_READ_BATCHING_ENABLED
compiler flag. More details can be found in memfault_event_storage.cmemfault_build_id_get_string
, for populating a buffer with a portion of the Memfault Build ID as a string.MEMFAULT_TRACE_EVENT_WITH_STATUS(reason, status_code)
.MEMFAULT_ASSERT
s. Instead of pending an NMI exception, the assert path will now “trap” into the fault handler by executing a udf
instruction. This unifies the fault handling paths within the SDK and leaves the NMI Handler free for other uses within the user's environment.kMfltRebootReason_PowerOnReset
, kMfltRebootReason_BrownOutReset
, & kMfltRebootReason_Nmi
.MEMFAULT_COREDUMP_COLLECT_LOG_REGIONS=1
, the logging region will automatically be collected as part of a coredump. Step-by-step details can also be found in the logging integration guide.MEMFAULT_METRICS_KEY_DEFINE_WITH_RANGE()
which can be used for defining the minimum and maximum expected range for a heartbeat metric. This information is used by the Memfault cloud to better normalize the data when it is presented in the UI.panics
component, you will need to manually add the following file to your build system: $(MEMFAULT_SDK_ROOT)/components/panics/src/memfault_coredump_sdk_regions.c
memfault_data_export_chunk()
to guarantee the GDB chunk test utility can always be used to post chunks using the data export API.$(MEMFAULT_SDK_ROOT)/components/core/src/memfault_data_export.c
$(MEMFAULT_SDK_ROOT)/components/util/src/memfault_base64.c
-Wunused-parameter
, GNU GCC‘s -Wformat-signedness
, and Clang’s -Wno-missing-prototypes
& -Wno-missing-variable-declarations
.mflt get_latest_release
, to the Zephyr demo application (tested on the STM32L4) to demonstrate querying the Memfault cloud for new firmware updates.demo
component to make it easier to integrate an individual CLI commands into a project since some of the commands can be helpful for validating integrations. More details can be found in the README at components/demo/README.md.If you are using the “demo” component and are not making use our CMake or Make build system helpers, you will need to make the following changes:
$(MEMFAULT_SDK_ROOT)/components/demo/src/{memfault_demo_cli.c => panics/memfault_demo_panics.c}
$(MEMFAULT_SDK_ROOT)/components/demo/src/{ => panics}/memfault_demo_cli_aux.c
$(MEMFAULT_SDK_ROOT)/components/demo/src/memfault_demo_core.c
$(MEMFAULT_SDK_ROOT)/components/demo/src/http/memfault_demo_http.c
If you are using the http
component, the following macro names changed:
-#define MEMFAULT_HTTP_GET_API_PORT() -#define MEMFAULT_HTTP_GET_API_HOST() +#define MEMFAULT_HTTP_GET_CHUNKS_API_PORT() +#define MEMFAULT_HTTP_GET_CHUNKS_API_HOST()
reboot_tracking.h
to core
component since it has no dependencies on anything from the panics
component. This allows the reboot tracking to be more easily integrated in a standalone fashion.memfault_fault_handling_assert()
. This improves the recovery of local variables of frames in the backtrace when certain optimization levels are used.memfault_sdk_assert.c
to address a GCC warning (-Wpointer-to-int-cast
) emitted when compiling the file for 64 bit architectures.If you are already using reboot tracking in your system, you will need to update the following includes in your code:
-#include "memfault/panics/reboot_tracking.h" -#include "memfault/panics/reboot_reason_types.h" +#include "memfault/core/reboot_tracking.h" +#include "memfault/panics/reboot_reason_types.h"
If you are not using our CMake or Make build system helpers, you will need to update the path for the following files:
$(MEMFAULT_SDK_ROOT)/components/{panics => core}/src/memfault_ram_reboot_info_tracking.c
$(MEMFAULT_SDK_ROOT)/components/{panics => core}/src/memfault_reboot_tracking_serializer.c
eMfltResetReason
was renamed to eMemfaultRebootReason
.
memfault_build_info_dump()
can be called on boot to display the build that is running. This can be a useful way to sanity check that your debugger successfully flashed a new image.memfault_build_info_read()
can be used to read the build id for your own use cases. For example you could append a portion of it to a debug version to make it unique.$(MEMFAULT_SDK_ROOT)/components/core/src/memfault_build_id.c
$(MEMFAULT_SDK_ROOT)/components/core/src/memfault_core_utils.c
memfault/core/sdk_assert.h
.memfault_platform_halt_if_debugging()
for Cortex-M targets. The function is defined as weak so a user can still define the function to override the default behavior.memfault install_chunk_handler
to work with older versions of the GNU Arm Toolchain.$(MEMFAULT_SDK_ROOT)/components/core/src/memfault_sdk_assert.c
to your project.trace_event.h
to core
component since it has no dependencies on anything from the panics
component. This allows the trace event feature to be more easily integrated in a standalone fashion.If you are already using MEMFAULT_TRACE_EVENT()
in your project, you will need to update the include as follows:
-#include "memfault/panics/trace_event.h" +#include "memfault/core/trace_event.h"
If you are not using our CMake or Make build system helpers, you will need to update the source path for components/panics/src/memfault_trace_event.c
to components/core/src/memfault_trace_event.c
captured_date
for an event can now be set by implementing memfault_platform_time_get_current()
. If the API is not implemented, the captured_date
will continue to be set based on the time the event was received by the memfault cloud.reboot
CLI command to easily exercise it.reset_reason
can now optionally be provided as part of sResetBootupInfo
. This can be useful for scenarios where the reboot reason is known on bootup but could not be set prior to the device crashing.memfault_reboot_tracking_boot()
is called even if no information about the reboot has been provided. In this scenario, the reset reason will be kMfltRebootReason_Unknown
CONFIG_INIT_STACKS=y
) and determine if stacks has overflowed (CONFIG_MPU_STACK_GUARD=y
).device_serial
is no longer encoded by default as part of events. Instead, the device_serial
in an event is populated from the the unique device identifier used when posting the data to the chunks REST endpoint. This leads to ~20% reduction in the size of a typical event. Encoding device_serial
as part of the event itself can still be enabled by adding -DMEMFAULT_EVENT_INCLUDE_DEVICE_SERIAL=1
as a compilation flag but should not be necessary for a typical integration.memfault_log_read()
API to make it possible to use the module to cache logs in RAM and then flush them out to slower mediums, such as a UART console or Flash, from a background task.sCoredumpCrashInfo
when memfault_platform_coredump_get_regions is invoked. This can (optionally) be used to configure regions collected based on the state or run platform specific cleanup based on the state.MEMFAULT_ROOT_CERTS_PEM
.memfault_serializer_helper_encode_metadata()
to encode common event data.test_memfault_root_cert.cpp
and moved the base64
implementation within the unit test to the util
component so it is easier to share the code elsewhere in the future.const
to a few circular_buffer.h API signatures.memfault_metrics_boot()
changed as part of this update. If you are already using the metrics
component, you will need to update the call accordingly. See the notes in metrics.h for more details.$(MEMFAULT_SDK_ROOT)/components/core/src/memfault_log.c
to your project. (Note that until memfault_log_boot()
is called, all calls made to the logging module will be a no-op).memfault_platform_coredump_storage_clear()
NRF52 reference implementation for situations where the SoftDevice is enabled and there is a lot of Bluetooth activity. (In this scenario, NRF52 flash operations may need retries or take a while to complete).MemfaultWatchdog_Handler
can now be registered as the Exception Handler to automatically collect a coredump.__has_include
macro for IAR compiler since not all versions fully support it.MEMFAULT_TRACE_EVENT()
from interrupts. Note: If you are not using our CMake or Make build system helpers, this change requires that you add $(MEMFAULT_SDK_ROOT)/components/core/src/arch_arm_cortex_m.c
to your project.memfault_demo_shell
instead mbed-client-cli
, since mbed-client-cli
is not part of the main Mbed OS 5 distribution.__task
from IAR Cortex-M function handler declarations since it's not explicitly required and can lead to a compiler issue if the function prototype does not also use it.MEMFAULT_GET_LR()
now takes an argument which is the location to store the LR to (void *lr = MEMFAULT_GET_LR()
-> void *lr;
MEMFAULT_GET_LR(lr)
)memfault_coredump_read
while the system is running.memfault_packetizer_get_chunk()
, to data_packetizer module.MemoryWordAccessOnly
which can be used to force the region to be read 32 bits at a time. This can be useful for accessing certain peripheral register ranges which are not byte addressable.-DMEMFAULT_COLLECT_INTERRUPT_STATE=0
to your compiler flags. More configuration options can be found in memfault_coredump_regions_armv7.c.psp
and msp
registers when the system crashes. This allows for the running thread backtrace to be more reliably recovered when a crash occurs from an ISR.MEMFAULT_EXC_HANDLER_...
preprocessor defines to enable custom naming of exception handlers in the panics component.print_core
to print_chunk
in demo applications to better align with the Memfault nomenclature for data transfer.Updated memfault_platform_coredump_get_regions()
to take an additional argument, crash_info
which conveys information about the crash taking place (trace reason & stack pointer at time of crash). This allows platform ports to dynamically change the regions collected based on the crash if so desired. This will require an update that looks like the following to your port:
-const sMfltCoredumpRegion *memfault_platform_coredump_get_regions(size_t *num_regions) { +const sMfltCoredumpRegion *memfault_platform_coredump_get_regions( + const sCoredumpCrashInfo *crash_info, size_t *num_regions) {
Added a new API, memfault_coredump_storage_compute_size_required()
which can be called on boot to sanity check that platform coredump storage is large enough to hold a coredump. For example:
sMfltCoredumpStorageInfo storage_info = { 0 }; memfault_platform_coredump_storage_get_info(&storage_info); const size_t size_needed = memfault_coredump_storage_compute_size_required(); if (size_needed > storage_info.size) { MEMFAULT_LOG_ERROR("Coredump storage too small. Got %d B, need %d B", storage_info.size, size_needed); } MEMFAULT_ASSERT(size_needed <= storage_info.size);
Added a convenience RAM backed reference port for coredump platform APIs. This can be used for persisting a coredump in RAM across a reset.
memfault/core/reboot_tracking.h
for more details and https://mflt.io/2QlOlgH for a step-by-step setup tutorial.makefiles/MemfaultWorker.mk
). A user of the SDK can include this makefile when using a make as their build system to easily collect the sources and include paths needed to build Memfault SDK componentsmemfault_packetizer_get_next()
API in data_packetizer.h
. More details herememfault_coredump_read()
so platform ports can easily add locking on reads to coredump storage if necessary for transmission.examples/stm32/stm32h743i/README.md
for more details.memfault_fault_handling_arm.c
when using old versions of GCCmemfault_platform_get_device_info()
memfault/core/errors.h
examples/nrf5/README.md
for more details.First Public Release of Memfault Firmware SDK 0.0.2 - June 26, 2019
README.md
in root for summarycomponents/panics/README.md
for more detailsexamples/wiced/README.md