Skip to content

Commit 5cce7ee

Browse files
author
Memfault Inc
committed
Memfault Firmware SDK 1.9.4 (Build 8676)
1 parent a41aef8 commit 5cce7ee

Some content is hidden

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

41 files changed

+1468
-135
lines changed

CHANGELOG.md

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,50 @@ 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.9.4] - 2024-07-01
10+
11+
### :chart_with_upwards_trend: Improvements
12+
13+
- Zephyr:
14+
15+
- Updated the Memfault fault handler to support deprecated exception info
16+
structure coming in Zephyr v3.7.0. This change is backward compatible with
17+
older Zephyr versions.
18+
19+
- By default, include the `zephyr.meta` build metadata in the output ELF file
20+
as an unallocated section. This provides a list of module SHAs, useful when
21+
reconstructing the dependencies used to build a particular ELF file. This
22+
feature is controlled with `CONFIG_MEMFAULT_BUILD_META_IN_ELF`.
23+
24+
- Add a new Kconfig option, `CONFIG_MEMFAULT_USE_MEMFAULT_BUILD_ID`, which
25+
will apply a [Memfault Build ID](https://mflt.io/symbol-file-build-ids)
26+
instead of a GNU Build ID when enabled. It defaults to enabled when
27+
`CONFIG_BOOTLOADER_ESP_IDF` is enabled- this applies to ESP32 boards that
28+
are using the ESP-IDF bootloader, instead of an MCUBoot bootloader. MCUBoot
29+
bootable images are compatible with the standard GNU Build IDs.
30+
31+
- Add a new API, `memfault_zephyr_fota_download_callback()`, to the Zephyr
32+
FOTA implementation to allow users to write their own callback that is
33+
invoked when the download of a OTA payload is complete. The default download
34+
callback will mark the new image as pending, set a firmware update reboot
35+
reason, and reboot the system. Custom callbacks may, for example, be used to
36+
perform application-specific system shutdown procedures, or allow the FOTA
37+
update call to return to the calling context so a testing framework could
38+
mark the operation successful. Users can override the default callback with
39+
their own implementation using a new Kconfig option
40+
`CONFIG_MEMFAULT_ZEPHYR_FOTA_DOWNLOAD_CALLBACK_CUSTOM`.
41+
42+
- ESP-IDF:
43+
44+
- Add a periodic HTTP upload task. This feature starts a task dedicated to
45+
posting any available Memfault data via HTTPS. Enable with
46+
`CONFIG_MEMFAULT_HTTP_PERIODIC_UPLOAD=y`.
47+
48+
- General:
49+
50+
- Add 2 new QEMU targets for the FreeRTOS QEMU example, for Cortex-M4F and
51+
Cortex-M33. The targets can be found [here](examples/freertos/boards/)
52+
953
## [1.9.3] - 2024-06-10
1054

1155
### :chart_with_upwards_trend: Improvements
@@ -40,8 +84,8 @@ and this project adheres to
4084
convention for exception handlers. A backwards-compatible implementation is
4185
included to avoid breaking users relying on the previous default.
4286

43-
- Add [`libcurl`-based samples](examples/libcurl) for posting chunks to Memfault and
44-
checking for latest OTA release.
87+
- Add [`libcurl`-based samples](examples/libcurl) for posting chunks to
88+
Memfault and checking for latest OTA release.
4589

4690
## [1.9.2] - 2024-05-29
4791

VERSION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
BUILD ID: 8266
2-
GIT COMMIT: 10085ffa3f
3-
VERSION: 1.9.3
1+
BUILD ID: 8676
2+
GIT COMMIT: 69ac2e1558
3+
VERSION: 1.9.4

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

2525
#ifdef __cplusplus
2626
}

examples/esp32/apps/memfault_demo_app/main/Kconfig.projbuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ choice APP_MEMFAULT_TRANSPORT
3333
config APP_MEMFAULT_TRANSPORT_MQTT
3434
bool "MQTT"
3535
select MQTT_PROTOCOL_5
36+
depends on !MEMFAULT_HTTP_PERIODIC_UPLOAD
3637
endchoice
3738

