Skip to content

Commit 0e579c2

Browse files
author
Memfault Inc
committed
Memfault Firmware SDK 1.0.1 (Build 2436)
1 parent 30b8c0d commit 0e579c2

21 files changed

+395
-32
lines changed

CHANGES.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
### Changes between Memfault SDK 1.0.1 and 1.0.0 - June 9, 2023
2+
3+
#### :chart_with_upwards_trend: Improvements
4+
5+
- Zephyr:
6+
7+
- Improve the quality of Zephyr stack usage detection when capturing less than
8+
the full stack contents for each thread. This feature was originally
9+
released in SDK `0.43.0`.
10+
11+
- ESP-IDF:
12+
13+
- Add Memfault Metrics tracking LwIP runtime statistics (packet counts). A new
14+
Kconfig flag `CONFIG_MEMFAULT_LWIP_METRICS` controls this feature, which is
15+
enabled by default. The LwIP metrics helper is available for non-ESP-IDF
16+
projects using LwIP, see
17+
[`ports/lwip/memfault_lwip_metrics.c`](ports/lwip/memfault_lwip_metrics.c)
18+
for details
19+
120
### Changes between Memfault SDK 1.0.0 and 0.43.3 - June 1, 2023
221

322
🎉🎉🎉

VERSION

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

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 = 1, .minor = 0, .patch = 0 }
22+
#define MEMFAULT_SDK_VERSION { .major = 1, .minor = 0, .patch = 1 }
2323

2424
#ifdef __cplusplus
2525
}

examples/esp32/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ I (116450) connect: Connecting to '<SSID>'
228228
Then post the data:
229229

230230
```plaintext
231-
esp32> post_core
231+
esp32> post_chunks
232232
I (12419) mflt: Posting Memfault Data...
233233
I (12419) mflt: Result: 0
234234
```

examples/zephyr/qemu/qemu-app/CMakeLists.txt

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,17 @@ zephyr_include_directories(config)
1313
project(qemu-app LANGUAGES C VERSION 1.0.0)
1414

1515
# Generate a git hash that's used as part of the software_version, eg
16-
# 1.0.0+12345678
17-
EXECUTE_PROCESS(
18-
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
19-
COMMAND git rev-parse --short HEAD
20-
RESULT_VARIABLE commit_sha1
21-
OUTPUT_VARIABLE ZEPHYR_MEMFAULT_EXAMPLE_GIT_SHA1
22-
OUTPUT_STRIP_TRAILING_WHITESPACE
23-
COMMAND_ERROR_IS_FATAL ANY
24-
)
16+
# 1.0.0+12345678. Permit overriding at command line for CI builds.
17+
if (NOT DEFINED ZEPHYR_MEMFAULT_EXAMPLE_GIT_SHA1)
18+
EXECUTE_PROCESS(
19+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
20+
COMMAND git rev-parse --short HEAD
21+
RESULT_VARIABLE commit_sha1
22+
OUTPUT_VARIABLE ZEPHYR_MEMFAULT_EXAMPLE_GIT_SHA1
23+
OUTPUT_STRIP_TRAILING_WHITESPACE
24+
COMMAND_ERROR_IS_FATAL ANY
25+
)
26+
endif()
2527

