Skip to content

Commit 2d0fd16

Browse files
author
Memfault Inc
committed
Memfault Firmware SDK 1.30.0 (Build 15332)
1 parent a7b3a91 commit 2d0fd16

File tree

11 files changed

+146
-23
lines changed

11 files changed

+146
-23
lines changed

CHANGELOG.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,57 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to
77
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
88

9+
## [1.30.0] - 2025-09-23
10+
11+
This is a minor release. Highlights:
12+
13+
- Added active task stack collection control in Zephyr
14+
- Changed mount point selection for filesystem metric to look up from Zephyr
15+
device tree fstab entries
16+
- Fixed potential WiFi stack overflow on nRF70 series devices during HTTP
17+
uploads
18+
19+
### 📈 Added
20+
21+
- Zephyr
22+
23+
- Add Kconfig option
24+
`CONFIG_MEMFAULT_COREDUMP_ACTIVE_TASK_STACK_SIZE_TO_COLLECT` to control how
25+
much of the active task stack is collected in coredumps. This can be used to
26+
prioritize capturing details about the running task when coredump storage
27+
space is limited. Defaults to
28+
`CONFIG_MEMFAULT_COREDUMP_STACK_SIZE_TO_COLLECT` for backwards
29+
compatibility.
30+
31+
- Add the `mflt_http` workqueue thread to the default set of threads tracked
32+
with max stack usage metrics. The default thread metrics can be controlled
33+
with `CONFIG_MEMFAULT_METRICS_THREADS_DEFAULTS`.
34+
35+
### 🛠️ Changed
36+
37+
- Zephyr
38+
39+
- Replace use of deprecated API `bt_hci_cmd_create()` with
40+
`bt_hci_cmd_alloc()` for Zephyr 4.2+.
41+
42+
- Enable `FileSystem_BytesFree` metric by default only when fstab is present
43+
in the device tree. If present, the mount point is now automatically
44+
detected from checking fstab nodes. Manual configuration of the mount point
45+
via `CONFIG_MEMFAULT_FS_BYTES_FREE_VFS_PATH` still takes precedence when
46+
set. If not using fstab, set `CONFIG_MEMFAULT_FS_BYTES_FREE_METRIC=y` to
47+
enable collection.
48+
49+
### 🐛 Fixed
50+
51+
- nRF-Connect SDK:
52+
53+
- Increase the default value of
54+
`CONFIG_MEMFAULT_HTTP_DEDICATED_WORKQUEUE_STACK_SIZE` to 4kB when uploading
55+
via WiFi on the nRF70 series. This avoids potential stack overflows caused
56+
while performing periodic uploads via HTTP. Thanks to
57+
[@chshzh](https://github.com/chshzh) for reporting this and proposing a fix
58+
in [#95](https://github.com/memfault/memfault-firmware-sdk/issues/95)!
59+
960
## [1.29.0] - 2025-09-11
1061

1162
This is a minor release. Highlights:

VERSION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
BUILD ID: 15235
2-
GIT COMMIT: e7a5241921
3-
VERSION: 1.29.0
1+
BUILD ID: 15332
2+
GIT COMMIT: a6e147605b
3+
VERSION: 1.30.0

components/include/memfault/version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ typedef struct {
2020
} sMfltSdkVersion;
2121

2222
#define MEMFAULT_SDK_VERSION \
23-
{ .major = 1, .minor = 29, .patch = 0 }
24-
#define MEMFAULT_SDK_VERSION_STR "1.29.0"
23+
{ .major = 1, .minor = 30, .patch = 0 }
24+
#define MEMFAULT_SDK_VERSION_STR "1.30.0"
2525

2626
#ifdef __cplusplus
2727
}
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
// Thread stack usage metrics
2-
MEMFAULT_METRICS_KEY_DEFINE_WITH_SCALE_VALUE(memory_mflt_http_pct_max, kMemfaultMetricType_Unsigned, 100)
32
MEMFAULT_METRICS_KEY_DEFINE_WITH_SCALE_VALUE(memory_wdt_pct_max, kMemfaultMetricType_Unsigned, 100)
43
MEMFAULT_METRICS_KEY_DEFINE_WITH_SCALE_VALUE(memory_shell_uart_pct_max, kMemfaultMetricType_Unsigned, 100)

examples/nrf-connect-sdk/nrf9160/memfault_demo_app/prj.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ CONFIG_WATCHDOG=y
8383
# Enable Zephyr runtime asserts
8484
CONFIG_ASSERT=y
8585

86-
# Enable littlefs on intern al flash, to demo the file system utilization metric
86+
# Enable littlefs on internal flash, to demo the file system utilization metric
8787
CONFIG_FILE_SYSTEM=y
8888
CONFIG_FILE_SYSTEM_LITTLEFS=y
8989
CONFIG_FILE_SYSTEM_SHELL=y

ports/zephyr/Kconfig

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,13 @@ config MEMFAULT_COREDUMP_STACK_SIZE_TO_COLLECT
171171
The larger the size, the more stack frames Memfault can recover for tasks. The
172172
default setting typically allows for 4 or more frames to be recovered.
173173

174+
config MEMFAULT_COREDUMP_ACTIVE_TASK_STACK_SIZE_TO_COLLECT
175+
int "Maximum amount of bytes to collect for active task"
176+
default MEMFAULT_COREDUMP_STACK_SIZE_TO_COLLECT
177+
help
178+
The larger the size, the more stack frames Memfault can recover for the active task.
179+
The default setting typically allows for 4 or more frames to be recovered.
180+
174181
config MEMFAULT_COREDUMP_FULL_THREAD_STACKS
175182
bool "Collect full thread stacks in coredumps"
176183
default n
@@ -427,6 +434,7 @@ endchoice # MEMFAULT_HTTP_PERIODIC_UPLOAD_CONTEXT
427434

428435
config MEMFAULT_HTTP_DEDICATED_WORKQUEUE_STACK_SIZE
429436
int "Stack size for dedicated http upload queue, in bytes"
437+
default 4096 if WIFI_NRF70
430438
default 2048
431439
depends on MEMFAULT_HTTP_PERIODIC_UPLOAD_USE_DEDICATED_WORKQUEUE
432440

@@ -649,16 +657,24 @@ config MEMFAULT_METRICS_DEFAULT_SET_ENABLE
649657

650658
config MEMFAULT_FS_BYTES_FREE_METRIC
651659
bool "Enable a metric for the amount of free space on the filesystem"
652-
default y
660+
default y if "$(dt_path_enabled,/fstab)"
653661
depends on FILE_SYSTEM
662+
help
663+
Collects a metric for the amount of free space on the virtual filesystem.
664+
If using fstab, the first mount point found will be used. Otherwise, the
665+
user must update MEMFAULT_FS_BYTES_FREE_VFS_PATH to the mount point of
666+
the filesystem to collect metrics for. Note: may be performance intensive
667+
depending on flash technology and filesystem type.
654668

655669
config MEMFAULT_FS_BYTES_FREE_VFS_PATH
656670
string "Path to the mount point to collect free space metrics for"
657-
default "lfs1"
671+
default ""
658672
depends on FILE_SYSTEM && MEMFAULT_FS_BYTES_FREE_METRIC
659673
help
660674
The path to the virtual filesystem mount point to collect free space
661-
metrics for, omitting the leading '/'.
675+
metrics for, omitting the leading '/'. If left empty and an fstab node
676+
exists in the device tree, the first available mount point from the
677+
fstab nodes will be used.
662678

663679
config MEMFAULT_METRICS_CPU_TEMP
664680
bool "Enable CPU temperature metrics"

ports/zephyr/common/memfault_platform_coredump_regions.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ size_t memfault_zephyr_coredump_get_regions(const sCoredumpCrashInfo *crash_info
3939

4040
#if CONFIG_MEMFAULT_COREDUMP_COLLECT_STACK_REGIONS
4141
size_t stack_size_to_collect = memfault_platform_sanitize_address_range(
42-
crash_info->stack_address, CONFIG_MEMFAULT_COREDUMP_STACK_SIZE_TO_COLLECT);
42+
crash_info->stack_address, CONFIG_MEMFAULT_COREDUMP_ACTIVE_TASK_STACK_SIZE_TO_COLLECT);
4343

4444
regions[region_idx] =
4545
MEMFAULT_COREDUMP_MEMORY_REGION_INIT(crash_info->stack_address, stack_size_to_collect);
@@ -56,7 +56,7 @@ size_t memfault_zephyr_coredump_get_regions(const sCoredumpCrashInfo *crash_info
5656
// exception frame that will have been stacked on it as well
5757
const uint32_t extra_stack_bytes = 128;
5858
stack_size_to_collect = memfault_platform_sanitize_address_range(
59-
psp, CONFIG_MEMFAULT_COREDUMP_STACK_SIZE_TO_COLLECT + extra_stack_bytes);
59+
psp, CONFIG_MEMFAULT_COREDUMP_ACTIVE_TASK_STACK_SIZE_TO_COLLECT + extra_stack_bytes);
6060
regions[region_idx] = MEMFAULT_COREDUMP_MEMORY_REGION_INIT(psp, stack_size_to_collect);
6161
region_idx++;
6262
}

