Skip to content

Commit a04d930

Browse files
author
Memfault Inc
committed
Memfault Firmware SDK 0.41.2 (Build 1696)
1 parent dbdeb48 commit a04d930

File tree

13 files changed

+266
-17
lines changed

13 files changed

+266
-17
lines changed

CHANGES.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1+
### Changes between Memfault SDK 0.41.2 and SDK 0.41.1 - Mar 10, 2023
2+
3+
#### :chart_with_upwards_trend: Improvements
4+
5+
- Zephyr / nRF-Connect SDK:
6+
- Improve compatibility with Zephyr pre-3.0 deferred logging, when using the
7+
Memfault backend
8+
- Add an option to the [examples/nrf-connect/nrf5](examples/nrf-connect/nrf5)
9+
to enable capturing all of RAM in a coredump.
10+
111
### Changes between Memfault SDK 0.41.1 and SDK 0.41.0 - Mar 1, 2023
212

313
#### :chart_with_upwards_trend: Improvements
414

5-
- Zephyr / nRF-Connect SDk:
15+
- Zephyr / nRF-Connect SDK:
616

717
- Fix a bug 🐛 in the Memfault Logging backend, that causes coredump saving to
818
fail when building with Zephyr versions before 3.0 (nRF-Connect SDK < 2.0).

VERSION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
BUILD ID: 1633
2-
GIT COMMIT: 12ef0db7f
1+
BUILD ID: 1696
2+
GIT COMMIT: e44b190c9

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

2424
#ifdef __cplusplus
2525
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/* gotta go fast 🐎 */
2+
&uart0 {
3+
current-speed = <1000000>;
4+
};
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
menu "MEMFAULT_APP"
3+
4+
config MEMFAULT_APP_CAPTURE_ALL_RAM
5+
bool "Capture all RAM"
6+
help
7+
Capture all RAM regions. This is useful for debugging purposes, but
8+
will increase the amount of data captured by the Memfault SDK.
9+
10+
# If MEMFAULT_APP_CAPTURE_ALL_RAM is enabled, increase the configured space
11+
# for the Memfault storage partition to accommodate the larger coredump.
12+
#
13+
# This overrides the default setting, which can be found here:
14+
# https://github.com/nrfconnect/sdk-nrf/blob/96f97684565fbf711f1ceb7da061fed0bfe7b60b/modules/memfault-firmware-sdk/Kconfig#L170-L172
15+
#
16+
# Expanded into the template here:
17+
# https://github.com/nrfconnect/sdk-nrf/blob/96f97684565fbf711f1ceb7da061fed0bfe7b60b/subsys/partition_manager/Kconfig.template.partition_size
18+
#
19+
# Keep 'source "Kconfig.zephyr"' at the end of this file so this default takes
20+
# precendence.
21+
config PM_PARTITION_SIZE_MEMFAULT_STORAGE
22+
hex "Size of the Memfault storage partition"
23+
# The default size is set to one page above the total RAM size on the
24+
# NRF52840 SOC, which provides room for the coredump header and NVIC and CPU
25+
# registers. This size needs to be flash page-aligned ("minimum eraseable
26+
# unit").
27+
default 0x41000 if MEMFAULT_APP_CAPTURE_ALL_RAM
28+
29+
endmenu
30+
31+
source "Kconfig.zephyr"

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ CONFIG_MEMFAULT=y
1212

1313
# Use internal flash to store the coredump
1414
CONFIG_MEMFAULT_NCS_INTERNAL_FLASH_BACKED_COREDUMP=y
15-
CONFIG_PM_PARTITION_SIZE_MEMFAULT_STORAGE=0x20000
1615

