Skip to content

Commit 7cc391d

Browse files
author
Memfault Inc
committed
Memfault Firmware SDK 1.16.0 (Build 10952)
1 parent 72f52c0 commit 7cc391d

File tree

86 files changed

+635
-1946
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+635
-1946
lines changed

.codecov.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ coverage:
33
round: down
44
range: "70...100"
55
status:
6+
patch: off
67
project:
78
default:
89
target: 70%

CHANGELOG.md

Lines changed: 76 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,79 @@ 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.16.0] - 2024-10-24
10+
11+
### 🔥 Removed
12+
13+
- Removed support for Zephyr < 2.7.0
14+
- Removed support for nRF-Connect SDK < 1.9.2
15+
- Removed support for ESP-IDF < 4.4.0
16+
17+
Please [contact us](https://mflt.io/contact-support) if you need support for
18+
earlier versions!
19+
20+
### 🐛 Fixed
21+
22+
- General:
23+
24+
- Correct an issue where `eMemfaultRebootReason` is expressed as a 4-byte type
25+
instead of 2-bytes when compiling with Clang with high optimization, when
26+
targeting ARM. This results in Coredumps tagged as `Unknown` instead of the
27+
correct reason code.
28+
29+
### 📈 Added
30+
31+
- General:
32+
33+
- Add a pair of optional user-provided functions,
34+
`memfault_reboot_tracking_load()` / `memfault_reboot_tracking_save()`, to
35+
allow users to provide their own implementations for saving and loading
36+
reboot tracking data. This is useful when the default implementation is not
37+
suitable for the platform or when the user wants to store the data in a
38+
different location.
39+
40+
- The
41+
[Stable Sessions Device Vital](https://docs.memfault.com/docs/platform/memfault-core-metrics#stable-sessions)
42+
added in SDK version `1.15.0` is fully available and no longer considered
43+
experimental.
44+
45+
- Add an optional `memfault_port_coredump_save_begin()` callback, for use by
46+
Memfault ports. This allows `memfault_platform_coredump_save_begin()` to be
47+
implemented by the platform instead, for custom pre-coredump operations.
48+
Thanks to @finger563 for reporting this issue in
49+
[#77](https://github.com/memfault/memfault-firmware-sdk/issues/77)!
50+
51+
- Improved API docs for events and data packetizer components by noting
52+
restrictions for use in ISR contexts
53+
54+
- Zephyr:
55+
56+
- Update the Qemu app to support the `nucleo_l496zg` board, with support for
57+
the Zephyr `bbram` subsystem, and implement the new
58+
`memfault_reboot_tracking_load()` / `memfault_reboot_tracking_save()`
59+
functions to demonstrate the functionality.
60+
61+
- ESP-IDF:
62+
63+
- New Kconfig setting, `CONFIG_MEMFAULT_ENABLE_REBOOT_DIAG_DUMP`, to print the
64+
ESP-IDF reboot reason code on system boot, for debugging purposes. This
65+
feature is disabled by default.
66+
67+
### 🛠️ Changed
68+
69+
- General:
70+
71+
- Update support links to refer to the preferred site
72+
<https://mflt.io/contact-support> instead of the Memfault support email.
73+
This link will redirect to a form where questions can be sent to the
74+
Memfault support team.
75+
76+
- nRF-Connect SDK:
77+
78+
- Changed the Kconfig symbol `MEMFAULT_REBOOT_REASON_GET_CUSTOM` to be `imply`
79+
instead of `select` when the nRF-Connect SDK is enabled. This permits users
80+
to disable the `nrfx`-based reboot reason tracking if needed.
81+
982
## [1.15.0] - 2024-10-13
1083

1184
### 📈 Added
@@ -1361,8 +1434,9 @@ earlier versions!
13611434
- Improve FOTA support for nRF-Connect SDK 2.4+, by improving the technique
13621435
used to find the correct Memfault server root cert. Memfault uses a fast CDN
13631436
to improve OTA payload delivery, which uses a different root cert than the
1364-
Memfault device server. Please contact <[email protected]> immediately if
1365-
you encounter any cert-related issues.
1437+
Memfault device server. Please
1438+
[contact support](https://mflt.io/contact-support) immediately if you
1439+
encounter any cert-related issues.
13661440

13671441
### 💥 Breaking Changes
13681442

VERSION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
BUILD ID: 10752
2-
GIT COMMIT: 1904cdb3cb
3-
VERSION: 1.15.0
1+
BUILD ID: 10952
2+
GIT COMMIT: c690f5abc6
3+
VERSION: 1.16.0

components/core/src/memfault_ram_reboot_info_tracking.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,23 @@ static void prv_record_reboot_event(eMemfaultRebootReason reboot_reason,
160160
s_mflt_reboot_info->lr = reg->lr;
161161
}
162162

163+
MEMFAULT_WEAK void memfault_reboot_tracking_load(sMemfaultRebootTrackingStorage *dst) {
164+
(void)dst;
165+
}
166+
167+
MEMFAULT_WEAK void memfault_reboot_tracking_save(const sMemfaultRebootTrackingStorage *src) {
168+
(void)src;
169+
}
170+
163171
void memfault_reboot_tracking_boot(void *start_addr, const sResetBootupInfo *bootup_info) {
164172
s_mflt_reboot_info = start_addr;
165173

166174
if (start_addr == NULL) {
167175
return;
168176
}
169177

178+
memfault_reboot_tracking_load((sMemfaultRebootTrackingStorage *)s_mflt_reboot_info);
179+
170180
if (!prv_check_or_init_struct()) {
171181
return;
172182
}
@@ -191,6 +201,8 @@ void memfault_reboot_tracking_mark_reset_imminent(eMemfaultRebootReason reboot_r
191201
}
192202

193203
prv_record_reboot_event(reboot_reason, reg);
204+
205+
memfault_reboot_tracking_save((const sMemfaultRebootTrackingStorage *)s_mflt_reboot_info);
194206
}
195207

196208
bool memfault_reboot_tracking_read_reset_info(sMfltResetReasonInfo *info) {

components/include/memfault/core/data_packetizer.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@
2020
extern "C" {
2121
#endif
2222

23-
//! Fills buffer with a chunk when there is data available
23+
//! Fill buffer with a chunk when there is data available
2424
//!
2525
//! NOTE: This is the simplest way to interact with the packetizer. The API call returns a single
2626
//! "chunk" to be forwarded out over the transport topology to the Memfault cloud. For more
2727
//! advanced control over chunking, the lower level APIs exposed below in this module can be used.
28+
//! @note This function must not be called from an ISR context.
2829
//!
2930
//! @param[out] buf The buffer to copy data to be sent into
3031
//! @param[in,out] buf_len The size of the buffer to copy data into. On return, populated
@@ -54,10 +55,13 @@ typedef enum {
5455
//! transport path.
5556
#define MEMFAULT_PACKETIZER_MIN_BUF_LEN 9
5657

57-
//! @return true if there is data available to send, false otherwise
58+
//! Check if there is data available to send
59+
//!
60+
//! @note This can be used prior to opening a connection over the underlying transport to the
61+
//! internet
62+
//! @note This function must not be called from an ISR context.
5863
//!
59-
//! This can be used to check if there is any data to send prior to opening a connection over the
60-
//! underlying transport to the internet
64+
//! @return true if there is data available to send, false otherwise
6165
bool memfault_packetizer_data_available(void);
6266

6367
typedef struct {
@@ -87,6 +91,10 @@ typedef struct {
8791
uint32_t single_chunk_message_length;
8892
} sPacketizerMetadata;
8993

94+
//! Initialize the packetizer and get metadata about the message to be sent
95+
//!
96+
//! @note This function must not be called from an ISR context.
97+
//!
9098
//! @return true if there is data available to send, false otherwise.
9199
bool memfault_packetizer_begin(const sPacketizerConfig *cfg, sPacketizerMetadata *metadata_out);
92100

@@ -106,6 +114,7 @@ bool memfault_packetizer_begin(const sPacketizerConfig *cfg, sPacketizerMetadata
106114
//! this API up to the cloud _reliably_ and _in-order_.
107115
//! @note The api is not threadsafe. The expectation is that a user will drain data from a single
108116
//! thread or otherwise wrap the call with a mutex
117+
//! @note This function must not be called from an ISR context.
109118
//!
110119
//! @param[out] buf The buffer to copy data to be sent into
111120
//! @param[in,out] buf_len The size of the buffer to copy data into. On return, populated

components/include/memfault/core/event_storage.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,25 @@ int memfault_event_storage_persist(void);
102102

103103
#endif
104104

105-
//! Simple API call to retrieve the number of bytes used in the allocated event storage buffer.
106-
//! Returns zero if the storage has not been allocated.
105+
//! Retrieve the number of bytes used in the allocated event storage buffer.
106+
//!
107+
//! @note This function must not be called from an ISR context.
108+
//!
109+
//! @return zero if the storage has not been allocated.
107110
size_t memfault_event_storage_bytes_used(void);
108111

109-
//! Simple API call to retrieve the number of bytes free (unused) in the allocated event storage
110-
//! buffer. Returns zero if the storage has not been allocated.
112+
//! Retrieve the number of bytes free (unused) in the allocated event storage
113+
//! buffer.
114+
//!
115+
//! @note This function must not be called from an ISR context.
116+
//!
117+
//! @return zero if the storage has not been allocated.
111118
size_t memfault_event_storage_bytes_free(void);
112119

113120
//! Check if event storage component has booted
114121
//!
122+
//! @note This function must not be called from an ISR context.
123+
//!
115124
//! @returns true if event storage booted or false if not
116125
bool memfault_event_storage_booted(void);
117126

components/include/memfault/core/reboot_reason_types.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ extern "C" {
2424
#undef MEMFAULT_EXPECTED_REBOOT_REASON_DEFINE
2525
#undef MEMFAULT_UNEXPECTED_REBOOT_REASON_DEFINE
2626

27-
typedef enum MfltResetReason {
27+
//! This enum must be packed to prevent compiler optimizations in instructions which load an
28+
//! eMemfaultRebootReason.
29+
typedef enum MEMFAULT_PACKED MfltResetReason {
2830
// A reboot reason was not determined either by hardware or a previously marked reboot reason
2931
// This reason is classified as a crash when calculating the operational_crashfree_hours metric
3032
kMfltRebootReason_Unknown = 0x0000,
@@ -135,6 +137,8 @@ typedef enum MfltResetReason {
135137

136138
} eMemfaultRebootReason;
137139

140+
MEMFAULT_STATIC_ASSERT(sizeof(eMemfaultRebootReason) == 2, "Reboot reason enum must be 2 bytes");
141+
138142
#if MEMFAULT_REBOOT_REASON_CUSTOM_ENABLE == 1
139143
// Ensure that the custom reboot reasons are within the expected range
140144
#define MEMFAULT_EXPECTED_REBOOT_REASON_DEFINE(name) \

components/include/memfault/core/reboot_tracking.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,40 @@ bool memfault_reboot_tracking_metrics_session_was_active(uint32_t index);
230230
//! @param name The name of the custom reboot reason
231231
#define MEMFAULT_REBOOT_REASON_KEY(name) kMfltRebootReason_##name
232232

233+
//! The below pair of functions, memfault_reboot_tracking_load and
234+
//! memfault_reboot_tracking_save, are used when the reboot tracking RAM storage
235+
//! cannot be safely persisted across reboots. In this case, the user can
236+
//! provide their own implementation to load and save the reboot tracking data
237+
//! to a backing store (e.g. battery-backed ram, non-memory-mapped backup
238+
//! registers, etc).
239+
//!
240+
//! memfault_reboot_tracking_load() is called from
241+
//! memfault_reboot_tracking_boot(), and is used to retrieve the initial value
242+
//! of the reboot tracking data from the backing store.
243+
//!
244+
//! memfault_reboot_tracking_save() is called from
245+
//! memfault_reboot_tracking_mark_reset_imminent(), and is used to persist the
246+
//! reboot tracking data to the backing store.
247+
248+
typedef MEMFAULT_PACKED_STRUCT MemfaultRebootTrackingStorage {
249+
uint8_t data[MEMFAULT_REBOOT_TRACKING_REGION_SIZE];
250+
}
251+
sMemfaultRebootTrackingStorage;
252+
253+
//! Optional callback issued to load reboot tracking from the backing store,
254+
//! called during Memfault reboot tracking initialization.
255+
//!
256+
//! @param dst The destination buffer to load into
257+
extern void memfault_reboot_tracking_load(sMemfaultRebootTrackingStorage *dst);
258+
259+
//! Optional callback issued when reboot tracking data should be saved to the
260+
//! backing store, for persistence across reboots. This function MUST be safe
261+
//! to call from exception context! It is called from the Memfault fault handler
262+
//! before the coredump is saved.
263+
//!
264+
//! @param src The source buffer to save
265+
extern void memfault_reboot_tracking_save(const sMemfaultRebootTrackingStorage *src);
266+
233267
#ifdef __cplusplus
234268
}
235269
#endif

components/include/memfault/panics/platform/coredump.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,14 @@ extern bool memfault_coredump_read(uint32_t offset, void *buf, size_t buf_len);
161161
//! @return true if to continue saving the coredump, false to abort
162162
extern bool memfault_platform_coredump_save_begin(void);
163163

164+
//! Called prior to invoking any platform_storage_[read/write/erase] calls upon
165+
//! crash
166+
//!
167+
//! @note this is similar to memfault_platform_coredump_save_begin(), but is
168+
//! meant to be implemented by the Memfault port, not the user platform
169+
//! @return true if to continue saving the coredump, false to abort
170+
extern bool memfault_port_coredump_save_begin(void);
171+
164172
#ifdef __cplusplus
165173
}
166174
#endif

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 = 15, .patch = 0 }
24-
#define MEMFAULT_SDK_VERSION_STR "1.15.0"
23+
{ .major = 1, .minor = 16, .patch = 0 }
24+
#define MEMFAULT_SDK_VERSION_STR "1.16.0"
2525

2626
#ifdef __cplusplus
2727
}

0 commit comments

Comments
 (0)