Skip to content

Commit

Permalink
Memfault Firmware SDK 0.33.2 (Build 512901)
Browse files Browse the repository at this point in the history
  • Loading branch information
Memfault Inc committed Sep 9, 2022
1 parent c59f03f commit 0cf1078
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 11 deletions.
11 changes: 11 additions & 0 deletions .circleci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# This Docker image is used in CircleCI to build the SDK. It's published to
# Docker Hub as "memfault/memfault-sdk-embedded-ci".
#
# It's built with the following command (assuming cwd is the directory
# containing this Dockerfile):
#
# ❯ DOCKER_BUILDKIT=1 docker build -t memfault/memfault-firmware-sdk-ci:<tag> .
#
# And uploaded to Docker Hub:
# ❯ docker push memfault/memfault-firmware-sdk-ci:<tag>

FROM ubuntu:22.04

# Some details based on this Dockerfile:
Expand Down
15 changes: 15 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
### Changes between Memfault SDK 0.33.1 and SDK 0.33.2 - Sept 7, 2022

#### :chart_with_upwards_trend: Improvements

- Zephyr port updates:
- fix a few minor nuisance build warnings on niche Zephyr configurations
- enable `LOG_OUTPUT` when `MEMFAULT_LOGGING_ENABLE` is enabled- this fixes a
build error if all other log backends are disabled. thanks to @balaji-nordic
for this fix! closes #33
- Add a debug cli test command to the nRF-Connect SDK port for printing the OTA
url

### Changes between Memfault SDK 0.33.0 and SDK 0.33.1 - Aug 26, 2022

#### :chart_with_upwards_trend: Improvements
Expand Down Expand Up @@ -89,6 +101,9 @@
"Breaking Changes" below for enabling logs in your project.
- Added a new Kconfig option, `MEMFAULT_ZEPHYR_FATAL_HANDLER`, which can be
used to disable the Zephyr fault handler print facilities.
- Streamline support for nRF-Connect SDK based applications that don't need
the Memfault root certificates (eg nRF53 or nRF52 devices), via a new
Kconfig option `MEMFAULT_ROOT_CERT_STORAGE`, to avoid a nuisance build error

#### :boom: Breaking Changes

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: 503780
GIT COMMIT: ef36b85f7
BUILD ID: 512901
GIT COMMIT: a0c2c2f58
1 change: 1 addition & 0 deletions components/demo/src/memfault_demo_cli_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

int memfault_demo_cli_cmd_test_log(MEMFAULT_UNUSED int argc,
MEMFAULT_UNUSED char *argv[]) {
MEMFAULT_LOG_RAW("Raw log!");
MEMFAULT_LOG_DEBUG("Debug log!");
MEMFAULT_LOG_INFO("Info log!");
MEMFAULT_LOG_WARN("Warning log!");
Expand Down
2 changes: 1 addition & 1 deletion components/include/memfault/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ typedef struct {
uint8_t patch;
} sMfltSdkVersion;

#define MEMFAULT_SDK_VERSION { .major = 0, .minor = 33, .patch = 1 }
#define MEMFAULT_SDK_VERSION { .major = 0, .minor = 33, .patch = 2 }

#ifdef __cplusplus
}
Expand Down
17 changes: 16 additions & 1 deletion examples/nrf-connect-sdk/nrf5/memfault_demo_app/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@

LOG_MODULE_REGISTER(main, LOG_LEVEL_INF);

//! wrapper to enclose logic around log_strdup
char *prv_conditional_log_strdup(char *str) {
#if !MEMFAULT_ZEPHYR_VERSION_GT(3, 1)
#if defined(CONFIG_LOG) && !defined(CONFIG_LOG2)
// Before zephyr 3.1, LOG was a different option from LOG2 and required
// manually duplicating string argument values. Only required if CONFIG_LOG is
// in use.
return log_strdup(str);
#endif
#endif

return str;
}
static void prv_set_device_id(void) {
uint8_t dev_id[16] = {0};
char dev_id_str[sizeof(dev_id) * 2 + 1];
Expand All @@ -33,12 +46,14 @@ static void prv_set_device_id(void) {
dev_str = dev_id_str;
}

LOG_INF("Device ID: %s", dev_str);
LOG_INF("Device ID: %s", prv_conditional_log_strdup(dev_str));

memfault_ncs_device_id_set(dev_str, length * 2);
}