ports/zephyr/common/metrics/memfault_platform_bluetooth_metrics.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,12 @@ static void prv_record_connection_rssi(struct bt_conn *conn) {
7474

7575
struct bt_hci_cp_read_rssi *cp;
7676

77+
#if MEMFAULT_ZEPHYR_VERSION_GT(4, 1)
78+
struct net_buf *buf = bt_hci_cmd_alloc(K_FOREVER);
79+
#else
7780
struct net_buf *buf = bt_hci_cmd_create(BT_HCI_OP_READ_RSSI, sizeof(*cp));
81+
#endif
82+
7883
if (!buf) {
7984
return;
8085
}

ports/zephyr/common/metrics/memfault_platform_metrics.c

Lines changed: 53 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,56 @@ static void prv_collect_memory_usage_metrics(void) {
137137
}
138138
#endif // defined(CONFIG_MEMFAULT_METRICS_MEMORY_USAGE)
139139

140+
#if defined(CONFIG_MEMFAULT_FS_BYTES_FREE_METRIC)
141+
void prv_collect_fs_bytes_free_metric(void) {
142+
const char *mount_point = NULL;
143+
144+
// User configured path takes priority
145+
#ifdef CONFIG_MEMFAULT_FS_BYTES_FREE_VFS_PATH
146+
char normalized_path[64];
147+
if (CONFIG_MEMFAULT_FS_BYTES_FREE_VFS_PATH[0] != '\0') {
148+
MEMFAULT_LOG_DEBUG("Using user-configured mount point for FS bytes free metric");
149+
snprintf(normalized_path, sizeof(normalized_path), "/%s",
150+
CONFIG_MEMFAULT_FS_BYTES_FREE_VFS_PATH);
151+
mount_point = normalized_path;
152+
}
153+
#endif
154+
155+
// Auto-detect from fstab only
156+
#if DT_NODE_EXISTS(DT_PATH(fstab))
157+
MEMFAULT_LOG_DEBUG("Auto-detecting mount point from fstab for FS bytes free metric");
158+
159+
// Create a ternary chain to find the first mount point available
160+
//
161+
// The return statement here will expand to something like:
162+
// return (DT_NODE_HAS_PROP(child1, mount_point) ? DT_PROP(child1, mount_point) :)
163+
// (DT_NODE_HAS_PROP(child2, mount_point) ? DT_PROP(child2, mount_point) :)
164+
// (DT_NODE_HAS_PROP(child3, mount_point) ? DT_PROP(child3, mount_point) :)
165+
// NULL;
166+
#define FIND_FIRST_MOUNT(node_id) \
167+
DT_NODE_HAS_PROP(node_id, mount_point) ? DT_PROP(node_id, mount_point):
168+
169+
mount_point = DT_FOREACH_CHILD_SEP(DT_PATH(fstab), FIND_FIRST_MOUNT, ) NULL;
170+
#endif
171+
172+
if (mount_point == NULL) {
173+
MEMFAULT_LOG_WARN("No mount point configured - skipping FS bytes free metric");
174+
return;
175+
}
176+
177+
MEMFAULT_LOG_DEBUG("Collecting FS bytes free metric for mount point %s", mount_point);
178+
179+
struct fs_statvfs fs_stats;
180+
int retval = fs_statvfs(mount_point, &fs_stats);
181+
if (retval == 0) {
182+
// compute free bytes
183+
uint32_t bytes_free = fs_stats.f_frsize * fs_stats.f_bfree;
184+
MEMFAULT_METRIC_SET_UNSIGNED(FileSystem_BytesFree, bytes_free);
185+
}
186+
}
187+
188+
#endif /* CONFIG_MEMFAULT_FS_BYTES_FREE_METRIC */
189+
140190
// Written as a function vs. in-line b/c we might want to extern this at some point?
141191
// See ports/zephyr/config/memfault_metrics_heartbeat_zephyr_port_config.def for
142192
// where the metrics key names come from.
@@ -181,20 +231,12 @@ void memfault_metrics_heartbeat_collect_sdk_data(void) {
181231
// for percentage conversion
182232
uint32_t usage_pct = (uint32_t)(non_idle_tasks_cycles_delta * 10000 / all_tasks_cycles_delta);
183233
MEMFAULT_METRIC_SET_UNSIGNED(cpu_usage_pct, usage_pct);
184-
MEMFAULT_LOG_DEBUG("CPU usage: %u.%02u%%\n", usage_pct / 100, usage_pct % 100);
234+
MEMFAULT_LOG_DEBUG("CPU usage: %u.%02u%%", usage_pct / 100, usage_pct % 100);
185235
}
186236
#endif // MEMFAULT_ZEPHYR_VERSION_GT_STRICT(3, 0)
187237

188-
#if CONFIG_MEMFAULT_FS_BYTES_FREE_METRIC
189-
{
190-
struct fs_statvfs fs_stats;
191-
int retval = fs_statvfs("/" CONFIG_MEMFAULT_FS_BYTES_FREE_VFS_PATH, &fs_stats);
192-
if (retval == 0) {
193-
// compute free bytes
194-
uint32_t bytes_free = fs_stats.f_frsize * fs_stats.f_bfree;
195-
MEMFAULT_METRIC_SET_UNSIGNED(FileSystem_BytesFree, bytes_free);
196-
}
197-
}
238+
#if defined(CONFIG_MEMFAULT_FS_BYTES_FREE_METRIC)
239+
prv_collect_fs_bytes_free_metric();
198240
#endif /* CONFIG_MEMFAULT_FS_BYTES_FREE_METRIC */
199241

200242
#endif /* CONFIG_MEMFAULT_METRICS_DEFAULT_SET_ENABLE */

ports/zephyr/common/metrics/memfault_platform_thread_metrics.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818

1919
MEMFAULT_WEAK MEMFAULT_METRICS_DEFINE_THREAD_METRICS(
2020
#if defined(CONFIG_MEMFAULT_METRICS_THREADS_DEFAULTS)
21+
#if defined(CONFIG_MEMFAULT_HTTP_PERIODIC_UPLOAD_USE_DEDICATED_WORKQUEUE)
22+
{
23+
.thread_name = "mflt_http",
24+
.stack_usage_metric_key = MEMFAULT_METRICS_KEY(memory_mflt_http_pct_max),
25+
},
26+
#endif
2127
{
2228
.thread_name = "idle",
2329
.stack_usage_metric_key = MEMFAULT_METRICS_KEY(memory_idle_pct_max),

0 commit comments

Comments
 (0)