Skip to content

Commit 9679e65

Browse files
author
Memfault Inc
committed
Memfault Firmware SDK 1.4.4 (Build 4488)
1 parent 2e3d5e5 commit 9679e65

Some content is hidden

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

43 files changed

+324
-224
lines changed

CHANGES.md renamed to CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
# Memfault Firmware SDK Changelog
22

3+
## [1.4.4] - 2023-11-13
4+
5+
### :chart_with_upwards_trend: Improvements
6+
7+
- General:
8+
9+
- Rename this file from [`CHANGES.md`] to [`CHANGELOG.md`].
10+
11+
- For FreeRTOS, add a warning when `configRECORD_STACK_HIGH_ADDRESS` is not
12+
enabled. Memfault uses this to show stack sizes in the coredump view for
13+
coredumps on FreeRTOS systems. The warning can be disabled by enabling the
14+
`configRECORD_STACK_HIGH_ADDRESS` FreeRTOS config flag, or by setting
15+
`#define MEMFAULT_FREERTOS_WARN_STACK_HIGH_ADDRESS_UNAVAILABLE 0`.
16+
17+
- Make `memfault_packetizer_get_chunk()` return `false` if the buffer was too
18+
small to load a full chunk. Previously the function would return `true` but
19+
with `0` bytes loaded into the output buffer and `*buf_len` set to `0`.
20+
21+
- Update all example Metrics implementations to use the new API from v1.4.3
22+
(eg `MEMFAULT_HEARTBEAT_SET_UNSIGNED` instead of
23+
`memfault_metrics_heartbeat_set_unsigned`).
24+
25+
- Fix compilation for systems not integrating the
26+
[Metrics](https://mflt.io/embedded-metrics) component but using the Demo CLI
27+
(this regressed in v1.4.3).
28+
329
## [1.4.3] - 2023-11-08
430

531
### :rocket: New Features

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ This makes it easy to track the history of the Memfault SDK. You should not need
8787
to make modifications to the Memfault SDK. The typical update flow is:
8888

8989
- `git pull` the latest upstream
90-
- check [CHANGES.md](CHANGES.md) to see if any modifications are needed
90+
- check [CHANGELOG.md](CHANGELOG.md) to see if any modifications are needed
9191
- update to the new submodule commit in your repo.
9292

9393
Alternatively, the Memfault SDK may be added to a project as a git subtree or by

VERSION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
BUILD ID: 4437
2-
GIT COMMIT: 3453c1402
3-
VERSION: 1.4.3
1+
BUILD ID: 4488
2+
GIT COMMIT: 7744b8176
3+
VERSION: 1.4.4

components/core/src/memfault_data_packetizer.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ eMemfaultPacketizerStatus memfault_packetizer_get_next(void *buf, size_t *buf_le
293293
if (*buf_len == 0) {
294294
MEMFAULT_LOG_ERROR("Buffer of %d bytes too small to packetize data",
295295
(int)original_size);
296+
return kMemfaultPacketizerStatus_NoMoreData;
296297
}
297298

298299
if (!md) {

components/demo/src/memfault_demo_shell_commands.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,17 @@ int memfault_demo_cli_cmd_export(MEMFAULT_UNUSED int argc, MEMFAULT_UNUSED char
4242
return 0;
4343
}
4444

45+
// Provide weak implementations in the case where the metrics component is not enabled
46+
MEMFAULT_WEAK
47+
void memfault_metrics_heartbeat_debug_print(void) {
48+
MEMFAULT_LOG_RAW("Disabled. metrics component integration required");
49+
}
50+
51+
MEMFAULT_WEAK
52+
void memfault_metrics_heartbeat_debug_trigger(void) {
53+
MEMFAULT_LOG_RAW("Disabled. metrics component integration required");
54+
}
55+
4556
int memfault_demo_cli_cmd_heartbeat_dump(MEMFAULT_UNUSED int argc, MEMFAULT_UNUSED char *argv[]) {
4657
memfault_metrics_heartbeat_debug_print();
4758
return 0;

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 = 3 }
23-
#define MEMFAULT_SDK_VERSION_STR "1.4.3"
22+
#define MEMFAULT_SDK_VERSION { .major = 1, .minor = 4, .patch = 4 }
23+
#define MEMFAULT_SDK_VERSION_STR "1.4.4"
2424

2525
#ifdef __cplusplus
2626
}

components/metrics/src/memfault_metrics.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -586,8 +586,7 @@ static void prv_reset_metrics(void) {
586586
// This must be explicitly set because we use 0 to track number of operational hours
587587
// Without setting to 0, this defaults to null and will not be counted in the sum
588588
// of total operational hours
589-
memfault_metrics_heartbeat_set_unsigned(
590-
MEMFAULT_METRICS_KEY(MemfaultSdkMetric_UnexpectedRebootDidOccur), 0);
589+
MEMFAULT_HEARTBEAT_SET_UNSIGNED(MemfaultSdkMetric_UnexpectedRebootDidOccur, 0);
591590
}
592591

593592
static void prv_heartbeat_timer_update(void) {
@@ -869,8 +868,8 @@ static int prv_init_unexpected_reboot_metric(void) {
869868
return -1;
870869
}
871870

872-
return memfault_metrics_heartbeat_set_unsigned(
873-
MEMFAULT_METRICS_KEY(MemfaultSdkMetric_UnexpectedRebootDidOccur), unexpected_reboot ? 1 : 0);
871+
return MEMFAULT_HEARTBEAT_SET_UNSIGNED(MemfaultSdkMetric_UnexpectedRebootDidOccur,
872+
unexpected_reboot ? 1 : 0);
874873
}
875874

876875
int memfault_metrics_boot(const sMemfaultEventStorageImpl *storage_impl,
@@ -893,14 +892,13 @@ int memfault_metrics_boot(const sMemfaultEventStorageImpl *storage_impl,
893892
return MEMFAULT_METRICS_STORAGE_TOO_SMALL;
894893
}
895894

896-
int rv = memfault_metrics_heartbeat_timer_start(
897-
MEMFAULT_METRICS_KEY(MemfaultSdkMetric_IntervalMs));
895+
int rv = MEMFAULT_HEARTBEAT_TIMER_START(MemfaultSdkMetric_IntervalMs);
898896
if (rv != 0) {
899897
return rv;
900898
}
901899

902-
rv = memfault_metrics_heartbeat_set_unsigned(
903-
MEMFAULT_METRICS_KEY(MemfaultSdkMetric_UnexpectedRebootCount), info->unexpected_reboot_count);
900+
rv = MEMFAULT_HEARTBEAT_SET_UNSIGNED(MemfaultSdkMetric_UnexpectedRebootCount,
901+
info->unexpected_reboot_count);
904902
if (rv != 0) {
905903
return rv;
906904
}

examples/esp32/apps/memfault_demo_app/main/app_memfault_transport_mqtt.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static void prv_close_client(void) {
5959
if (rv) {
6060
ESP_LOGW(TAG, "Failed to destroy client[%d]", rv);
6161
}
62-
memfault_metrics_heartbeat_timer_stop(MEMFAULT_METRICS_KEY(mqtt_conn_uptime));
62+
MEMFAULT_HEARTBEAT_TIMER_STOP(mqtt_conn_uptime);
6363

6464
s_mqtt_client = NULL;
6565
}
@@ -91,14 +91,14 @@ static int prv_create_client(void) {
9191
rv = xSemaphoreTake(s_mqtt_connected, (1000 * 10) / portTICK_PERIOD_MS);
9292
if (rv != pdTRUE) {
9393
ESP_LOGE(TAG, "MQTT client failed to connect[%d]", rv);
94-
memfault_metrics_heartbeat_timer_start(MEMFAULT_METRICS_KEY(mqtt_conn_downtime));
94+
MEMFAULT_HEARTBEAT_TIMER_START(mqtt_conn_downtime);
9595
prv_close_client();
9696
return -1;
9797
}
9898

9999
// Update connection metrics when connected
100-
memfault_metrics_heartbeat_timer_stop(MEMFAULT_METRICS_KEY(mqtt_conn_downtime));
101-
memfault_metrics_heartbeat_timer_start(MEMFAULT_METRICS_KEY(mqtt_conn_uptime));
100+
MEMFAULT_HEARTBEAT_TIMER_STOP(mqtt_conn_downtime);
101+
MEMFAULT_HEARTBEAT_TIMER_START(mqtt_conn_uptime);
102102

103103
// Set topic alias before publishing
104104
rv = esp_mqtt5_client_set_publish_property(s_mqtt_client, &s_publish_property);
@@ -161,8 +161,8 @@ int app_memfault_transport_send_chunks(void) {
161161
break;
162162
}
163163

164-
memfault_metrics_heartbeat_add(MEMFAULT_METRICS_KEY(mqtt_publish_bytes), chunk_size);
165-
memfault_metrics_heartbeat_add(MEMFAULT_METRICS_KEY(mqtt_publish_count), 1);
164+
MEMFAULT_HEARTBEAT_ADD(mqtt_publish_bytes, chunk_size);
165+
MEMFAULT_HEARTBEAT_ADD(mqtt_publish_count, 1);
166166
ESP_LOGD(TAG, "chunk[%d], len[%zu] published to %s", rv, chunk_size, s_topic_string);
167167
}
168168

examples/esp32/apps/memfault_demo_app/main/console_example_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ static void prv_poster_task(void *args) {
232232

233233
while (true) {
234234
// count the number of times this task has run
235-
memfault_metrics_heartbeat_add(MEMFAULT_METRICS_KEY(PosterTaskNumSchedules), 1);
235+
MEMFAULT_HEARTBEAT_ADD(PosterTaskNumSchedules, 1);
236236
// attempt to autojoin wifi, if configured
237237
memfault_esp_port_wifi_autojoin();
238238

examples/freertos/Makefile

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,24 @@ FREERTOS_SRCS = \
6161

6262
# Add application sources
6363
SRCS += \
64-
main.c \
65-
compact_log.cpp \
64+
src/main.c \
65+
src/compact_log.cpp \
66+
src/console.c \
67+
src/heap_task.c \
68+
src/metrics.c \
69+
src/memfault/memfault_platform_port.c \
6670
$(BOARD_DIR)/startup.c \
67-
console.c \
6871
$(BOARD_DIR)/memfault_platform_impl.c \
69-
memfault/memfault_platform_port.c \
7072
$(FREERTOS_SRCS) \
7173

7274
# Use Memfault SDK worker to gather initial Memfault SDK sources and include dirs
7375
MEMFAULT_SDK_ROOT := ../..
74-
MEMFAULT_COMPONENTS := core util panics metrics demo
76+
MEMFAULT_COMPONENTS ?= core util panics metrics demo
7577
include $(MEMFAULT_SDK_ROOT)/makefiles/MemfaultWorker.mk
7678

79+
# Add CFLAGS defines for each of the memfault components enabled above
80+
CFLAGS += $(foreach each, $(MEMFAULT_COMPONENTS), -DMEMFAULT_COMPONENT_$(each)_)
81+
7782
# Add additional SDK sources to project for FreeRTOS and RAM-backed coredump.
7883
# Intentionally using a wildcard to trap any new features added- it's nice to
7984
# have them enabled in this example app.
@@ -88,7 +93,8 @@ OBJS := $(subst $(MEMFAULT_SDK_ROOT),memfault-firmware-sdk,$(SRCS:%=$(BUILD_DIR)
8893
INCLUDE_PATHS += \
8994
-I$(FREERTOS_DIR)/include \
9095
-I. \
91-
-I./memfault \
96+
-Isrc \
97+
-Isrc/memfault \
9298
-I$(MEMFAULT_COMPONENTS_INC_FOLDERS) \
9399
-I$(MEMFAULT_SDK_ROOT)/ports/include \
94100
-I$(MEMFAULT_SDK_ROOT) \

0 commit comments

Comments
 (0)