2628
zephyr_compile_definitions(
2729
ZEPHYR_MEMFAULT_EXAMPLE_GIT_SHA1=\"${ZEPHYR_MEMFAULT_EXAMPLE_GIT_SHA1}\"

examples/zephyr/qemu/qemu-app/prj.conf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ CONFIG_SHELL=y
1212
CONFIG_QEMU_ICOUNT=n
1313

1414
CONFIG_LOG=y
15-
# LOG v2 option, only for pre zephyr-v3.1.0
16-
# CONFIG_LOG2_MODE_DEFERRED=y
15+
# Using immediate mode to avoid dropping bursts of log messages, eg when running
16+
# `mflt export` to dump base64-chunks to the console
17+
CONFIG_LOG_MODE_IMMEDIATE=y
1718
CONFIG_LOG_BACKEND_UART=y
1819
# Disable shell log output to prevent duplicate logs, since UART backend is
1920
# already enabled. Shell log backend enables later than UART backend, and won't

examples/zephyr/qemu/qemu-app/west.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ manifest:
1414
- name: zephyr
1515
remote: zephyrproject-rtos
1616
revision: v3.3.0
17-
import: true
17+
import:
18+
# Limit the Zephyr modules to the required set
19+
name-allowlist:
20+
- cmsis
1821

1922
- name: memfault-firmware-sdk
2023
path: modules/lib/memfault-firmware-sdk

ports/esp_idf/memfault/CMakeLists.txt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,16 @@ list(APPEND MEMFAULT_COMPONENTS_SRCS
8282
list(APPEND MEMFAULT_COMPONENTS_INC_FOLDERS
8383
include
8484
include/${MEMFAULT_ESP_IDF_PORT}
85+
${MEMFAULT_SDK_ROOT}/ports/include
8586
$ENV{MEMFAULT_PLATFORM_EXTRA_INCLUDES}
87+
config
8688
)
8789

90+
if (CONFIG_MEMFAULT_LWIP_METRICS)
91+
list(APPEND MEMFAULT_COMPONENTS_SRCS ${MEMFAULT_SDK_ROOT}/ports/lwip/memfault_lwip_metrics.c)
92+
list(APPEND MEMFAULT_COMPONENTS_INC_FOLDERS ${MEMFAULT_SDK_ROOT}/ports/lwip/config)
93+
endif()
94+
8895
# For version >= 4.4.3, we can collect smaller coredumps by default
8996
# by prioritizing active stack and FreeRTOS regions first. ESP-IDF < 4.4.3
9097
# uses a simpler scheme collecting all of DRAM. See
@@ -97,10 +104,6 @@ if (DEFINED ENV{IDF_VERSION})
97104
${MEMFAULT_SDK_ROOT}/ports/freertos/src/memfault_freertos_ram_regions.c
98105
)
99106

100-
list(APPEND MEMFAULT_COMPONENTS_INC_FOLDERS
101-
${MEMFAULT_SDK_ROOT}/ports/include/
102-
)
103-
104107
# Add a linker fragment to place FreeRTOS timers and task objects in the same area of dram0.bss
105108
set(COMPONENT_ADD_LDFRAGMENTS "${MEMFAULT_ESP_IDF_PORT_COMMON}/memfault_esp_freertos.lf")
106109
endif()
@@ -122,6 +125,10 @@ list(APPEND COMPONENT_REQUIRES
122125
driver
123126
)
124127

128+
if(CONFIG_MEMFAULT_LWIP_METRICS)
129+
list(APPEND COMPONENT_REQUIRES lwip)
130+
endif()
131+
125132
if($ENV{MEMFAULT_ESP_HTTP_CLIENT_ENABLE})
126133
list(APPEND COMPONENT_REQUIRES esp_http_client esp_https_ota)
127134
endif()
@@ -133,6 +140,7 @@ get_filename_component(this_directory_name ${this_directory_name} NAME)
133140
mflt_esp32_component_get_target(this_component ${this_directory_name})
134141

135142
component_compile_options(-DMEMFAULT_ESP_HTTP_CLIENT_ENABLE=$ENV{MEMFAULT_ESP_HTTP_CLIENT_ENABLE})
143+
component_compile_options(-DMEMFAULT_METRICS_USER_HEARTBEAT_DEFS_FILE="memfault_esp_metrics_heartbeat_config.def")
136144

137145
# We will intercept the panic handlers enabled by CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH
138146
# and run the Memfault Fault Handler instead.

ports/esp_idf/memfault/Kconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,9 @@ menu "Memfault"
4747
The Memfault HTTP client timeout in milliseconds. This is the
4848
maximum amount of time the HTTP client will wait for a response from
4949
the server.
50+
51+
config MEMFAULT_LWIP_METRICS
52+
bool "Collect TCP/UDP metrics from LwIP"
53+
default y
54+
select LWIP_STATS
5055
endmenu

ports/esp_idf/memfault/common/memfault_platform_metrics.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,16 @@
99
//! by using the following CFLAG:
1010
//! -DMEMFAULT_METRICS_HEARTBEAT_INTERVAL_SECS=15
1111

12+
#include "esp_timer.h"
1213
#include "memfault/core/debug_log.h"
1314
#include "memfault/core/reboot_tracking.h"
1415
#include "memfault/esp_port/metrics.h"
1516
#include "memfault/metrics/metrics.h"
1617
#include "memfault/metrics/platform/timer.h"
1718

18-
#include "esp_timer.h"
19+
#if CONFIG_MEMFAULT_LWIP_METRICS
20+
#include "memfault/ports/lwip/metrics.h"
21+
#endif // CONFIG_MEMFAULT_LWIP_METRICS
1922

2023
MEMFAULT_WEAK
2124
void memfault_esp_metric_timer_dispatch(MemfaultPlatformTimerCallback handler) {
@@ -56,3 +59,9 @@ bool memfault_platform_metrics_timer_boot(uint32_t period_sec,
5659

5760
return true;
5861
}
62+
63+
void memfault_metrics_heartbeat_collect_sdk_data(void) {
64+
#if CONFIG_MEMFAULT_LWIP_METRICS
65+
memfault_lwip_heartbeat_collect_data();
66+
#endif // CONFIG_MEMFAULT_LWIP_METRICS
67+
}

0 commit comments

Comments
 (0)