Skip to content

Commit 30b8c0d

Browse files
author
Memfault Inc
committed
Memfault Firmware SDK 1.0.0 (Build 2329)
1 parent efd97b9 commit 30b8c0d

File tree

9 files changed

+89
-6
lines changed

9 files changed

+89
-6
lines changed

CHANGES.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
### Changes between Memfault SDK 1.0.0 and 0.43.3 - June 1, 2023
2+
3+
🎉🎉🎉
4+
5+
The Memfault Firmware SDK is now version `1.0.0` as of this release! Note that
6+
this is just a procedural change, there are no breaking backwards-incompatible
7+
changes in this release. We forgot to update our major version back in 2019, but
8+
better late than never 😅! Hopefully the remaining 281,474,976,710,656 versions
9+
are enough 🤞.
10+
11+
🎉🎉🎉
12+
13+
#### :chart_with_upwards_trend: Improvements
14+
15+
- Zephyr:
16+
17+
- Add a new built-in metric `FileSystem_BytesFree` for tracking VFS bytes
18+
free. This is enabled automatically when `CONFIG_FILE_SYSTEM=y`. Use the
19+
Kconfig option `MEMFAULT_FS_BYTES_FREE_VFS_PATH` to set the VFS mount point
20+
to monitor utilization (default value is `/lfs1`). The Kconfig option
21+
`MEMFAULT_FS_BYTES_FREE_METRIC` can be used to disable the metric.
22+
- Update a few spots in the Zephyr demo CLI to use `shell_print` instead of
23+
`MEMFAULT_LOG` for command usage errors
24+
125
### Changes between Memfault SDK 0.43.3 and 0.43.2 - May 22, 2023
226

327
#### :chart_with_upwards_trend: Improvements

VERSION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
BUILD ID: 2200
2-
GIT COMMIT: dd058e1ee
1+
BUILD ID: 2329
2+
GIT COMMIT: 03cc59b56

components/include/memfault/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ typedef struct {
1919
uint8_t patch;
2020
} sMfltSdkVersion;
2121

22-
#define MEMFAULT_SDK_VERSION { .major = 0, .minor = 43, .patch = 3 }
22+
#define MEMFAULT_SDK_VERSION { .major = 1, .minor = 0, .patch = 0 }
2323

2424
#ifdef __cplusplus
2525
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* Device Tree overlay to enable auto-mounting littlefs in an internal
2+
partition, via the Nordic Partition Manager system */
3+
4+
/ {
5+
fstab {
6+
compatible = "zephyr,fstab";
7+
lfs1: lfs1 {
8+
compatible = "zephyr,fstab,littlefs";
9+
mount-point = "/lfs1";
10+
partition = <&storage_partition>;
11+
automount;
12+
read-size = <16>;
13+
prog-size = <16>;
14+
cache-size = <64>;
15+
lookahead-size = <32>;
16+
block-cycles = <512>;
17+
};
18+
};
19+
};

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ CONFIG_WATCHDOG=y
6262
# Enable Zephyr runtime asserts
6363
CONFIG_ASSERT=y
6464

65+
# Enable littlefs on intern al flash, to demo the file system utilization metric
66+
CONFIG_FILE_SYSTEM=y
67+
CONFIG_FILE_SYSTEM_LITTLEFS=y
68+
CONFIG_FILE_SYSTEM_SHELL=y
69+
6570
# Note: See ./CMakeLists.txt for additional Kconfig variables settings as not all variables can be
6671
# set in a single prj.conf for backward compatibility with older versions of the nRF Connect SDK /
6772
# Zephyr

ports/zephyr/Kconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,19 @@ config MEMFAULT_METRICS_DEFAULT_SET_ENABLE
324324
metrics collected, see ports/zephyr/config/memfault_metrics_heartbeat_zephyr_port_config.def
325325
When disabled, no default metrics will be collected.
326326

327+
config MEMFAULT_FS_BYTES_FREE_METRIC
328+
bool "Enable collection of a metric for the amount of free space on the filesystem"
329+
default y
330+
depends on FILE_SYSTEM
331+
332+
config MEMFAULT_FS_BYTES_FREE_VFS_PATH
333+
string "Path to the mount point to collect free space metrics for"
334+
default "lfs1"
335+
depends on FILE_SYSTEM && MEMFAULT_FS_BYTES_FREE_METRIC
336+
help
337+
The path to the virtual filesystem mount point to collect free space
338+
metrics for, omitting the leading '/'.
339+
327340
endif # MEMFAULT_METRICS
328341

