Skip to content

Commit

Permalink
Memfault Firmware SDK 0.24.1 (Build 290406)
Browse files Browse the repository at this point in the history
  • Loading branch information
Memfault Inc committed Aug 10, 2021
1 parent 3973d90 commit 1b88521
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 21 deletions.
50 changes: 40 additions & 10 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,55 @@
### Changes between Memfault SDK 0.24.1 and SDK 0.24.0 - August 9, 2021

#### :chart_with_upwards_trend: Improvements

- Applied suggestions from @elliot-wdtl for the Zephyr ports
([#15](https://github.com/memfault/memfault-firmware-sdk/pull/15)):
- Updated software watchdog port to make use of `MEMFAULT_SOFTWARE_WATCHDOG`
macro
- Applied suggestions from @ioannisg & @mbolivar-nordic in
([#14](https://github.com/memfault/memfault-firmware-sdk/pull/14)) to change
the KConfig options used to select `CONFIG_MEMFAULT_HTTP_ENABLE` &
`CONFIG_MEMFAULT_ROOT_CERT_STORAGE_NRF9160_MODEM` &
`CONFIG_MEMFAULT_NRF_CONNECT_SDK` when using nRF91 targets.

#### :house: Internal

- Added `export` command to the demo cli to better mirror
[our suggested integration test commands](https://mflt.io/mcu-test-commands)

#### :boom: Breaking Changes

- If you are were using a custom nRF91 based board config (i.e neither
`BOARD_NRF9160DK_NRF9160NS` or `BOARD_THINGY91_NRF9160NS`), the following
KConfig options will now be enabled by default. The following can be added to
your `prj.conf` to restore the original behavior:
- `CONFIG_MEMFAULT_HTTP_ENABLE=n`
- `CONFIG_MEMFAULT_NRF_CONNECT_SDK=n`
- `CONFIG_MEMFAULT_ROOT_CERT_STORAGE_TLS_CREDENTIAL_STORAGE=y`

### Changes between Memfault SDK 0.24.0 and SDK 0.23.0 - July 27, 2021

#### :chart_with_upwards_trend: Improvements

- Added "compact log" support to trace events. When enabled, the format string will be removed at
compile time from calls to `MEMFAULT_TRACE_EVENT_WITH_LOG` and an integer along with arguments
will be serialized instead. The actual string will recovered and formatted when it arrives in the
Memfault cloud. This leads to a massive reduction in space & bandwidth needed to send trace
- Added "compact log" support to trace events. When enabled, the format string
will be removed at compile time from calls to `MEMFAULT_TRACE_EVENT_WITH_LOG`
and an integer along with arguments will be serialized instead. The actual
string will recovered and formatted when it arrives in the Memfault cloud.
This leads to a massive reduction in space & bandwidth needed to send trace
events. For more details about how to set up,
[check out this guide!](https://mflt.io/compact-logs)
- Fixed a `-Wshadow` compiler error that would arise in
[`memfault_coredump_regions_armv7.c`](components/panics/src/memfault_coredump_regions_armv7.c) when
`MEMFAULT_COLLECT_MPU_STATE` was enabled
[`memfault_coredump_regions_armv7.c`](components/panics/src/memfault_coredump_regions_armv7.c)
when `MEMFAULT_COLLECT_MPU_STATE` was enabled
- Updated debug print utility in
[`memfault_coredump_storage_debug.c`](components/panics/src/memfault_coredump_storage_debug.c) to
guard against potentially printing an uninitialized string.
[`memfault_coredump_storage_debug.c`](components/panics/src/memfault_coredump_storage_debug.c)
to guard against potentially printing an uninitialized string.
- Removed unnecessary extra argument from `MEMFAULT_SOFTWARE_WATCHDOG`

#### :boom: Breaking Changes

- If you were already using `MEMFAULT_SOFTWARE_WATCHDOG`, you will need to update your call site
invocations to remove the argument being passed. i.e
- If you were already using `MEMFAULT_SOFTWARE_WATCHDOG`, you will need to
update your call site invocations to remove the argument being passed. i.e

```diff
- MEMFAULT_SOFTWARE_WATCHDOG(0);
Expand Down
4 changes: 2 additions & 2 deletions VERSION
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
BUILD ID: 283912
GIT COMMIT: 7f6c0b54c
BUILD ID: 290406
GIT COMMIT: e752751b3
8 changes: 8 additions & 0 deletions components/demo/src/memfault_demo_shell_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "memfault/core/math.h"
#include "memfault/demo/cli.h"
#include "memfault/core/compiler.h"
#include "memfault/core/data_export.h"

static int prv_panics_component_required(void) {
MEMFAULT_LOG_RAW("Disabled. panics component integration required");
Expand All @@ -35,6 +36,12 @@ int memfault_demo_cli_cmd_crash(MEMFAULT_UNUSED int argc, MEMFAULT_UNUSED char *
return prv_panics_component_required();
}

int memfault_demo_cli_cmd_export(MEMFAULT_UNUSED int argc, MEMFAULT_UNUSED char *argv[]) {
memfault_data_export_dump_chunks();

return 0;
}

static const sMemfaultShellCommand s_memfault_shell_commands[] = {
{"get_core", memfault_demo_cli_cmd_get_core, "Get coredump info"},
{"clear_core", memfault_demo_cli_cmd_clear_core, "Clear an existing coredump"},
Expand All @@ -44,6 +51,7 @@ static const sMemfaultShellCommand s_memfault_shell_commands[] = {
{"trace", memfault_demo_cli_cmd_trace_event_capture, "Capture an example trace event"},
{"get_device_info", memfault_demo_cli_cmd_get_device_info, "Get device info"},
{"reboot", memfault_demo_cli_cmd_system_reboot, "Reboot system and tracks it with a trace event"},
{"export", memfault_demo_cli_cmd_export, "Export base64-encoded chunks. To upload data see https://mflt.io/chunk-data-export"},
{"help", memfault_shell_help_handler, "Lists all commands"},
};

Expand Down
4 changes: 4 additions & 0 deletions components/include/memfault/demo/cli.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ int memfault_demo_cli_cmd_system_reboot(int argc, char *argv[]);
int memfault_demo_drain_chunk_data(int argc, char *argv[]);
void user_transport_send_chunk_data(void *chunk_data, size_t chunk_data_len);

//! Output base64 encoded chunks. Chunks can be uploaded via the Memfault CLI or
//! manually via the Chunks Debug in the UI.
int memfault_demo_cli_cmd_export(int argc, char *argv[]);

#ifdef __cplusplus
}
#endif
5 changes: 4 additions & 1 deletion examples/nrf-connect-sdk/nrf9160/memfault_demo_app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ targetting the nRF52 PDK would look like:
```bash
$ west init -l memfault_demo_app
$ west update
$ west build -b nrf9160dk_nrf9160ns memfault_demo_app
$ west build -b nrf9160dk_nrf9160_ns memfault_demo_app
...
[181/181] Linking C executable zephyr/zephyr.elf
```

Note that you will need to use `nrf9160dk_nrf9160ns` instead on
versions of NCS based on Zephyr 2.6 and earlier.

## Testing the Integration

Commands to test the integration are exposed under the `mflt` submenu in the CLI
Expand Down
6 changes: 3 additions & 3 deletions ports/zephyr/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ config MEMFAULT_SHELL

config MEMFAULT_HTTP_ENABLE
bool "Enables support for using Memfault's HTTP APIs"
default y if BOARD_NRF9160DK_NRF9160NS || BOARD_THINGY91_NRF9160NS
default y if SOC_SERIES_NRF91X && TRUSTED_EXECUTION_NONSECURE
help
Enables support for querying the Memfault API for OTA updates
and posting Memfault chunks
Expand All @@ -103,7 +103,7 @@ endif # MEMFAULT_LOGGING_ENABLE

choice
bool "Implementation used to store Memfault Root certificates"
default MEMFAULT_ROOT_CERT_STORAGE_NRF9160_MODEM if BOARD_NRF9160DK_NRF9160NS || BOARD_THINGY91_NRF9160NS
default MEMFAULT_ROOT_CERT_STORAGE_NRF9160_MODEM if SOC_SERIES_NRF91X && TRUSTED_EXECUTION_NONSECURE
default MEMFAULT_ROOT_CERT_STORAGE_TLS_CREDENTIAL_STORAGE

config MEMFAULT_ROOT_CERT_STORAGE_NRF9160_MODEM
Expand Down Expand Up @@ -260,4 +260,4 @@ config MEMFAULT_SOFTWARE_WATCHDOG_TIMEOUT_SECS

rsource "ncs/Kconfig"

endif # MEMFAULT
endif # MEMFAULT
10 changes: 8 additions & 2 deletions ports/zephyr/common/memfault_logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,13 @@ static void prv_log_put_sync_string(const struct log_backend *const backend,
struct log_msg_ids src_level, uint32_t timestamp,
const char *fmt, va_list ap);
static void prv_log_panic(struct log_backend const *const backend);
static void prv_log_init(void);


// The function signature for struct log_backend_api init changed between Zephyr 2.5 and Zephyr 2.6
// and we don't use any of the parameters so we leave the parameter list empty to mitigate
// -Wincompatible-pointer-types between versions
static void prv_log_init();

static void prv_log_dropped(const struct log_backend *const backend, uint32_t cnt);
const struct log_backend_api log_backend_mflt_api = {
.put = IS_ENABLED(CONFIG_LOG_IMMEDIATE) ? NULL : prv_log_put,
Expand Down Expand Up @@ -115,7 +121,7 @@ static void prv_log_panic(struct log_backend const *const backend) {
}

// Zephyr will call our init function so we can establish some storage.
static void prv_log_init(void) {
static void prv_log_init() {
// static RAM storage where logs will be stored. Storage can be any size
// you want but you will want it to be able to hold at least a couple logs.
static uint8_t s_mflt_log_buf_storage[CONFIG_MEMFAULT_LOGGING_RAM_SIZE];
Expand Down
2 changes: 1 addition & 1 deletion ports/zephyr/common/memfault_software_watchdog.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <zephyr.h>

static void prv_software_watchdog_timeout(struct k_timer *dummy) {
MEMFAULT_ASSERT(0);
MEMFAULT_SOFTWARE_WATCHDOG();
}

K_TIMER_DEFINE(s_watchdog_timer, prv_software_watchdog_timeout, NULL);
Expand Down
4 changes: 2 additions & 2 deletions ports/zephyr/ncs/Kconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
config MEMFAULT_NRF_CONNECT_SDK
bool "nRF Connect SDK extensions"
default y if BOARD_NRF9160DK_NRF9160NS || BOARD_THINGY91_NRF9160NS
default y if SOC_SERIES_NRF91X && TRUSTED_EXECUTION_NONSECURE
select MEMFAULT_REBOOT_REASON_GET_CUSTOM

if MEMFAULT_NRF_CONNECT_SDK
Expand Down Expand Up @@ -44,4 +44,4 @@ config MEMFAULT_FOTA_DOWNLOAD_CALLBACK_CUSTOM

endif # MEMFAULT_FOTA

endif # MEMFAULT_NRF_CONNECT_SDK
endif # MEMFAULT_NRF_CONNECT_SDK

0 comments on commit 1b88521

Please sign in to comment.