Skip to content

Commit

Permalink
Memfault Firmware SDK 1.7.2 (Build 6714)
Browse files Browse the repository at this point in the history
  • Loading branch information
Memfault Inc committed Mar 9, 2024
1 parent d7ca406 commit dae1917
Show file tree
Hide file tree
Showing 13 changed files with 107 additions and 29 deletions.
48 changes: 48 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,53 @@
# Memfault Firmware SDK Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.7.2] - 2024-03-09

### :chart_with_upwards_trend: Improvements

- General:

- The Memfault Self Test component boot check now prints all components that
are booted (previously only un-booted components would print):

```plaintext
MFLT:[INFO] =============================
MFLT:[INFO] Component Boot Test
MFLT:[INFO] =============================
MFLT:[INFO] Component | Booted?|
MFLT:[INFO] -----------------------------
MFLT:[INFO] Event Storage | yes|
MFLT:[INFO] Logging | yes|
MFLT:[INFO] Reboot Tracking | yes|
MFLT:[INFO] Trace Event | yes|
MFLT:[INFO] All components booted
MFLT:[INFO] =============================
```
- Restore the Memfault Demo CLI `heartbeat` command, which was unintentionally
removed in v1.7.1. This command triggers a heartbeat on-demand, for testing
heartbeat functionality.
- Zephyr:
- A few minor changes to support the upcoming Zephyr 3.6 release, specifically
for devices that use mbedTLS for TLS connections.
- ESP-IDF:
- v1.7.0 of the SDK added a Kconfig flag to enabled Compact Logs,
`CONFIG_MEMFAULT_COMPACT_LOG_ENABLE`. Updating from older versions of the
SDK would require opting in to that option, even if Compact Logging was
enabled via the Memfault config flag, `MEMFAULT_COMPACT_LOG_ENABLE`.
Instead, support enabling Compact Logs both via the Memfault config flag or
the Kconfig flag, to require no changes when updating the SDK for existing
users.
## [1.7.1] - 2024-02-28
### :chart_with_upwards_trend: Improvements
Expand Down
6 changes: 3 additions & 3 deletions VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
BUILD ID: 6524
GIT COMMIT: 14c45caf49
VERSION: 1.7.1
BUILD ID: 6714
GIT COMMIT: 1d29e68571
VERSION: 1.7.2
4 changes: 3 additions & 1 deletion components/core/src/memfault_self_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ uint32_t memfault_self_test_component_boot_test(void) {
MEMFAULT_LOG_INFO("-----------------------------");
for (size_t i = 0; i < MEMFAULT_ARRAY_SIZE(s_boot_components); i++) {
bool booted = s_boot_components[i].booted();
if (!booted) {
if (booted) {
MEMFAULT_LOG_INFO("%-16s|%8s|", s_boot_components[i].component_name, "yes");
} else {
MEMFAULT_LOG_ERROR("%-16s|%8s|", s_boot_components[i].component_name, "no");
result |= (1 << i);
}
Expand Down
1 change: 1 addition & 0 deletions components/demo/src/memfault_demo_shell_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ static const sMemfaultShellCommand s_memfault_shell_commands[] = {
{ "get_core", memfault_demo_cli_cmd_get_core, "Get coredump info" },
{ "get_device_info", memfault_demo_cli_cmd_get_device_info, "Get device info" },
{ "coredump_size", memfault_demo_cli_cmd_coredump_size, "Print the coredump storage capacity" },
{ "heartbeat", memfault_demo_cli_cmd_heartbeat, "Trigger a heartbeat" },
{ "metrics_dump", memfault_demo_cli_cmd_metrics_dump,
"Dump current heartbeat or session metrics" },
//
Expand Down
4 changes: 2 additions & 2 deletions components/include/memfault/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ typedef struct {
uint8_t patch;
} sMfltSdkVersion;

#define MEMFAULT_SDK_VERSION { .major = 1, .minor = 7, .patch = 1 }
#define MEMFAULT_SDK_VERSION_STR "1.7.1"
#define MEMFAULT_SDK_VERSION { .major = 1, .minor = 7, .patch = 2 }
#define MEMFAULT_SDK_VERSION_STR "1.7.2"

#ifdef __cplusplus
}
Expand Down
2 changes: 1 addition & 1 deletion examples/esp32/apps/memfault_demo_app/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ CONFIG_MEMFAULT_ASSERT_ON_ALLOC_FAILURE=y
CONFIG_MEMFAULT_REBOOT_REASON_CUSTOM_ENABLE=y

# Enable compact logging
CONFIG_MEMFAULT_ENABLE_COMPACT_LOGGING=y
CONFIG_MEMFAULT_COMPACT_LOG_ENABLE=y
4 changes: 4 additions & 0 deletions examples/freertos/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ CFLAGS += \
-Og \
-MD \

# Enable the self test by default
MEMFAULT_DEMO_CLI_SELF_TEST ?= 1
CFLAGS += -DMEMFAULT_DEMO_CLI_SELF_TEST=$(MEMFAULT_DEMO_CLI_SELF_TEST)

LINKER_SCRIPT = $(BOARD_DIR)/linker.ld

LDFLAGS += \
Expand Down
4 changes: 4 additions & 0 deletions examples/zephyr/qemu/qemu-app/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ CONFIG_ASSERT=y
# Enable Memfault Compact Logs
CONFIG_MEMFAULT_COMPACT_LOG=y

# Enable Memfault self test
CONFIG_MEMFAULT_SHELL_SELF_TEST=y
CONFIG_MEMFAULT_SHELL_SELF_TEST_COREDUMP_STORAGE=y

# Enable emulated RTC driver. Disabled by default because the RTC need to be
# explicitly updated at runtime to wall clock time, otherwise it will print
# errors.
Expand Down
2 changes: 1 addition & 1 deletion examples/zephyr/qemu/qemu-app/west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ manifest:
projects:
- name: zephyr
remote: zephyrproject-rtos
revision: v3.5.0
revision: v3.6.0
import:
# Limit the Zephyr modules to the required set
name-allowlist:
Expand Down
24 changes: 15 additions & 9 deletions ports/esp_idf/memfault/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,21 @@ if(CONFIG_MEMFAULT_MBEDTLS_METRICS)
target_link_libraries(${this_component} INTERFACE "-Wl,--wrap=mbedtls_calloc -Wl,--wrap=mbedtls_free")
endif()

# Include a linker script fragment to support compact logs, when enabled
if(CONFIG_MEMFAULT_COMPACT_LOG_ENABLE)
get_filename_component(compact_log_linker_script ${MEMFAULT_ESP_IDF_PORT_COMMON}/memfault_compact_log.ld ABSOLUTE)
target_link_libraries(
${this_component}
INTERFACE
-T ${compact_log_linker_script}
)
endif()
# Include a linker script fragment to support compact logs unconditionally. It's
# Include a linker script fragment to support compact logs unconditionally. It's
# only populated if compact logs are enabled, and otherwise is ignored. We keep
# it unconditionally included for backwards compatibility, so users updating the
# SDK don't need to change any build configuration.
get_filename_component(compact_log_linker_script ${MEMFAULT_ESP_IDF_PORT_COMMON}/memfault_compact_log.ld ABSOLUTE)
target_link_libraries(
${this_component}
INTERFACE
# Note: there is intentionally no space between -T and the linker script
# file name. This is required for PlatformIO compatibility- the PlatformIO
# build system inserts arguments into the linker command line, so we need to
# make sure it can't separate the -T and the linker script file name.
-T${compact_log_linker_script}
)

# Link required libraries and add compiler flags to enable FreeRTOS region collection
# in >= 4.4.3. Note: CMake does not short-circuit logic statements, nested ifs required
Expand Down
13 changes: 2 additions & 11 deletions ports/zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,6 @@ if(CONFIG_MEMFAULT)
# Add Memfault SDK sources to memfault library
zephyr_interface_library_named(memfault)
zephyr_library()
# Memfault uses strnlen, which is defined by a POSIX extension to libc.
# Normally we would just set -std=gnu11 and be done, but Zephyr requires
# setting _ANSI_SOURCE for newlib/picolibc due to clashes with the posix
# functions provided with these libraries. With _ANSI_SOURCE defined, the
# normal -std flag does not pull in the strnlen definition from
# newlib/picolibc; a workaround is to define _POSIX_C_SOURCE=200809L. Note
# that in order to avoid compiler warnings, we need to apply this selectively;
# PICOLIBC enables this already.
if (CONFIG_NEWLIB_LIBC)
zephyr_library_compile_definitions(_POSIX_C_SOURCE=200809L)
endif()

zephyr_library_sources(${MEMFAULT_COMPONENTS_SRCS})
zephyr_include_directories(
Expand Down Expand Up @@ -72,6 +61,8 @@ if(CONFIG_MEMFAULT)
zephyr_library_link_libraries(memfault)
target_link_libraries(memfault INTERFACE zephyr_interface)

zephyr_library_link_libraries_ifdef(CONFIG_MBEDTLS mbedTLS)

# The Zephyr includes moved from /include to /include/zephyr in Zephyr 3.2:
# https://github.com/zephyrproject-rtos/zephyr/commit/53ef68d4598b2f9005c5da3fc0b860ca1999d350
# Add the old path for backwards compatibility. Note that Zephyr itself
Expand Down
6 changes: 5 additions & 1 deletion ports/zephyr/common/memfault_platform_http.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@
// enable it by default

#if !defined(MBEDTLS_CONFIG_FILE)
#include "mbedtls/config.h"
#if MEMFAULT_ZEPHYR_VERSION_GT(3, 5)
#include <mbedtls/build_info.h>
#else
#include "mbedtls/config.h"
#endif
#else
#include MBEDTLS_CONFIG_FILE
#endif
Expand Down
18 changes: 18 additions & 0 deletions tests/src/test_memfault_self_test_component_boot_check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ TEST(MemfaultSelfTestComponentBooted, Test_ComponentBootSingleBoot) {
const char *error_output_lines[] = {
"Event Storage | no|",
"Logging | no|",
};
const char *info_output_lines[] = {
"Reboot Tracking | yes|",
};
const char *error_output_lines2[] = {
"Trace Event | no|",
};
// clang-format on
Expand All @@ -91,6 +96,10 @@ TEST(MemfaultSelfTestComponentBooted, Test_ComponentBootSingleBoot) {
MEMFAULT_ARRAY_SIZE(output_lines));
memfault_platform_log_set_mock(kMemfaultPlatformLogLevel_Error, error_output_lines,
MEMFAULT_ARRAY_SIZE(error_output_lines));
memfault_platform_log_set_mock(kMemfaultPlatformLogLevel_Info, info_output_lines,
MEMFAULT_ARRAY_SIZE(info_output_lines));
memfault_platform_log_set_mock(kMemfaultPlatformLogLevel_Error, error_output_lines2,
MEMFAULT_ARRAY_SIZE(error_output_lines2));

mock().expectOneCall("memfault_event_storage_booted").andReturnValue(false);
mock().expectOneCall("memfault_log_booted").andReturnValue(false);
Expand All @@ -111,10 +120,19 @@ TEST(MemfaultSelfTestComponentBooted, Test_ComponentBootAllBooted) {
"All components booted",
MEMFAULT_SELF_TEST_END_OUTPUT,
};

const char *info_output_lines[] = {
"Event Storage | yes|",
"Logging | yes|",
"Reboot Tracking | yes|",
"Trace Event | yes|",
};
// clang-format on

memfault_platform_log_set_mock(kMemfaultPlatformLogLevel_Info, output_lines,
MEMFAULT_ARRAY_SIZE(output_lines));
memfault_platform_log_set_mock(kMemfaultPlatformLogLevel_Info, info_output_lines,
MEMFAULT_ARRAY_SIZE(info_output_lines));

mock().expectOneCall("memfault_event_storage_booted").andReturnValue(true);
mock().expectOneCall("memfault_log_booted").andReturnValue(true);
Expand Down

0 comments on commit dae1917

Please sign in to comment.