329342
config MEMFAULT_SOFTWARE_WATCHDOG_CUSTOM

ports/zephyr/common/memfault_demo_cli.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ static int prv_memfault_assert_example(const struct shell *shell, size_t argc, c
149149

150150
static int prv_hang_example(const struct shell *shell, size_t argc, char **argv) {
151151
#if !CONFIG_WATCHDOG
152-
MEMFAULT_LOG_WARN("No watchdog configured, this will hang forever");
152+
shell_print(shell, "No watchdog configured, this will hang forever");
153153
#else
154154
MEMFAULT_LOG_DEBUG("Hanging system and waiting for watchdog!");
155155
#endif
@@ -188,7 +188,7 @@ static int prv_memmanage_example(const struct shell *shell, size_t argc, char **
188188

189189
static int prv_zephyr_assert_example(const struct shell *shell, size_t argc, char **argv) {
190190
#if !CONFIG_ASSERT
191-
MEMFAULT_LOG_WARN("CONFIG_ASSERT was disabled in the build, this command will have no effect");
191+
shell_print(shell, "CONFIG_ASSERT was disabled in the build, this command will have no effect");
192192
#endif
193193
__ASSERT(0, "test assert");
194194
return 0;
@@ -204,7 +204,8 @@ static int prv_cli_cmd_double_free(const struct shell *shell, size_t argc, char
204204
(void)argv;
205205

206206
#if !CONFIG_MEMFAULT_HEAP_STATS
207-
MEMFAULT_LOG_WARN(
207+
shell_print(
208+
shell,
208209
"CONFIG_MEMFAULT_HEAP_STATS was disabled in the build, this command will have no effect");
209210
#else
210211
uint8_t *ptr = k_malloc(100);

ports/zephyr/common/memfault_platform_metrics.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
#include "memfault/metrics/platform/timer.h"
1111
#include "memfault/ports/zephyr/version.h"
1212

13+
#if CONFIG_MEMFAULT_FS_BYTES_FREE_METRIC
14+
#include <fs/fs.h>
15+
#endif
16+
1317
static MemfaultPlatformTimerCallback *s_metrics_timer_callback;
1418

1519
#if CONFIG_SYS_HEAP_RUNTIME_STATS
@@ -80,6 +84,19 @@ void memfault_metrics_heartbeat_collect_sdk_data(void) {
8084
memfault_metrics_heartbeat_set_unsigned(MEMFAULT_METRICS_KEY(Heap_BytesFree), stats.free_bytes);
8185
#endif /* defined(CONFIG_SYS_HEAP_RUNTIME_STATS) */
8286

87+
#if CONFIG_MEMFAULT_FS_BYTES_FREE_METRIC
88+
{
89+
struct fs_statvfs fs_stats;
90+
int retval = fs_statvfs("/" CONFIG_MEMFAULT_FS_BYTES_FREE_VFS_PATH, &fs_stats);
91+
if (retval == 0) {
92+
// compute free bytes
93+
uint32_t bytes_free = fs_stats.f_frsize * fs_stats.f_bfree;
94+
memfault_metrics_heartbeat_set_unsigned(MEMFAULT_METRICS_KEY(FileSystem_BytesFree),
95+
bytes_free);
96+
}
97+
}
98+
#endif /* CONFIG_MEMFAULT_FS_BYTES_FREE_METRIC */
99+
83100
#endif /* CONFIG_MEMFAULT_METRICS_DEFAULT_SET_ENABLE */
84101
}
85102

ports/zephyr/config/memfault_metrics_heartbeat_zephyr_port_config.def

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ MEMFAULT_METRICS_KEY_DEFINE(AllTasksCpuUsage, kMemfaultMetricType_Unsigned)
1818
MEMFAULT_METRICS_KEY_DEFINE(Heap_BytesFree, kMemfaultMetricType_Unsigned)
1919
#endif
2020

21+
#if CONFIG_MEMFAULT_FS_BYTES_FREE_METRIC
22+
MEMFAULT_METRICS_KEY_DEFINE(FileSystem_BytesFree, kMemfaultMetricType_Unsigned)
2123
#endif
2224

25+
#endif /* CONFIG_MEMFAULT_METRICS_DEFAULT_SET_ENABLE */
26+
2327
#if CONFIG_MEMFAULT_METRICS_EXTRA_DEFS_FILE
2428
#include "memfault_metrics_heartbeat_extra.def"
2529
#endif

0 commit comments

Comments
 (0)