Skip to content

Commit 315d643

Browse files
author
Memfault Inc
committed
Memfault Firmware SDK 0.34.0 (Build 320)
1 parent 34fe806 commit 315d643

40 files changed

+550
-1457
lines changed

.cyignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ ports/dialog
66
ports/emlib
77
ports/esp8266_sdk
88
ports/esp_idf
9+
ports/mbedtls
910
ports/mynewt
1011
ports/nrf5_sdk
1112
ports/nxp

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
build
2+
/examples/mbedtls
3+
/examples/modus
24
__pycache__/

CHANGES.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1+
### Changes between Memfault SDK 0.34.0 and SDK 0.33.5 - Nov 1, 2022
2+
3+
#### :chart_with_upwards_trend: Improvements
4+
5+
- Misc ESP32 [port](ports/esp_idf) &
6+
[example app](examples/esp32/apps/memfault_demo_app) improvements
7+
- Added diagnostic print line containing Build Id at boot up
8+
- Improved messaging displayed when using `memfault_ota_check` test command
9+
- Example app now prints device info on bootup
10+
- Fix an issue where incremental build (`idf.py build && idf.py build`) would
11+
report a nuisance failure.
12+
- Flatten + simplify the directory structure of the QEMU based example project
13+
- A new [`ports/mbedtls`](ports/mbedtls) is available, which implements a basic
14+
Mbed TLS client for performing Memfault data upload.
15+
- Zephyr: Collect sysheap stats using the
16+
[Memfault Heap Tracking](https://mflt.io/mcu-heap-stats) component. This is
17+
configured with the `CONFIG_MEMFAULT_HEAP_STATS` Kconfig option (enabled by
18+
default), and will track allocations done with `k_malloc()`.
19+
- Fix an enum-mismatch warning in `memfault_metrics.c` when using the ARMCC v5
20+
compiler.
21+
22+
#### :boom: Breaking Changes
23+
24+
- If you are using the ESP32 HTTP Client, the Memfault Project Key is now
25+
configured directly via the
26+
[ESP32 Project Configuration System](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/kconfig.html).
27+
You need to do the following:
28+
1. Remove the `g_mflt_http_client_config` in your platform port
29+
2. Add `CONFIG_MEMFAULT_PROJECT_KEY="YOUR_PROJECT_KEY"` to your projects
30+
`sdkconfig.defaults`
31+
132
### Changes between Memfault SDK 0.33.4 and SDK 0.33.5 - Oct 19, 2022
233

334
#### :chart_with_upwards_trend: Improvements

VERSION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
BUILD ID: 161
2-
GIT COMMIT: d4c377659
1+
BUILD ID: 320
2+
GIT COMMIT: 0b70734d8

components/include/memfault/metrics/metrics.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,15 @@ int memfault_metrics_heartbeat_read_signed(MemfaultMetricId key, int32_t *read_v
185185
int memfault_metrics_heartbeat_timer_read(MemfaultMetricId key, uint32_t *read_val);
186186
int memfault_metrics_heartbeat_read_string(MemfaultMetricId key, char *read_val, size_t read_val_len);
187187

188+
//! Collect built-in metrics as part of default ports in memfault-firmware-sdk.
189+
//!
190+
//! It can (optionally) be overridden by a port to collect a set of built-in metrics
191+
//! as configured by the port/application.
192+
//!
193+
//! @note By default, a weak version of this function is implemented which is empty
194+
//! @note This API is for internal use only and should never be called by an end user
195+
void memfault_metrics_heartbeat_collect_sdk_data(void);
196+
188197
#ifdef __cplusplus
189198
}
190199
#endif

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

2424
#ifdef __cplusplus
2525
}