void main(void) {
LOG_INF("Booting Memfault sample app!");

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

Expand Down
2 changes: 2 additions & 0 deletions ports/zephyr/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ config MEMFAULT
select RUNTIME_NMI
select EXTRA_EXCEPTION_INFO
select DEBUG_THREAD_INFO
select LEGACY_INCLUDE_PATH
help
Enable Zephyr Integration with the Memfault SDK
At the moment a port is only provided for Cortex-M based targets
Expand Down Expand Up @@ -113,6 +114,7 @@ config MEMFAULT_LOGGING_ENABLE
bool "MEMFAULT Zephyr backend logging Enable [EXPERIMENTAL]"
default n
select LOG
select LOG_OUTPUT
help
Adds support for routing Zephyr logging calls to the Memfault
logging backend.
Expand Down
1 change: 0 additions & 1 deletion ports/zephyr/common/memfault_logging_legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ static void prv_log_put(const struct log_backend *const backend, struct log_msg
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) {
printk("HERE WE GOOO\n");
if (memfault_arch_is_inside_isr()) {
// In synchronous mode, logging can occur from ISRs. The zephyr fault handlers are chatty so
// don't save info while in an ISR to avoid wrapping over the info we are collecting.
Expand Down
6 changes: 3 additions & 3 deletions ports/zephyr/common/memfault_platform_debug_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ void memfault_platform_log_raw(const char *fmt, ...) {
((KERNEL_VERSION_MAJOR > (major)) || \
((KERNEL_VERSION_MAJOR == (major)) && (KERNEL_VERSION_MINOR >= (minor))))

#if ZEPHYR_VERSION_GTE(3, 0)
char log_buf[MEMFAULT_DEBUG_LOG_BUFFER_SIZE_BYTES];
vsnprintf(log_buf, sizeof(log_buf), fmt, args);
LOG_PRINTK("%s", log_buf);
#if ZEPHYR_VERSION_GTE(3, 0)
LOG_PRINTK("%s\n", log_buf);
#else
log_printk("%s\n", args);
printk("%s\n", log_buf);
#endif

va_end(args);
Expand Down
29 changes: 26 additions & 3 deletions ports/zephyr/ncs/src/memfault_nrf_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include <shell/shell.h>

#include "memfault/core/debug_log.h"

#include "memfault/nrfconnect_port/fota.h"
#include "memfault/ports/zephyr/http.h"

static int prv_mflt_fota(const struct shell *shell, size_t argc, char **argv) {
#if CONFIG_MEMFAULT_FOTA_CLI_CMD
Expand All @@ -23,10 +23,33 @@ static int prv_mflt_fota(const struct shell *shell, size_t argc, char **argv) {
#endif
}

#if CONFIG_MEMFAULT_HTTP_ENABLE
static int prv_mflt_get_latest_url(const struct shell *shell, size_t argc, char **argv) {
char *url = NULL;
int rv = memfault_zephyr_port_get_download_url(&url);
if (rv <= 0) {
MEMFAULT_LOG_ERROR("Unable to fetch OTA url, rv=%d", rv);
return rv;
}

printk("Download URL: '%s'\n", url);

rv = memfault_zephyr_port_release_download_url(&url);

return rv;
}
#endif // CONFIG_MEMFAULT_HTTP_ENABLE

SHELL_STATIC_SUBCMD_SET_CREATE(
sub_memfault_nrf_cmds,
SHELL_CMD(fota, NULL, "Perform a FOTA using Memfault client", prv_mflt_fota),
SHELL_CMD(fota, NULL, "Perform a FOTA using Memfault client",
prv_mflt_fota),
#if CONFIG_MEMFAULT_HTTP_ENABLE
SHELL_CMD(get_latest_url, NULL, "Get the latest URL for the latest FOTA",
prv_mflt_get_latest_url),
#endif
SHELL_SUBCMD_SET_END /* Array terminated. */
);

SHELL_CMD_REGISTER(mflt_nrf, &sub_memfault_nrf_cmds, "Memfault nRF Connect SDK Test Commands", NULL);
SHELL_CMD_REGISTER(mflt_nrf, &sub_memfault_nrf_cmds,
"Memfault nRF Connect SDK Test Commands", NULL);

0 comments on commit 0cf1078

Please sign in to comment.