Skip to content

Commit 2e3d5e5

Browse files
author
Memfault Inc
committed
Memfault Firmware SDK 1.4.3 (Build 4437)
1 parent 50f0e19 commit 2e3d5e5

File tree

31 files changed

+388
-64
lines changed

31 files changed

+388
-64
lines changed

CHANGES.md

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,77 @@
11
# Memfault Firmware SDK Changelog
22

3+
## [1.4.3] - 2023-11-08
4+
5+
### :rocket: New Features
6+
7+
- General:
8+
9+
- Add a new streamlined Metrics setter API:
10+
11+
- `MEMFAULT_HEARTBEAT_SET_SIGNED(key_name, signed_value)`
12+
- `MEMFAULT_HEARTBEAT_SET_UNSIGNED(key_name, unsigned_value)`
13+
- `MEMFAULT_HEARTBEAT_SET_STRING(key_name, value)`
14+
- `MEMFAULT_HEARTBEAT_TIMER_START(key_name)`
15+
- `MEMFAULT_HEARTBEAT_TIMER_STOP(key_name)`
16+
- `MEMFAULT_HEARTBEAT_ADD(key_name, amount)`
17+
18+
These APIs can be used in place of the original APIs:
19+
20+
- `memfault_metrics_heartbeat_set_signed(MEMFAULT_METRICS_KEY(key_name), signed_value)`
21+
- `memfault_metrics_heartbeat_set_unsigned(MEMFAULT_METRICS_KEY(key_name), unsigned_value)`
22+
- `memfault_metrics_heartbeat_set_string(MEMFAULT_METRICS_KEY(key_name), value)`
23+
- `memfault_metrics_heartbeat_timer_start(MEMFAULT_METRICS_KEY(key_name))`
24+
- `memfault_metrics_heartbeat_timer_stop(MEMFAULT_METRICS_KEY(key_name))`
25+
- `memfault_metrics_heartbeat_add(MEMFAULT_METRICS_KEY(key_name), amount)`
26+
27+
Saving some typing!
28+
29+
- Add the ability to compute FreeRTOS task stack high watermarks when storing
30+
coredumps. This is useful only if the entire RAM (`.data` + `.bss`) cannot
31+
be saved in the coredump. The feature is opt-in with the config flag
32+
`#define MEMFAULT_COREDUMP_COMPUTE_THREAD_STACK_USAGE 1`.
33+
34+
- Add a `heartbeat` command to the [core demo cli](components/demo). This
35+
behaves the same as the commands of the same name already present in the
36+
Zephyr + ESP-IDF port.
37+
38+
- Add a `test_cassert` command to the core demo cli. This command executes a C
39+
stdlib `<assert.h>``assert(0)` call. For platforms that do not implement a
40+
`assert()` handler, a config flag `MEMFAULT_DEMO_DISABLE_CASSERT` can be
41+
defined to `0` to disable the command.
42+
43+
- ESP-IDF:
44+
45+
- Add a new out-of-box metric, `wifi_ap_oui`, which will record the associated
46+
AP's Organizationally Unique Identifier (OUI) in the Memfault heartbeat.
47+
48+
### :chart_with_upwards_trend: Improvements
49+
50+
- General:
51+
52+
- Disable a warning emitted by the ARM C Compiler v5
53+
(`#188-D: enumerated type mixed with another type`) when initializing a
54+
structure in
55+
[`components/core/src/memfault_log.c`:314](https://github.com/memfault/memfault-firmware-sdk/blob/1.4.3/components/core/src/memfault_log.c#L313).
56+
57+
- Improve the quality of Assert backtraces when using the ARM C Compiler v5.
58+
Certain frames in the assert call stack were missing link register
59+
inforation, due to compiler optimizations based on the `noreturn` and
60+
unreachable compiler hints. These hints have been removed for `armcc`, which
61+
should permit full stack unwinding for Assert coredumps generated from
62+
builds on that toolchain.
63+
64+
- Perform an update of the timer when calling the
65+
`memfault_metrics_heartbeat_timer_read()` debug function. Fixes
66+
[#65](https://github.com/memfault/memfault-firmware-sdk/pull/65). Thanks to
67+
@LuskeyNoah for providing this fix!
68+
69+
- ESP-IDF:
70+
71+
- Fix a missing piece enabling the "zero-config" integration (originally added
72+
in `1.4.0`)- the `memfault_platform_port.h` file was still incorrectly
73+
required. This is now fixed.
74+
375
## [1.4.2] - 2023-11-02
476

577
### :chart_with_upwards_trend: Improvements
@@ -80,7 +152,7 @@
80152

81153
- Add a new Kconfig flag, `MEMFAULT_COREDUMP_STORAGE_MAX_SIZE`, which can be
82154
used to set the Memfault SDK's built-in
83-
[ESP-IDF coredump storage implementation](sdk/embedded/ports/esp_idf/memfault/common/memfault_platform_coredump.c)
155+
[ESP-IDF coredump storage implementation](https://github.com/memfault/memfault-firmware-sdk/blob/master/ports/esp_idf/memfault/common/memfault_platform_coredump.c)
84156
to artificially limit the maximum coredump storage size. This is useful for
85157
situations where the default `memfault_platform_coredump_get_regions()`
86158
function is still desirable, but the coredump maximum size needs to be

VERSION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
BUILD ID: 4292
2-
GIT COMMIT: 7f46de743
3-
VERSION: 1.4.2
1+
BUILD ID: 4437
2+
GIT COMMIT: 3453c1402
3+
VERSION: 1.4.3

components/core/src/memfault_log.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,10 +314,21 @@ void memfault_log_export_logs(void) {
314314
#pragma diag_push
315315
#pragma diag_remark 190
316316
#endif
317+
#if defined(__CC_ARM)
318+
#pragma push
319+
// This armcc diagnostic is technically violating the C standard, which
320+
// _explicitly_ requires enums to be type-equivalent to ints. See ISO/IEC
321+
// 9899:TC3 6.2.5.16, and specifically 6.4.4.3, which states: "An
322+
// identifier declared as an enumeration constant has type int."
323+
#pragma diag_suppress 188 // enumerated type mixed with another type
324+
#endif
317325
sMemfaultLog log = {0};
318326
#if defined(__TI_ARM__)
319327
#pragma diag_pop
320328
#endif
329+
#if defined(__CC_ARM)
330+
#pragma pop
331+
#endif
321332

322333
const bool log_found = memfault_log_read(&log);
323334
if (!log_found) {

components/demo/src/memfault_demo_shell_commands.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ int memfault_demo_cli_cmd_heartbeat_dump(MEMFAULT_UNUSED int argc, MEMFAULT_UNUS
4747
return 0;
4848
}
4949

50+
int memfault_demo_cli_cmd_heartbeat(MEMFAULT_UNUSED int argc, MEMFAULT_UNUSED char *argv[]) {
51+
memfault_metrics_heartbeat_debug_trigger();
52+
return 0;
53+
}
54+
5055
static const sMemfaultShellCommand s_memfault_shell_commands[] = {
5156
{"clear_core", memfault_demo_cli_cmd_clear_core, "Clear an existing coredump"},
5257
{"drain_chunks", memfault_demo_drain_chunk_data,
@@ -58,11 +63,13 @@ static const sMemfaultShellCommand s_memfault_shell_commands[] = {
5863
{"coredump_size", memfault_demo_cli_cmd_coredump_size, "Print the coredump storage capacity"},
5964
{"heartbeat_dump", memfault_demo_cli_cmd_heartbeat_dump,
6065
"Dump current Memfault metrics heartbeat state"},
66+
{"heartbeat", memfault_demo_cli_cmd_heartbeat, "Trigger a heartbeat"},
6167
//
6268
// Test commands for validating SDK functionality: https://mflt.io/mcu-test-commands
6369
//
6470

6571
{"test_assert", memfault_demo_cli_cmd_assert, "Trigger memfault assert"},
72+
{"test_cassert", memfault_demo_cli_cmd_cassert, "Trigger C assert"},
6673

6774
#if MEMFAULT_COMPILER_ARM_CORTEX_M
6875
{"test_busfault", memfault_demo_cli_cmd_busfault, "Trigger a busfault"},

components/demo/src/panics/memfault_demo_panics.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@
2222
#include "memfault/panics/platform/coredump.h"
2323
#include "memfault_demo_cli_aux_private.h"
2424

25+
// Allow opting out of the cassert demo. Some platforms may not have a libc
26+
// assert implementation.
27+
#if !defined(MEMFAULT_DEMO_DISABLE_CASSERT)
28+
#include <assert.h>
29+
#define MEMFAULT_DEMO_DISABLE_CASSERT 0
30+
#endif
31+
2532
MEMFAULT_NO_OPT
2633
static void do_some_work_base(char *argv[]) {
2734
// An assert that is guaranteed to fail. We perform
@@ -131,6 +138,18 @@ int memfault_demo_cli_cmd_assert(int argc, char *argv[]) {
131138
return -1;
132139
}
133140

141+
int memfault_demo_cli_cmd_cassert(int argc, char *argv[]) {
142+
(void)argc, (void)argv;
143+
144+
#if MEMFAULT_DEMO_DISABLE_CASSERT
145+
MEMFAULT_LOG_ERROR("C assert demo disabled");
146+
#else
147+
assert(0);
148+
#endif
149+
150+
return -1;
151+
}
152+
134153
#if MEMFAULT_COMPILER_ARM_CORTEX_M
135154

136155
int memfault_demo_cli_cmd_hardfault(MEMFAULT_UNUSED int argc, MEMFAULT_UNUSED char *argv[]) {

components/include/memfault/core/platform/core.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ int memfault_platform_boot(void);
3333
//! Invoked after memfault fault handling has run.
3434
//!
3535
//! The platform should do any final cleanup and reboot the system
36-
#if defined(__ICCARM__)
37-
//! IAR will optimize away link register stores from callsites which makes it
38-
//! impossible for a reliable backtrace to be resolved so we don't use the NORETURN attribute
36+
#if defined(__ICCARM__) || defined(__CC_ARM)
37+
//! IAR and armcc will optimize away link register stores from callsites, which
38+
//! makes it impossible for a reliable backtrace to be resolved, so for those
39+
//! compilers don't apply the NORETURN attribute
3940
#else
4041
MEMFAULT_NORETURN
4142
#endif

components/include/memfault/demo/cli.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ int memfault_demo_cli_cmd_prefetchabort(int argc, char *argv[]);
5757
//! Command which will generate an assert
5858
int memfault_demo_cli_cmd_assert(int argc, char *argv[]);
5959

60+
//! Command which will generate a libc assert()
61+
int memfault_demo_cli_cmd_cassert(int argc, char *argv[]);
62+
6063
//! Command to exercise the MEMFAULT_TRACE_EVENT API, capturing a
6164
//! Trace Event with the error reason set to "MemfaultDemoCli_Error".
6265
int memfault_demo_cli_cmd_trace_event_capture(int argc, char *argv[]);
@@ -114,6 +117,9 @@ int memfault_demo_cli_cmd_export(int argc, char *argv[]);
114117
//! Print current heartbeat metrics
115118
int memfault_demo_cli_cmd_heartbeat_dump(int argc, char *argv[]);
116119

120+
//! Trigger a heartbeat
121+
int memfault_demo_cli_cmd_heartbeat(int argc, char *argv[]);
122+
117123
#ifdef __cplusplus
118124
}
119125
#endif

components/include/memfault/metrics/metrics.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,20 @@ int memfault_metrics_heartbeat_timer_stop(MemfaultMetricId key);
171171
//! @note The metric must be of type kMemfaultMetricType_Unsigned or kMemfaultMetricType_Signed
172172
int memfault_metrics_heartbeat_add(MemfaultMetricId key, int32_t amount);
173173

174+
//! Alternate API that includes the 'MEMFAULT_METRICS_KEY()' expansion
175+
#define MEMFAULT_HEARTBEAT_SET_SIGNED(key_name, signed_value) \
176+
memfault_metrics_heartbeat_set_signed(MEMFAULT_METRICS_KEY(key_name), signed_value)
177+
#define MEMFAULT_HEARTBEAT_SET_UNSIGNED(key_name, unsigned_value) \
178+
memfault_metrics_heartbeat_set_unsigned(MEMFAULT_METRICS_KEY(key_name), unsigned_value)
179+
#define MEMFAULT_HEARTBEAT_SET_STRING(key_name, value) \
180+
memfault_metrics_heartbeat_set_string(MEMFAULT_METRICS_KEY(key_name), value)
181+
#define MEMFAULT_HEARTBEAT_TIMER_START(key_name) \
182+
memfault_metrics_heartbeat_timer_start(MEMFAULT_METRICS_KEY(key_name))
183+
#define MEMFAULT_HEARTBEAT_TIMER_STOP(key_name) \
184+
memfault_metrics_heartbeat_timer_stop(MEMFAULT_METRICS_KEY(key_name))
185+
#define MEMFAULT_HEARTBEAT_ADD(key_name, amount) \
186+
memfault_metrics_heartbeat_add(MEMFAULT_METRICS_KEY(key_name), amount)
187+
174188
//! For debugging purposes: prints the current heartbeat values using
175189
//! MEMFAULT_LOG_DEBUG(). Before printing, any active timer values are computed.
176190
//! Other metrics will print the current values. This can be called from the

components/include/memfault/version.h

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

22-
#define MEMFAULT_SDK_VERSION { .major = 1, .minor = 4, .patch = 2 }
23-
#define MEMFAULT_SDK_VERSION_STR "1.4.2"
22+
#define MEMFAULT_SDK_VERSION { .major = 1, .minor = 4, .patch = 3 }
23+
#define MEMFAULT_SDK_VERSION_STR "1.4.3"
2424

2525
#ifdef __cplusplus
2626
}

components/metrics/src/memfault_metrics.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,7 @@ int memfault_metrics_heartbeat_timer_read(MemfaultMetricId key, uint32_t *read_v
728728
memfault_lock();
729729
{
730730
union MemfaultMetricValue *value;
731+
prv_find_timer_metric_and_update(key, kMemfaultTimerOp_ForceValueUpdate);
731732
rv = prv_find_key_of_type(key, kMemfaultMetricType_Timer, &value);
732733
if (rv == 0) {
733734
*read_val = value->u32;

0 commit comments

Comments
 (0)