components/metrics/src/memfault_metrics.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ typedef enum MfltMetricStringKeyToIndex {
156156
// Now generate a table mapping the canonical key ID to the index in s_memfault_heartbeat_values
157157
static const eMfltMetricStringKeyToIndex s_memfault_heartbeat_string_key_to_index[] = {
158158
#define MEMFAULT_METRICS_KEY_DEFINE(key_name, value_type) \
159-
0, // 0 for the placeholder so it's safe to index with
159+
(eMfltMetricStringKeyToIndex)0, // 0 for the placeholder so it's safe to index with
160160
#define MEMFAULT_METRICS_STRING_KEY_DEFINE(key_name, max_length) \
161161
kMfltMetricStringKeyToIndex_##key_name,
162162

@@ -260,6 +260,8 @@ static struct {
260260
MEMFAULT_WEAK
261261
void memfault_metrics_heartbeat_collect_data(void) { }
262262

263+
MEMFAULT_WEAK
264+
void memfault_metrics_heartbeat_collect_sdk_data(void) { }
263265

264266
// Returns NULL if not a timer type or out of bounds index.
265267
static sMemfaultMetricValueMetadata *prv_find_timer_metadatap(eMfltMetricsIndex metric_index) {
@@ -532,6 +534,7 @@ static void prv_heartbeat_timer_update(void) {
532534
//! Trigger an update of heartbeat metrics, serialize out to storage, and reset.
533535
static void prv_heartbeat_timer(void) {
534536
prv_heartbeat_timer_update();
537+
memfault_metrics_heartbeat_collect_sdk_data();
535538
memfault_metrics_heartbeat_collect_data();
536539

537540
memfault_metrics_heartbeat_serialize(s_memfault_metrics_ctx.storage_impl);

examples/esp32/README.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,27 @@ We assume you have a working setup for the
7474

7575
That's it! You should be good to go!
7676

77-
### Building the demo app:
77+
### Memfault Project Key
78+
79+
An API key will need to be configured for Memfault HTTP client to communicate
80+
with Memfault's web services. Go to https://app.memfault.com/, navigate to the
81+
project you want to use and select 'Settings'. Copy the 'Project Key', and
82+
configure it; either by running `idf.py menuconfig` and setting the
83+
`MEMFAULT_PROJECT_KEY` config value, or by inserting to `sdkconfig.defaults`:
84+
85+
```kconfig
86+
CONFIG_MEMFAULT_PROJECT_KEY="<YOUR PROJECT KEY>"
87+
```
88+
89+
> Note: when doing a clean build, or a build in CI, another option is to place
90+
> the Project Key in a second `sdkconfig.defaults` file, for example:
91+
>
92+
> ```bash
93+
>echo CONFIG_MEMFAULT_PROJECT_KEY=\"<YOUR PROJECT KEY>\" > sdkconfig.extra
94+
> ❯ idf.py build -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.extra"
95+
> ```
96+
97+
### Building the demo app
7898
7999
using pyinvoke:
80100
@@ -183,8 +203,13 @@ I (77840) mflt: Has coredump with size: 768
183203
#### Uploading Symbols
184204

185205
Memfault needs the symbols for the firmware in order to analyze the coredump.
186-
The ESP32 SDK demo app symbol file can be found at:
187-
`/path/to/examples/esp32/apps/memfault_demo_app/build/memfault-esp32-demo-app.elf`
206+
The ESP32 SDK demo app symbol file can be found in the build folder:
207+
208+
`apps/memfault_demo_app/build/memfault-esp32-demo-app.elf.memfault_log_fmt`
209+
210+
> Note: the file to be uploaded is
211+
> `memfault-esp32-demo-app.elf.memfault_log_fmt`, _not_
212+
> `memfault-esp32-demo-app.elf`, when using compact logs!
188213
189214
This ELF file contains the symbols (debug information) amongst other things.
190215

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/sdkconfig
2+
/sdkconfig.extra
3+
/sdkconfig.old

examples/esp32/apps/memfault_demo_app/CMakeLists.txt

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,9 @@ add_custom_command(TARGET ${IDF_PROJECT_EXECUTABLE}
2121
# Compute and insert the build id
2222
COMMAND python ${memfault_firmare_sdk_dir}/scripts/fw_build_id.py ${IDF_PROJECT_EXECUTABLE}
2323
# Save a copy of the ELF that includes the 'log_fmt' section
24-
COMMAND ${CMAKE_COMMAND} -E copy ${IDF_PROJECT_EXECUTABLE} ${IDF_PROJECT_EXECUTABLE}.memfault
24+
BYPRODUCTS ${IDF_PROJECT_EXECUTABLE}.memfault_log_fmt
25+
COMMAND ${CMAKE_COMMAND} -E copy ${IDF_PROJECT_EXECUTABLE} ${IDF_PROJECT_EXECUTABLE}.memfault_log_fmt
26+
COMMAND ${CMAKE_COMMAND} -E echo "*** NOTE: the symbol file to upload to app.memfault.com is ${IDF_PROJECT_EXECUTABLE}.memfault_log_fmt ***"
2527
# Remove the 'log_fmt' compact log section, which confuses elf2image
2628
COMMAND ${CMAKE_OBJCOPY} --remove-section log_fmt ${IDF_PROJECT_EXECUTABLE}
2729
)
28-
29-
# Add a custom target to swap over the stashed complete elf above after
30-
# elf2image runs
31-
add_custom_target(swap_original_memfault_elf ALL
32-
COMMAND ${CMAKE_COMMAND} -E rename ${IDF_PROJECT_EXECUTABLE}.memfault ${IDF_PROJECT_EXECUTABLE}
33-
DEPENDS app
34-
COMMENT "Copy over original ELF for Memfault uploading"
35-
)

0 commit comments

Comments
 (0)