Skip to content

Commit 65447c9

Browse files
author
Memfault Inc
committed
Memfault Firmware SDK 1.11.2 (Build 9770)
1 parent d53956a commit 65447c9

File tree

22 files changed

+251
-39
lines changed

22 files changed

+251
-39
lines changed

CHANGELOG.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,71 @@ 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.11.2] - 2024-08-29
10+
11+
### :chart_with_upwards_trend: Improvements
12+
13+
- nRF-Connect SDK:
14+
15+
- Add support for the following reboot reasons on nRF series SOCs. These
16+
reboot reasons are tracked as `kMfltRebootReason_DeepSleep`.
17+
18+
- `NRF_POWER_RESETREAS_OFF_MASK`
19+
- `NRF_POWER_RESETREAS_NFC_MASK`
20+
- `NRF_POWER_RESETREAS_CTRLAP_MASK`
21+
22+
- Zephyr:
23+
24+
- Use `MEMFAULT_ASSERT_HALT_IF_DEBUGGING_ENABLED` to control whether coredumps
25+
trigger a halt when a debugger is attached.
26+
27+
- Add a new Kconfig option, `CONFIG_MEMFAULT_RAM_BACKED_COREDUMP_REGION`, to
28+
set the RAM region used for storing RAM-backed coredumps.
29+
30+
- Fix a :bug: when trying to communicate via HTTPS with Memfault on the
31+
nRF91x. On the nRF91x, socket operations are offloaded to the nRF modem lib,
32+
which does not currently support the socket option `TLS_CERT_NO_COPY`. In
33+
v1.9.4, this socket option was applied when TLS was enabled
34+
(`!g_mflt_http_client_config.disable_tls`) and Zephyr version was >=3.0.0
35+
(when support for this socket option was added). Therefore, devices on SDK
36+
versions >=1.9.4 and <1.11.2 trying to communicate with Memfault will run
37+
into a no protocol support error (`ENOPROTOOPT`) in the nRF modem lib. Since
38+
this option is only required to use the DER format,
39+
`CONFIG_MEMFAULT_TLS_CERTS_USE_DER` now depends on the Zephyr-implemented
40+
socket operations being used (`!NET_SOCKET_OFFLOAD`).
41+
42+
- Fix the build when using Zephyr 3.7.0 and leveraging the HTTP client and/or
43+
ESP32 port. The Memfault HTTP client would fail to build due to the wrong
44+
`crypto.h` header getting picked up in the build. Additionally, due to the
45+
[removal of default support for mbedTLS hash algorithms in Zephyr](https://docs.zephyrproject.org/latest/releases/migration-guide-3.7.html#mbed-tls),
46+
`CONFIG_MBEDTLS_SHA1` now must be enabled explicitly when using any of
47+
Memfault's CA certificates. When using PEM and leveraging Zephyr's in-tree
48+
mbedTLS and config file
49+
(`CONFIG_MBEDTLS_BUILTIN=y && CONFIG_MBEDTLS_CFG_FILE="config-tls-generic.h"`),
50+
`CONFIG_MBEDTLS_PEM_CERTIFICATE_FORMAT=y` is required for PEM certificate
51+
support. To simplify certificate format selection, a new choice Kconfig
52+
called `CONFIG_MEMFAULT_TLS_CERTS_FORMAT` has been added. Use the configs
53+
`CONFIG_MEMFAULT_TLS_CERTS_USE_PEM` and `CONFIG_MEMFAULT_TLS_CERTS_USE_DER`
54+
to choose the certificate format.`CONFIG_MEMFAULT_TLS_CERTS_USE_DER` is the
55+
default choice config. Finally, the Kconfig `CONFIG_SOC_FAMILY_ESP32` is now
56+
deprecated. References of this Kconfig now also check the new Kconfig
57+
`CONFIG_SOC_FAMILY_ESPRESSIF_ESP32`. See
58+
[Zephyr's 3.7 Migration guide](https://docs.zephyrproject.org/latest/releases/migration-guide-3.7.html)
59+
for more details.
60+
61+
- Dialog
62+
63+
- Add support to the existing DA145xx port for the DA14535 by adding the
64+
correct memory region for `memfault_platform_sanitize_address_range()`.
65+
66+
- Fix several :bug:s in `memfault_reboot_reason_get()` and
67+
`memfault_platform_reboot()` implementations in the DA146x port. In
68+
`memfault_reboot_reason_get()`, the bit masks were incorrectly applied and a
69+
block was missing to reset the reboot reason register if
70+
`MEMFAULT_REBOOT_REASON_CLEAR` is set. In `memfault_platform_reboot()`, the
71+
mechanism to reboot the system has been updated from
72+
`hw_cpm_reboot_system()` to `SWRESET`.
73+
974
## [1.11.1] - 2024-08-12
1075

1176
### :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: 9373
2-
GIT COMMIT: 4730bd7818
3-
VERSION: 1.11.1
1+
BUILD ID: 9770
2+
GIT COMMIT: ea6fadf472
3+
VERSION: 1.11.2

components/core/src/memfault_self_test.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ static bool is_field_valid(const char *str, eDeviceInfoField field) {
8787
// Max + 1 needed determine if we exceeded bounds before NULL found
8888
size_t len = memfault_strnlen(str, MEMFAULT_DEVICE_INFO_MAX_STRING_SIZE + 1);
8989
if ((len < 1) || (len > MEMFAULT_DEVICE_INFO_MAX_STRING_SIZE)) {
90+
(void)s_device_info_field_names; // Avoid unused variable warning when logging is disabled
9091
MEMFAULT_LOG_ERROR("Invalid length %zu for %s", len, s_device_info_field_names[field]);
9192
return false;
9293
}

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 = 11, .patch = 1 }
23-
#define MEMFAULT_SDK_VERSION_STR "1.11.1"
22+
#define MEMFAULT_SDK_VERSION { .major = 1, .minor = 11, .patch = 2 }
23+
#define MEMFAULT_SDK_VERSION_STR "1.11.2"
2424

2525
#ifdef __cplusplus
2626
}

components/panics/src/memfault_fault_handling_riscv.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ void memfault_arch_fault_handling_assert(void *pc, void *lr, eMemfaultRebootReas
4545

4646
// For non-esp-idf riscv implementations, provide a full assert handler and
4747
// other utilities.
48-
#if defined(__ZEPHYR__) && defined(CONFIG_SOC_FAMILY_ESP32)
48+
#if defined(__ZEPHYR__) && \
49+
(defined(CONFIG_SOC_FAMILY_ESP32) || defined(CONFIG_SOC_FAMILY_ESPRESSIF_ESP32))
4950
#include <hal/cpu_hal.h>
5051
#include <zephyr/kernel.h>
5152

components/panics/src/memfault_fault_handling_xtensa.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,25 @@ void memfault_arch_fault_handling_assert(void *pc, void *lr, eMemfaultRebootReas
4141
}
4242

4343
// For Zephyr Xtensa, provide an assert handler and other utilities.
44-
#if defined(__ZEPHYR__) && defined(CONFIG_SOC_FAMILY_ESP32)
44+
// The Kconfig for the ESP32 family changed in v3.7.0. Support both Kconfigs
45+
#if defined(__ZEPHYR__) && \
46+
(defined(CONFIG_SOC_FAMILY_ESP32) || defined(CONFIG_SOC_FAMILY_ESPRESSIF_ESP32))
4547
#include <hal/cpu_hal.h>
4648
#include <zephyr/kernel.h>
4749

50+
#include "memfault/ports/zephyr/version.h"
51+
4852
void memfault_platform_halt_if_debugging(void) {
53+
// cpu_ll.h was deprecated in v3.7.0
54+
#if MEMFAULT_ZEPHYR_VERSION_GT(3, 6)
55+
if (esp_cpu_dbgr_is_attached()) {
56+
MEMFAULT_BREAKPOINT();
57+
}
58+
#else
4959
if (cpu_ll_is_debugger_attached()) {
5060
MEMFAULT_BREAKPOINT();
5161
}
62+
#endif
5263
}
5364

5465
bool memfault_arch_is_inside_isr(void) {

examples/esp32/apps/memfault_demo_app/sdkconfig.defaults

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,6 @@ CONFIG_MEMFAULT_COMPACT_LOG_ENABLE=y
5050

5151
# Enable periodic upload thread for posting Memfault data
5252
CONFIG_MEMFAULT_HTTP_PERIODIC_UPLOAD=y
53+
54+
# Support older ESP32-C3 variants
55+
CONFIG_ESP32C3_REV_MIN_2=y

examples/nrf-connect-sdk/nrf5/memfault_demo_app/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
cmake_minimum_required(VERSION 3.20.0)
44

5-
# The default board for this example is the nrf52840dk_nrf52840, but can be
5+
# The default board for this example is the nrf52840dk/nrf52840, but can be
66
# overridden by passing --board=<board> to west or -DBOARD=<board> to cmake
7-
set(BOARD nrf52840dk_nrf52840)
7+
set(BOARD nrf52840dk/nrf52840)
88

99
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
1010
project(fs_shell)

examples/nrf-connect-sdk/nrf5/memfault_demo_app/prj.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,7 @@ CONFIG_WATCHDOG=y
5353

5454
# Enable Zephyr runtime asserts
5555
CONFIG_ASSERT=y
56+
57+
# For testing poweroff mode, enable GPIO + poweroff subsystems
58+
CONFIG_GPIO=y
59+
CONFIG_POWEROFF=y
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
//! @file
2+
//!
3+
//! Copyright (c) Memfault, Inc.
4+
//! See License.txt for details
5+
//!
6+
//! Shell commands
7+
8+
#include <zephyr/drivers/gpio.h>
9+
#include <zephyr/kernel.h>
10+
// #include <zephyr/pm/device.h>
11+
#include <zephyr/logging/log.h>
12+
#include <zephyr/shell/shell.h>
13+
#include <zephyr/sys/poweroff.h>
14+
15+
LOG_MODULE_REGISTER(appshell, LOG_LEVEL_INF);
16+
17+
static const struct gpio_dt_spec sw0 = GPIO_DT_SPEC_GET(DT_ALIAS(sw0), gpios);
18+
19+
// Define a simple shell command
20+
static int cmd_poweroff(const struct shell *shell, size_t argc, char **argv) {
21+
LOG_INF("Powering off device");
22+
/* configure sw0 as input, interrupt as level active to allow wake-up */
23+
int rc = gpio_pin_configure_dt(&sw0, GPIO_INPUT);
24+
if (rc < 0) {
25+
LOG_ERR("Could not configure sw0 GPIO (%d)\n", rc);
26+
return 0;
27+
}
28+
29+
rc = gpio_pin_interrupt_configure_dt(&sw0, GPIO_INT_LEVEL_ACTIVE);
30+
if (rc < 0) {
31+
LOG_ERR("Could not configure sw0 GPIO interrupt (%d)\n", rc);
32+
return 0;
33+
}
34+
35+
LOG_INF("Entering system off; press sw0 to restart\n");
36+
37+
// rc = pm_device_action_run(cons, PM_DEVICE_ACTION_SUSPEND);
38+
// if (rc < 0) {
39+
// printf("Could not suspend console (%d)\n", rc);
40+
// return 0;
41+
// }
42+
43+
// if (IS_ENABLED(CONFIG_APP_RETENTION)) {
44+
// /* Update the retained state */
45+
// retained.off_count += 1;
46+
// retained_update();
47+
// }
48+
49+
sys_poweroff();
50+
return 0;
51+
}
52+
53+
SHELL_CMD_REGISTER(poweroff, NULL, "Power off the device", cmd_poweroff);

0 commit comments

Comments
 (0)