Skip to content

Commit ac6cb05

Browse files
author
Memfault Inc
committed
Memfault Firmware SDK 0.34.1 (Build 390)
1 parent 315d643 commit ac6cb05

File tree

18 files changed

+243
-23
lines changed

18 files changed

+243
-23
lines changed

CHANGES.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
### Changes between Memfault SDK 0.34.1 and SDK 0.34.0 - Nov 7, 2022
2+
3+
#### :chart_with_upwards_trend: Improvements
4+
5+
- nRF-Connect:
6+
- Updates for Zephyr upmerge 2022.11.03 (see #35 + #36)
7+
- Fix watchdog test (`mflt test hang`) in
8+
[`examples/nrf-connect-sdk/nrf5/`](examples/nrf-connect-sdk/nrf5/)
9+
- Zephyr:
10+
- Set `CONFIG_QEMU_ICOUNT=n` in
11+
[`examples/zephyr/qemu/`](examples/zephyr/qemu/), which fixes the emulated
12+
target execution speed
13+
- Add heap free and stack usage Metrics to
14+
[`examples/zephyr/qemu/`](examples/zephyr/qemu/)
15+
- Update the `memfault_demo_cli_cmd_assert()` test command to take a single arg,
16+
which is used in `MEMFAULT_ASSERT_RECORD()`. This enables testing that assert
17+
variant from the CLI.
18+
119
### Changes between Memfault SDK 0.34.0 and SDK 0.33.5 - Nov 1, 2022
220

321
#### :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: 320
2-
GIT COMMIT: 0b70734d8
1+
BUILD ID: 390
2+
GIT COMMIT: d0c8fd2a6

components/demo/src/panics/memfault_demo_panics.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,13 @@ int memfault_demo_cli_cmd_clear_core(MEMFAULT_UNUSED int argc, MEMFAULT_UNUSED c
111111
return 0;
112112
}
113113

114-
int memfault_demo_cli_cmd_assert(MEMFAULT_UNUSED int argc, MEMFAULT_UNUSED char *argv[]) {
115-
MEMFAULT_ASSERT(0);
114+
int memfault_demo_cli_cmd_assert(int argc, char *argv[]) {
115+
// permit running with a user-provided "extra" value for testing that path
116+
if (argc > 1) {
117+
MEMFAULT_ASSERT_RECORD(atoi(argv[1]));
118+
} else {
119+
MEMFAULT_ASSERT(0);
120+
}
116121
}
117122

118123
#if MEMFAULT_COMPILER_ARM

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

2424
#ifdef __cplusplus
2525
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ CONFIG_HWINFO=y
99

1010
# Enable Memfault
1111
CONFIG_MEMFAULT=y
12-
# Below config is set by default in Memfault SDK 0.30.5+
13-
CONFIG_MEMFAULT_NRF_CONNECT_SDK=y
1412

1513
# Use internal flash to store the coredump
1614
CONFIG_MEMFAULT_NCS_INTERNAL_FLASH_BACKED_COREDUMP=y
@@ -36,6 +34,8 @@ CONFIG_SHELL_LOG_BACKEND=n
3634
# Immediate logging is more performant at the expense of the rest of the system.
3735
# Default is deferred to the logging thread.
3836
CONFIG_LOG_MODE_IMMEDIATE=y
37+
# Enable DBG log level
38+
CONFIG_MEMFAULT_LOG_LEVEL_DBG=y
3939

4040
# Enable capture of recent logs as part of a coredump
4141
CONFIG_MEMFAULT_LOGGING_ENABLE=y

examples/nrf-connect-sdk/nrf5/memfault_demo_app/src/main.c

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#include <memfault_ncs.h>
1212
#include <stdio.h>
1313

14+
#include "memfault/ports/watchdog.h"
15+
1416
LOG_MODULE_REGISTER(main, LOG_LEVEL_INF);
1517

1618
//! wrapper to enclose logic around log_strdup
@@ -51,11 +53,42 @@ static void prv_set_device_id(void) {
5153
memfault_ncs_device_id_set(dev_str, length * 2);
5254
}
5355

56+
#define WD_FEED_THREAD_STACK_SIZE 500
57+
// set priority to lowest application thread; shell_uart, where the 'mflt test
58+
// hang' command runs from, uses the same priority by default, so this should
59+
// not preempt it and correctly trip the watchdog
60+
#if CONFIG_SHELL_THREAD_PRIORITY_OVERRIDE
61+
#error "Watchdog feed thread priority must be lower than shell thread priority"
62+
#endif
63+
#define WD_FEED_THREAD_PRIORITY K_LOWEST_APPLICATION_THREAD_PRIO
64+
65+
static void prv_wd_feed_thread_function(void *arg0, void *arg1, void *arg2) {
66+
ARG_UNUSED(arg0);
67+
ARG_UNUSED(arg1);
68+
ARG_UNUSED(arg2);
69+
70+
while (1) {
71+
memfault_software_watchdog_feed();
72+
k_sleep(K_SECONDS(1));
73+
}
74+
}
75+
K_THREAD_DEFINE(wd_feed_thread, WD_FEED_THREAD_STACK_SIZE, prv_wd_feed_thread_function, NULL, NULL,
76+
NULL, WD_FEED_THREAD_PRIORITY, 0, 0);
77+
78+
static void prv_start_watchdog_feed_thread(void) {
79+
LOG_INF("starting watchdog feed thread 🐶");
80+
memfault_software_watchdog_enable();
81+
k_thread_name_set(wd_feed_thread, "wd_feed_thread");
82+
k_thread_start(wd_feed_thread);
83+
}
84+
5485
void main(void) {
5586
LOG_INF("Booting Memfault sample app!");
5687

5788
// Set the device id based on the hardware UID
5889
prv_set_device_id();
5990

6091
memfault_device_info_dump();
92+
93+
prv_start_watchdog_feed_thread();
6194
}
Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
bootloader*
2-
mbedtls*
3-
modules*
4-
nrf*
5-
nrfxlib*
6-
sdk-nrf*
7-
test*
8-
tools*
9-
zephyr*
1+
/bootloader
2+
/build
3+
/mbedtls
4+
/modules
5+
/nrf
6+
/nrfxlib
7+
/sparc
8+
/test
9+
/tools
10+
/.west
11+
/zephyr

examples/zephyr/qemu/README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@ the following commands to test the application:
1515
❯ west update
1616

1717
# build the target program
18-
# highly recommend '-DCONFIG_QEMU_ICOUNT=n' otherwise the guest runs too fast
19-
❯ west build -b qemu_cortex_m3 --pristine=always zephyr-memfault-example/app -- -DCONFIG_QEMU_ICOUNT=n
18+
❯ west build -b qemu_cortex_m3 --pristine=always qemu-app
2019
❯ west build -t run
2120

22-
*** Booting Zephyr OS build zephyr-v3.1.0 ***
23-
[00:00:00.000,000] <inf> mflt: GNU Build ID: a3f2f5da83bc62ceb0351f88a8b30d5cdab59ae9
24-
[00:00:00.000,000] <inf> main: Memfault Demo App! Board qemu_cortex_m3
21+
*** Booting Zephyr OS build zephyr-v3.2.0 ***
22+
[00:00:00.000,000] <inf> mflt: GNU Build ID: 4ffb5879ed5923582035133086015bbf65504364
23+
[00:00:00.000,000] <inf> main: 👋 Memfault Demo App! Board qemu_cortex_m3
2524

2625
[00:00:00.000,000] <inf> mflt: S/N: DEMOSERIAL
2726
[00:00:00.000,000] <inf> mflt: SW type: zephyr-app
28-
[00:00:00.000,000] <inf> mflt: SW version: 1.0.0-dev
27+
[00:00:00.000,000] <inf> mflt: SW version: 1.0.0+6c108c40f1
2928
[00:00:00.000,000] <inf> mflt: HW version: qemu_cortex_m3
29+
30+
uart:~$
3031
```

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ cmake_minimum_required(VERSION 3.20.0)
55
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
66

77
target_sources(app PRIVATE src/main.c)
8+
zephyr_include_directories(config)
89
project(qemu-app LANGUAGES C VERSION 1.0.0)
910

1011
# Generate a git hash that's used as part of the software_version, eg

examples/zephyr/qemu/qemu-app/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ config ZEPHYR_MEMFAULT_EXAMPLE_THREAD_TOGGLE
99
help
1010
Enables creating and aborting an example thread every 10 seconds in the
1111
example app
12+
13+
config ZEPHYR_MEMFAULT_EXAMPLE_MEMORY_METRICS
14+
bool "Use metrics to monitor memory usage in the example app"
15+
default y
16+
depends on MEMFAULT
17+
1218
endmenu
1319

1420
source "Kconfig.zephyr"

0 commit comments

Comments
 (0)