Skip to content

Commit a41aef8

Browse files
author
Memfault Inc
committed
Memfault Firmware SDK 1.9.3 (Build 8266)
1 parent 9d3ca21 commit a41aef8

File tree

16 files changed

+462
-16
lines changed

16 files changed

+462
-16
lines changed

CHANGELOG.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,43 @@ 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.3] - 2024-06-10
10+
11+
### :chart_with_upwards_trend: Improvements
12+
13+
- ESP-IDF:
14+
15+
- The default Device Info Software Version (Kconfig
16+
`CONFIG_MEMFAULT_DEVICE_INFO_SOFTWARE_VERSION`) has been updated to `0.0.0`
17+
from `1.0.0-dev` for the built-in Device Info implementation. See
18+
`menuconfig` or
19+
[`ports/esp_idf/memfault/Kconfig`](ports/esp_idf/memfault/Kconfig) for
20+
details. This should only affect users who are using the default value for
21+
that Kconfig.
22+
23+
- Fix a bug when `CONFIG_MEMFAULT_LWIP_METRICS=y` that may cause invalid
24+
metric values. LwIP stats by default are only 16-bits wide and this can
25+
cause underflow when calculating heartbeat values. This fix forces
26+
`LWIP_STATS_LARGE=1` to make LwIP use 32-bit counters.
27+
28+
- Add a feature to the [esp32 example app](examples/esp32) to enable
29+
overriding the Memfault server URLs (ex: for a proxy).
30+
31+
- Improve docs and comments in example app
32+
33+
- General:
34+
35+
- Updated the default exception handler name for Memory Management exceptions
36+
from `MemoryManagement_Handler` to `MemManage_Handler` (set by
37+
`MEMFAULT_EXC_HANDLER_MEMORY_MANAGEMENT` in
38+
[`default_config.h`](components/include/memfault/default_config.h) when not
39+
overridden by the user). This aligns with the more recent CMSIS naming
40+
convention for exception handlers. A backwards-compatible implementation is
41+
included to avoid breaking users relying on the previous default.
42+
43+
- Add [`libcurl`-based samples](examples/libcurl) for posting chunks to Memfault and
44+
checking for latest OTA release.
45+
946
## [1.9.2] - 2024-05-29
1047

1148
### :chart_with_upwards_trend: Improvements

VERSION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
BUILD ID: 8056
2-
GIT COMMIT: 398b8ca5a7
3-
VERSION: 1.9.2
1+
BUILD ID: 8266
2+
GIT COMMIT: 10085ffa3f
3+
VERSION: 1.9.3

components/include/memfault/default_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ extern "C" {
425425
#endif
426426

427427
#ifndef MEMFAULT_EXC_HANDLER_MEMORY_MANAGEMENT
428-
#define MEMFAULT_EXC_HANDLER_MEMORY_MANAGEMENT MemoryManagement_Handler
428+
#define MEMFAULT_EXC_HANDLER_MEMORY_MANAGEMENT MemManage_Handler
429429
#endif
430430

431431
#ifndef MEMFAULT_EXC_HANDLER_BUS_FAULT

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

2525
#ifdef __cplusplus
2626
}

components/panics/src/memfault_fault_handling_arm.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,17 @@ void MEMFAULT_EXC_HANDLER_MEMORY_MANAGEMENT(void) {
260260
ALIGN
261261
}
262262