3839
if APP_MEMFAULT_TRANSPORT_MQTT

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

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ static void initialize_console() {
127127
.max_cmdline_args = 8,
128128
.max_cmdline_length = 256,
129129
#if CONFIG_LOG_COLORS
130-
.hint_color = atoi(LOG_COLOR_CYAN)
130+
.hint_color = atoi(LOG_COLOR_CYAN),
131131
#endif
132132
};
133133
ESP_ERROR_CHECK(esp_console_init(&console_config));
@@ -253,44 +253,30 @@ void memfault_esp_port_wifi_autojoin(void) {
253253

254254
#endif // CONFIG_MEMFAULT_APP_WIFI_AUTOJOIN
255255

256-
// Periodically post any Memfault data that has not yet been posted.
257-
static void prv_poster_task(void *args) {
258-
const uint32_t interval_sec = 60;
259-
const TickType_t delay_ms = (1000 * interval_sec) / portTICK_PERIOD_MS;
256+
// // Periodically post any Memfault data that has not yet been posted.
257+
static void prv_ota_task(void *args) {
260258
const TickType_t ota_check_interval = pdMS_TO_TICKS(60 * 60 * 1000);
261-
// initial OTA check is immediately on boot
262-
TickType_t ota_last_check_time = xTaskGetTickCount() - ota_check_interval;
263259

264-
app_memfault_transport_init();
265-
266-
MEMFAULT_LOG_INFO("Data poster task up and running every %" PRIu32 "s.", interval_sec);
260+
MEMFAULT_LOG_INFO("OTA task up and running every %" PRIu32 "s.", ota_check_interval);
267261

268262
while (true) {
269263
// count the number of times this task has run
270264
MEMFAULT_METRIC_ADD(PosterTaskNumSchedules, 1);
271265
// attempt to autojoin wifi, if configured
266+
#if defined(CONFIG_MEMFAULT_APP_WIFI_AUTOJOIN)
272267
memfault_esp_port_wifi_autojoin();
268+
#endif
273269

274-
// if connected, post any memfault data
270+
// Wait until connected to check for OTA
275271
if (memfault_esp_port_wifi_connected()) {
276-
MEMFAULT_LOG_DEBUG("Checking for memfault data to send");
277-
int err = app_memfault_transport_send_chunks();
278-
// if the check-in succeeded, set green, otherwise clear.
279-
// gives a quick eyeball check that the app is alive and well
280-
led_set_color((err == 0) ? kLedColor_Green : kLedColor_Red);
281-
282-
// Check for OTA hourly
283-
if ((xTaskGetTickCount() - ota_last_check_time) >= ota_check_interval) {
284-
prv_memfault_ota();
285-
ota_last_check_time = xTaskGetTickCount();
286-
}
272+
prv_memfault_ota();
287273
} else {
288274
// Set LED to red
289275
led_set_color(kLedColor_Red);
290276
}
291277

292278
// sleep
293-
vTaskDelay(delay_ms);
279+
vTaskDelay(ota_check_interval);
294280
}
295281
}
296282

@@ -447,10 +433,10 @@ void app_main() {
447433
#if defined(CONFIG_MEMFAULT)
448434
prv_initialize_task_watchdog();
449435

450-
// We need another task to post data since we block waiting for user
436+
// We need another task to check for OTA since we block waiting for user
451437
// input in this task.
452438
const portBASE_TYPE res =
453-
xTaskCreate(prv_poster_task, "poster", ESP_TASK_MAIN_STACK, NULL, ESP_TASK_MAIN_PRIO, NULL);
439+
xTaskCreate(prv_ota_task, "ota", ESP_TASK_MAIN_STACK, NULL, ESP_TASK_MAIN_PRIO, NULL);
454440
assert(res == pdTRUE);
455441

456442
// Register the app commands
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
CONFIG_APP_MEMFAULT_TRANSPORT_MQTT=y
2+
CONFIG_MEMFAULT_HTTP_PERIODIC_UPLOAD=n
23
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_example_mqtt.csv"

examples/freertos/Makefile

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@ MAKEFLAGS=--warn-undefined-variables
44
# Default to a silent build. Run make with --trace for a verbose build.
55
.SILENT:
66

7-
87
# Mac and Linux stat have different options required, set them up here
98
ifeq ($(shell uname), Darwin)
10-
STAT = "stat -f '%z'"
9+
STAT = "stat -f '%z'"
1110
else
12-
STAT = "stat -c '%s'"
11+
STAT = "stat -c '%s'"
1312
endif
1413

1514
BOARD ?= qemu_mps2_an385
15+
16+
$(info Building for $(BOARD))
17+
1618
BOARD_DIR := boards/$(BOARD)
1719

1820
BUILD_DIR := build/$(BOARD)
@@ -53,25 +55,24 @@ endif
5355
include $(BOARD_DIR)/Makefile
5456

5557
# Gather list of FreeRTOS sources
56-
FREERTOS_SRCS = \
57-
$(FREERTOS_DIR)/tasks.c \
58-
$(FREERTOS_DIR)/queue.c \
59-
$(FREERTOS_DIR)/list.c \
60-
$(FREERTOS_DIR)/timers.c \
61-
$(FREERTOS_DIR)/portable/GCC/$(FREERTOS_PORT)/port.c \
62-
$(FREERTOS_DIR)/portable/MemMang/heap_4.c \
58+
FREERTOS_SRCS += \
59+
$(FREERTOS_DIR)/tasks.c \
60+
$(FREERTOS_DIR)/queue.c \
61+
$(FREERTOS_DIR)/list.c \
62+
$(FREERTOS_DIR)/timers.c \
63+
$(FREERTOS_DIR)/portable/MemMang/heap_4.c \
6364

6465
# Add application sources
6566
SRCS += \
66-
src/main.c \
67-
src/compact_log.cpp \
68-
src/console.c \
69-
src/heap_task.c \
70-
src/metrics.c \
71-
src/memfault/memfault_platform_port.c \
72-
$(BOARD_DIR)/startup.c \
73-
$(BOARD_DIR)/memfault_platform_impl.c \
74-
$(FREERTOS_SRCS) \
67+
src/main.c \
68+
src/compact_log.cpp \
69+
src/console.c \
70+
src/heap_task.c \
71+
src/metrics.c \
72+
src/memfault/memfault_platform_port.c \
73+
$(BOARD_DIR)/startup.c \
74+
$(BOARD_DIR)/memfault_platform_impl.c \
75+
$(FREERTOS_SRCS) \
7576

7677
# Use Memfault SDK worker to gather initial Memfault SDK sources and include dirs
7778
MEMFAULT_SDK_ROOT := ../..
@@ -85,34 +86,33 @@ CFLAGS += $(foreach each, $(MEMFAULT_COMPONENTS), -DMEMFAULT_COMPONENT_$(each)_)
8586
# Intentionally using a wildcard to trap any new features added- it's nice to
8687
# have them enabled in this example app.
8788
SRCS += \
88-
$(MEMFAULT_COMPONENTS_SRCS) \
89-
$(wildcard $(MEMFAULT_SDK_ROOT)/ports/freertos/src/*.c) \
90-
$(MEMFAULT_SDK_ROOT)/ports/panics/src/memfault_platform_ram_backed_coredump.c \
89+
$(MEMFAULT_COMPONENTS_SRCS) \
90+
$(wildcard $(MEMFAULT_SDK_ROOT)/ports/freertos/src/*.c) \
91+
$(MEMFAULT_SDK_ROOT)/ports/panics/src/memfault_platform_ram_backed_coredump.c \
9192

9293
# Fixup build path for objects of the Memfault SDK, all build output kept within build/
9394
OBJS := $(subst $(MEMFAULT_SDK_ROOT),memfault-firmware-sdk,$(SRCS:%=$(BUILD_DIR)/%.o))
9495

9596
INCLUDE_PATHS += \
96-
-I$(FREERTOS_DIR)/include \
97-
-I. \
98-
-Isrc \
99-
-Isrc/memfault \
100-
-I$(MEMFAULT_COMPONENTS_INC_FOLDERS) \
101-
-I$(MEMFAULT_SDK_ROOT)/ports/include \
102-
-I$(MEMFAULT_SDK_ROOT) \
103-
-I$(FREERTOS_DIR)/portable/GCC/$(FREERTOS_PORT) \
97+
-I$(FREERTOS_DIR)/include \
98+
-I. \
99+
-Isrc \
100+
-Isrc/memfault \
101+
-I$(MEMFAULT_COMPONENTS_INC_FOLDERS) \
102+
-I$(MEMFAULT_SDK_ROOT)/ports/include \
103+
-I$(MEMFAULT_SDK_ROOT) \
104+
-I$(FREERTOS_DIR)/portable/GCC/$(FREERTOS_PORT) \
104105

105106
# generic (non-arch-specific) CFLAGS
106107
CFLAGS += \
107-
-nostartfiles \
108-
-mthumb \
109-
-mcpu=cortex-m3 \
110-
-Werror \
111-
-Wall \
112-
-Wextra \
113-
-ggdb3 \
114-
-Og \
115-
-MD \
108+
-nostartfiles \
109+
-Werror \
110+
-Wall \
111+
-Wextra \
112+
-ggdb3 \
113+
-Og \
114+
-MD \
115+
$(ARCH_CFLAGS) \
116116

117117
# Enable the self test by default
118118
MEMFAULT_DEMO_CLI_SELF_TEST ?= 1
@@ -121,14 +121,14 @@ CFLAGS += -DMEMFAULT_DEMO_CLI_SELF_TEST=$(MEMFAULT_DEMO_CLI_SELF_TEST)
121121
LINKER_SCRIPT = $(BOARD_DIR)/linker.ld
122122

123123
LDFLAGS += \
124-
-Wl,-T$(LINKER_SCRIPT) \
125-
-Wl,--gc-sections \
126-
--specs=nano.specs \
127-
--specs=rdimon.specs \
128-
-Wl,-lc \
129-
-Wl,-lrdimon \
130-
-Wl,-Map=$(BUILD_DIR)/main.map \
131-
-Wl,--build-id \
124+
-Wl,-T$(LINKER_SCRIPT) \
125+
-Wl,--gc-sections \
126+
--specs=nano.specs \
127+
--specs=rdimon.specs \
128+
-Wl,-lc \
129+
-Wl,-lrdimon \
130+
-Wl,-Map=$(BUILD_DIR)/main.map \
131+
-Wl,--build-id \
132132

133133
.PHONY: all
134134
all: $(ELF)
@@ -142,11 +142,11 @@ $(SRCS): $(FREERTOS_DIR)/.clonedone
142142
# If CFLAGS differ from last build, rebuild all files
143143
RAW_CFLAGS := $(CFLAGS) $(LDFLAGS)
144144
CFLAGS_STALE = \
145-
$(shell \
146-
if ! (echo "$(RAW_CFLAGS)" | diff -q $(BUILD_DIR)/cflags - > /dev/null 2>&1); then \
147-
echo CFLAGS_STALE; \
148-
fi \
149-
)
145+
$(shell \
146+
if ! (echo "$(RAW_CFLAGS)" | diff -q $(BUILD_DIR)/cflags - > /dev/null 2>&1); then \
147+
echo CFLAGS_STALE; \
148+
fi \
149+
)
150150
.PHONY: CFLAGS_STALE
151151
$(BUILD_DIR)/cflags: $(CFLAGS_STALE) Makefile
152152
mkdir -p $(dir $@)

examples/freertos/boards/qemu_mps2_an385/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
FREERTOS_PORT = ARM_CM3
44
MEMFAULT_ARCH = arm
55

6+
ARCH_CFLAGS += \
7+
-mthumb \
8+
-mcpu=cortex-m3 \
9+
10+
FREERTOS_SRCS += \
11+
$(FREERTOS_DIR)/portable/GCC/$(FREERTOS_PORT)/port.c \
12+
613
ATTACH_DEBUGGER = -s -S
714
RUN_COMMAND = qemu-system-arm -machine mps2-an385 -monitor null -semihosting \
815
--semihosting-config enable=on,target=native \
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Board-specific build/debug properties
2+
3+
FREERTOS_PORT = ARM_CM4F
4+
MEMFAULT_ARCH = arm
5+
6+
ARCH_CFLAGS += \
7+
-mthumb \
8+
-mcpu=cortex-m4 \
9+
-mfloat-abi=hard \
10+
-mfpu=fpv4-sp-d16 \
11+
-DconfigENABLE_FPU=1 \
12+
13+
FREERTOS_SRCS += \
14+
$(FREERTOS_DIR)/portable/GCC/$(FREERTOS_PORT)/port.c \
15+
16+
ATTACH_DEBUGGER = -s -S
17+
RUN_COMMAND = qemu-system-arm -machine mps2-an386 -monitor null -semihosting \
18+
--semihosting-config enable=on,target=native \
19+
-kernel $(ELF) \
20+
-serial stdio -nographic \
21+
22+
DEBUG_COMMAND = $(RUN_COMMAND) $(ATTACH_DEBUGGER)
23+
24+
# Permit overriding the gdb executable
25+
GDB ?= gdb
26+
GDB_COMMAND = \
27+
$(GDB) --ex 'target extended-remote :1234' $(ELF)

0 commit comments

Comments
 (0)