1716
# set a dummy project key; this setting is required by the nrf-connect
1817
# integration, but it is unused in a non-HTTP application

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ char *prv_conditional_log_strdup(char *str) {
2828

2929
return str;
3030
}
31+
3132
static void prv_set_device_id(void) {
3233
uint8_t dev_id[16] = {0};
3334
char dev_id_str[sizeof(dev_id) * 2 + 1];
@@ -53,6 +54,18 @@ static void prv_set_device_id(void) {
5354
memfault_ncs_device_id_set(dev_str, length * 2);
5455
}
5556

57+
#if CONFIG_MEMFAULT_APP_CAPTURE_ALL_RAM
58+
// capture *ALL* of ram
59+
const sMfltCoredumpRegion *memfault_platform_coredump_get_regions(
60+
const sCoredumpCrashInfo *crash_info, size_t *num_regions) {
61+
static sMfltCoredumpRegion s_regions[] = {
62+
MEMFAULT_COREDUMP_MEMORY_REGION_INIT(CONFIG_PM_SRAM_BASE, CONFIG_PM_SRAM_SIZE),
63+
};
64+
*num_regions = ARRAY_SIZE(s_regions);
65+
return s_regions;
66+
}
67+
#endif // CONFIG_MEMFAULT_APP_CAPTURE_ALL_RAM
68+
5669
#define WD_FEED_THREAD_STACK_SIZE 500
5770
// set priority to lowest application thread; shell_uart, where the 'mflt test
5871
// hang' command runs from, uses the same priority by default, so this should

ports/freertos/src/memfault_freertos_ram_regions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
//! _sbss = . ;
1717
//! __bss_start__ = _sbss;
1818
//! __memfault_capture_bss_start = .;
19-
//! *tasks.o(.bss COMMON .bss*)
19+
//! *tasks*.o(.bss COMMON .bss*)
2020
//! *timers*.o(.bss COMMON .bss*)
2121
//! __memfault_capture_bss_end = .;
2222
//!

ports/zephyr/common/memfault_logging.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,15 @@ typedef struct MfltLogProcessCtx {
8080

8181
static void prv_log_process(const struct log_backend *const backend,
8282
union log_msg_generic *msg) {
83+
// This can be called in IMMEDIATE mode from an ISR, so in that case,
84+
// immediately bail. We currently can't safely serialize to the Memfault
85+
// buffer from ISR context
86+
#if CONFIG_LOG_MODE_IMMEDIATE
87+
if (memfault_arch_is_inside_isr()) {
88+
return;
89+
}
90+
#endif
91+
8392
// Copied flagging from Zephry's ring buffer (rb) implementation.
8493
const uint32_t flags = IS_ENABLED(CONFIG_LOG_BACKEND_FORMAT_TIMESTAMP)
8594
? LOG_OUTPUT_FLAG_FORMAT_TIMESTAMP | LOG_OUTPUT_FLAG_LEVEL

scripts/mflt-build-id/README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Memfault Build ID Tool
2+
3+
This package contains the `mflt_build_id` CLI tool.
4+
5+
The purpose of the tool is simplify reading or writing
6+
[Build IDs](https://interrupt.memfault.com/blog/gnu-build-id-for-firmware) in a
7+
firmware image irrespective of the compiler or build system being used in a
8+
project.
9+
10+
## Example Usage
11+
12+
```
13+
$ mflt_build_id --help
14+
usage: mflt_build_id [-h] [--dump [DUMP]] [--crc CRC] [--sha1 SHA1] elf
15+
16+
Inspects provided ELF for a Build ID and when missing adds one if possible.
17+
18+
If a pre-existing Build ID is found (either a GNU Build ID or a Memfault Build ID),
19+
no action is taken.
20+
21+
If no Build ID is found, this script will generate a unique ID by computing a SHA1 over the
22+
contents that will be in the final binary. Once computed, the build ID will be "patched" into a
23+
read-only struct defined in memfault-firmware-sdk/components/core/src/memfault_build_id.c to hold
24+
the info.
25+
26+
If the --crc <symbol_holding_crc32> argument is used, instead of populating the Memfault Build ID
27+
structure, the symbol specified will be updated with a CRC32 computed over the contents that will
28+
be in the final binary.
29+
30+
If the --sha1 <symbol_holding_sha> argument is used, instead of populating the Memfault Build ID
31+
structure, the symbol specified will be updated directly with Memfault SHA1 using the same strategy
32+
discussed above. The only expectation in this mode is that a global symbol has been defined as follow:
33+
34+
const uint8_t g_your_symbol_build_id[20] = { 0x1, };
35+
36+
For further reading about Build Ids in general see:
37+
https://mflt.io//symbol-file-build-ids
38+
39+
positional arguments:
40+
elf
41+
42+
options:
43+
-h, --help show this help message and exit
44+
--dump [DUMP]
45+
--crc CRC
46+
--sha1 SHA1
47+
```

0 commit comments

Comments
 (0)