263+
//! MemoryManagement_Handler() is the previous default name, supported for
264+
//! backwards compatibility
265+
#if !defined(MEMFAULT_DISABLE_OLD_MEMMANAGE_HANDLER)
266+
MEMFAULT_NAKED_FUNC void MemoryManagement_Handler(void) {
267+
ldr r0, =0x9200 // kMfltRebootReason_MemFault
268+
ldr r1, =memfault_fault_handling_shim
269+
bx r1
270+
ALIGN
271+
}
272+
#endif
273+
263274
MEMFAULT_NAKED_FUNC
264275
void MEMFAULT_EXC_HANDLER_BUS_FAULT(void) {
265276
ldr r0, =0x9100 // kMfltRebootReason_BusFault
@@ -319,6 +330,12 @@ MEMFAULT_NAKED_FUNC void MEMFAULT_EXC_HANDLER_MEMORY_MANAGEMENT(void) {
319330
__asm(" mov r0, #0x9200 \n" // kMfltRebootReason_MemFault
320331
" b memfault_fault_handling_shim \n");
321332
}
333+
#if !defined(MEMFAULT_DISABLE_OLD_MEMMANAGE_HANDLER)
334+
MEMFAULT_NAKED_FUNC void MemoryManagement_Handler(void) {
335+
__asm(" mov r0, #0x9200 \n" // kMfltRebootReason_MemFault
336+
" b memfault_fault_handling_shim \n");
337+
}
338+
#endif
322339

323340
MEMFAULT_NAKED_FUNC void MEMFAULT_EXC_HANDLER_BUS_FAULT(void) {
324341
__asm(" mov r0, #0x9100 \n" // kMfltRebootReason_BusFault
@@ -397,6 +414,13 @@ MEMFAULT_NAKED_FUNC void MEMFAULT_EXC_HANDLER_MEMORY_MANAGEMENT(void) {
397414
MEMFAULT_HARDFAULT_HANDLING_ASM(kMfltRebootReason_MemFault);
398415
}
399416

417+
#if !defined(MEMFAULT_DISABLE_OLD_MEMMANAGE_HANDLER)
418+
MEMFAULT_NAKED_FUNC void MemoryManagement_Handler(void);
419+
MEMFAULT_NAKED_FUNC void MemoryManagement_Handler(void) {
420+
MEMFAULT_HARDFAULT_HANDLING_ASM(kMfltRebootReason_MemFault);
421+
}
422+
#endif
423+
400424
MEMFAULT_NAKED_FUNC void MEMFAULT_EXC_HANDLER_BUS_FAULT(void) {
401425
MEMFAULT_HARDFAULT_HANDLING_ASM(kMfltRebootReason_BusFault);
402426
}
@@ -470,6 +494,13 @@ MEMFAULT_NAKED_FUNC void MEMFAULT_EXC_HANDLER_MEMORY_MANAGEMENT(void) {
470494
MEMFAULT_HARDFAULT_HANDLING_ASM(kMfltRebootReason_MemFault);
471495
}
472496

497+
#if !defined(MEMFAULT_DISABLE_OLD_MEMMANAGE_HANDLER)
498+
MEMFAULT_NAKED_FUNC void MemoryManagement_Handler(void);
499+
MEMFAULT_NAKED_FUNC void MemoryManagement_Handler(void) {
500+
MEMFAULT_HARDFAULT_HANDLING_ASM(kMfltRebootReason_MemFault);
501+
}
502+
#endif
503+
473504
MEMFAULT_NAKED_FUNC void MEMFAULT_EXC_HANDLER_BUS_FAULT(void) {
474505
MEMFAULT_HARDFAULT_HANDLING_ASM(kMfltRebootReason_BusFault);
475506
}

examples/esp32/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ We assume you have a working setup for the
5555
### Adding Memfault to the ESP-IDF SDK
5656

5757
1. Delete the dummy esp-idf directory (if present) and clone a copy of the
58-
v5.0.2 SDK.
58+
v5.2.1 SDK.
5959

6060
```bash
6161
cd examples/esp32/
6262
rm -rf esp-idf
63-
git clone -b v5.0.2 --recursive https://github.com/espressif/esp-idf.git esp-idf
63+
git clone -b v5.2.1 --recursive https://github.com/espressif/esp-idf.git esp-idf
6464
cd esp-idf
6565
export IDF_TOOLS_PATH=$(pwd)
6666
# you may need to install the sdk tools by running ./install.sh here

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,20 @@ void app_main() {
467467
g_mflt_http_client_config.api_key = project_key;
468468
}
469469

470+
// Load chunks + device URLs from NVS too, only for esp_idf >=4
471+
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)
472+
// Need to persist for the lifetime of the program
473+
static char chunks_url[128] = { 0 };
474+
static char device_url[128] = { 0 };
475+
size_t chunks_url_len = sizeof(chunks_url);
476+
size_t device_url_len = sizeof(device_url);
477+
if ((settings_get(kSettingsChunksUrl, chunks_url, &chunks_url_len) == 0) &&
478+
(settings_get(kSettingsDeviceUrl, device_url, &device_url_len) == 0)) {
479+
g_mflt_http_client_config.chunks_api.host = (chunks_url_len > 1) ? chunks_url : NULL;
480+
g_mflt_http_client_config.device_api.host = (device_url_len > 1) ? device_url : NULL;
481+
}
482+
#endif
483+
470484
#if MEMFAULT_COMPACT_LOG_ENABLE
471485
MEMFAULT_COMPACT_LOG_SAVE(kMemfaultPlatformLogLevel_Info, "This is a compact log example");
472486
#endif

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ int __wrap_mbedtls_net_recv(void *ctx, unsigned char *buf, size_t len) {
5757
return rv;
5858
}
5959

60-
// This API was added in ESP-IDF v4.3.6, add a stub for earlier versions.
60+
// This API was added in ESP-IDF v4.3.6, v4.4.6, v5.0.4, and v5.1.1. Add a stub for versions
61+
// < v4.3.6. For simplicity, projects with versions > v4.3.6 but less than the patch the API was
62+
// added in for the corresponding minor version are not supported with this check. There will be a
63+
// build error due to a missing definition for the API.
6164
// https://github.com/espressif/esp32-wifi-lib/blob/release/v4.4/esp32/libnet80211.a
6265
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(4, 3, 6)
6366
esp_err_t esp_wifi_sta_get_rssi(int *rssi) {

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,20 @@ static const struct {
7272
.i32 = 500,
7373
},
7474
},
75+
[kSettingsChunksUrl] = {
76+
kSettingsTypeString,
77+
"chunks_url",
78+
{
79+
.str = MEMFAULT_HTTP_CHUNKS_API_HOST,
80+
},
81+
},
82+
[kSettingsDeviceUrl] = {
83+
kSettingsTypeString,
84+
"device_url",
85+
{
86+
.str = MEMFAULT_HTTP_DEVICE_API_HOST,
87+
},
88+
},
7589
};
7690

7791
static bool prv_settings_key_is_valid(enum settings_key key) {

examples/esp32/apps/memfault_demo_app/main/settings.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ enum settings_key {
1717
kSettingsProjectKey,
1818
kSettingsLedBrightness,
1919
kSettingsLedBlinkIntervalMs,
20+
kSettingsChunksUrl,
21+
kSettingsDeviceUrl,
2022
};
2123

2224
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)

0 commit comments

Comments
 (0)