Skip to content

Commit 969baaf

Browse files
author
Memfault Inc
committed
Memfault Firmware SDK 0.33.0 (Build 497178)
1 parent 36a6345 commit 969baaf

File tree

31 files changed

+671
-60
lines changed

31 files changed

+671
-60
lines changed

CHANGES.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
### Changes between Memfault SDK 0.33.0 and SDK 0.32.2 - Aug 18, 2022
2+
3+
#### :chart_with_upwards_trend: Improvements
4+
5+
- Extend [memfault demo shell](components/demo/src/memfault_demo_shell.c) to
6+
support terminals that only emit CR for line endings
7+
- nRF5 SDK Updates:
8+
- Added a [software watchdog](https://mflt.io/root-cause-watchdogs) reference
9+
port for nRF5 SDK which makes use of the RTC Peripheral. See
10+
[ports/nrf5_sdk/software_watchdog.c](ports/nrf5_sdk/software_watchdog.c) for
11+
more details.
12+
- Updated [nRF5 example app](examples/nrf5/apps/memfault_demo_app/) to make
13+
use of hardware and new software watchdog port.
14+
- Zephyr Port Updates:
15+
- Added Kconfig option to fallback to using `printk` by default when no
16+
logging is enabled. This can be disabled by setting
17+
`CONFIG_MEMFAULT_PLATFORM_LOG_FALLBACK_TO_PRINTK=n`.
18+
- nRF Connect SDK Updates:
19+
- Fixed a :bug: which could result in download errors when using
20+
[Memfault nRF Connect SDK FOTA client](ports/nrf-connect-sdk/zephyr/include/memfault/nrfconnect_port/fota.h)
21+
and enabled client in example application by default.
22+
- Added new example application for trying Memfault with nRF53 & nRF52 based
23+
development kits. See
24+
[examples/nrf-connect-sdk/nrf5](examples/nrf-connect-sdk/nrf5) for more
25+
details.
26+
127
### Changes between Memfault SDK 0.32.2 and SDK 0.32.1 - Aug 16, 2022
228

329
#### :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: 494632
2-
GIT COMMIT: b2b683510
1+
BUILD ID: 497178
2+
GIT COMMIT: 3f51dc76a

components/demo/src/memfault_demo_shell.c

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
static struct MemfaultShellContext {
2929
int (*send_char)(char c);
3030
size_t rx_size;
31+
// the char we will ignore when received end-of-line sequences
32+
char eol_ignore_char;
3133
char rx_buffer[MEMFAULT_DEMO_SHELL_RX_BUFFER_SIZE];
3234
} s_mflt_shell;
3335

@@ -43,7 +45,7 @@ static void prv_send_char(char c) {
4345
}
4446

4547
static void prv_echo(char c) {
46-
if ('\n' == c) {
48+
if (c == '\n') {
4749
prv_send_char('\r');
4850
prv_send_char('\n');
4951
} else if ('\b' == c) {
@@ -129,13 +131,34 @@ static void prv_process(void) {
129131
}
130132

131133
void memfault_demo_shell_boot(const sMemfaultShellImpl *impl) {
134+
s_mflt_shell.eol_ignore_char = 0;
132135
s_mflt_shell.send_char = impl->send_char;
133136
prv_reset_rx_buffer();
134137
prv_echo_str("\n" MEMFAULT_SHELL_PROMPT);
135138
}
136139

140+
//! Logic to deal with CR, LF, CRLF, or LFCR end-of-line (EOL) sequences
141+
//! @return true if the character should be ignored, false otherwise
142+
static bool prv_should_ignore_eol_char(char c) {
143+
if (s_mflt_shell.eol_ignore_char != 0) {
144+
return (c == s_mflt_shell.eol_ignore_char);
145+
}
146+
147+
//
148+
// First end of line character detected. We will use this character as our EOL delimiter and
149+
// ignore the opposite character when we see it in the future.
150+
//
151+
152+
if (c == '\r') {
153+
s_mflt_shell.eol_ignore_char = '\n';
154+
} else if (c == '\n') {
155+
s_mflt_shell.eol_ignore_char = '\r';
156+
}
157+
return false;
158+
}
159+
137160
void memfault_demo_shell_receive_char(char c) {
138-
if (c == '\r' || prv_is_rx_buffer_full() || !prv_booted()) {
161+
if (prv_should_ignore_eol_char(c) || prv_is_rx_buffer_full() || !prv_booted()) {
139162
return;
140163
}
141164

@@ -144,6 +167,11 @@ void memfault_demo_shell_receive_char(char c) {
144167
return; // nothing left to delete so don't echo the backspace
145168
}
146169

170+
// CR are our EOL delimiter. Remap as a LF here since that's what internal handling logic expects
171+
if (c == '\r') {
172+
c = '\n';
173+
}
174+
147175
prv_echo(c);
148176

149177
if (is_backspace) {

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

2424
#ifdef __cplusplus
2525
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/bootloader
2+
/build
3+
/mbedtls
4+
/modules
5+
/nrf
6+
/nrfxlib
7+
/sparc
8+
/test
9+
/tools
10+
/.west
11+
/zephyr
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# nRF-Connect Memfault Example
2+
3+
This is a small example application showing a Memfault integration running on an
4+
nrf52840 development board, using the nRF Connect SDK. Any nRF board should also
5+
work. The example has been tested on:
6+
7+
- nRF52840-DK
8+
- nRF5340-DK
9+
10+
## Usage
11+
12+
Make sure you have the Zephyr / nRF-Connect tools installed first:
13+
14+
<https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.0.2/nrf/gs_installing.html>
15+
16+
To build and flash this example to an nRF52840-DK (PCA10056), run the following
17+
commands:
18+
19+
```bash
20+
❯ west init --local memfault_demo_app
21+
❯ west update
22+
❯ west build --board nrf52840dk_nrf52840 memfault_demo_app
23+
❯ west flash
24+
```
25+
26+
Open a serial terminal to access the console:
27+
28+
```bash
29+
# for example, pypserial-miniterm
30+
❯ pyserial-miniterm --raw /dev/ttyACM0 115200
31+
```
32+
33+
The console has several Memfault test commands available:
34+
35+
```bash
36+
uart:~$ mflt help
37+
mflt - Memfault Test Commands
38+
Subcommands:
39+
reboot :trigger a reboot and record it using memfault
40+
get_core :gets the core
41+
clear_core :clear the core
42+
crash :trigger a crash
43+
test_log :Writes test logs to log buffer
44+
trigger_logs :Trigger capture of current log buffer contents
45+
hang :trigger a hang to test watchdog functionality
46+
export :dump chunks collected by Memfault SDK using
47+
https://mflt.io/chunk-data-export
48+
trace :Capture an example trace event
49+
get_device_info :display device information
50+
post_chunks :Post Memfault data to cloud
51+
trigger_heartbeat :Trigger an immediate capture of all heartbeat metrics
52+
get_latest_release :checks to see if new ota payload is available
53+
```
54+
55+
For example, to test the coredump functionality:
56+
57+
1. run `mflt crash` and wait for the board to reset
58+
2. run `mflt get_core` to confirm the coredump was saved
59+
3. run `mflt export` to print out the base-64 chunks:
60+
61+
```plaintext
62+
uart:~$ mflt export
63+
<inf> <mflt>: MC:SE4DpwIEAwEKbW5yZjUyX2V4YW1wbGUJZTAuMC4xBmFhC0Z5RE1gF8EEhgFpSW5mbyBsb2chAmxXYXJuaW5nIGxvZyEDakVycm9yIGxvZyE=:
64+
<inf> <mflt>: MC:gE6A/A==:
65+
```
66+
67+
4. upload the chunks to Memfault. see here for details:
68+
69+
<https://mflt.io/chunks-debug>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
cmake_minimum_required(VERSION 3.20.0)
4+
5+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
6+
project(fs_shell)
7+
8+
FILE(GLOB app_sources src/*.c)
9+
target_sources(app PRIVATE ${app_sources})
10+
11+
zephyr_include_directories(config)
12+
13+
# Normalize dbug + __FILE__ paths to relative locations:
14+
# 1. west workspace
15+
# 2. toolchain install location (applies to paths in cross tool library files)
16+
#
17+
# If debugging from location 1., the west-manifest files should already have the
18+
# correct relative path for GDB to locate them, otherwise the GDB "directory"
19+
# command can be used to tell GDB where to find the source files (also required
20+
# if the cross tool libraries/headers need to be located by GDB)
21+
get_filename_component(WEST_PROJECT_ROOT_PATH
22+
"${CMAKE_CURRENT_LIST_DIR}/.."
23+
ABSOLUTE)
24+
zephyr_compile_options(
25+
-ffile-prefix-map=${WEST_PROJECT_ROOT_PATH}=.
26+
-ffile-prefix-map=${TOOLCHAIN_HOME}=.
27+
-Wa,--debug-prefix-map=${WEST_PROJECT_ROOT_PATH}=.
28+
)

examples/nrf-connect-sdk/nrf5/memfault_demo_app/config/memfault_metrics_heartbeat_config.def

Whitespace-only changes.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#pragma once
2+
3+
//! @file
4+
//!
5+
//! Copyright (c) Memfault, Inc.
6+
//! See License.txt for details
7+
//!
8+
//! Platform overrides for the default configuration settings in the memfault-firmware-sdk.
9+
//! Default configuration settings can be found in "memfault/config.h"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// This is where project specific trace reasons should be defined
2+
// using the MEMFAULT_TRACE_REASON_DEFINE macro
3+
//
4+
// For example:
5+
// MEMFAULT_TRACE_REASON_DEFINE(your_custom_error_reason)

0 commit comments

Comments
 (0)