Skip to content

Commit

Permalink
Memfault Firmware SDK 1.3.3 (Build 3838)
Browse files Browse the repository at this point in the history
  • Loading branch information
Memfault Inc committed Oct 10, 2023
1 parent 9f1addb commit c374e92
Show file tree
Hide file tree
Showing 33 changed files with 454 additions and 131 deletions.
62 changes: 59 additions & 3 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,68 @@
# Memfault Firmware SDK Changelog

## 1.3.3 - Oct 10, 2023

### :chart_with_upwards_trend: Improvements

- Zephyr:

- Add a new Kconfig flag, `CONFIG_MEMFAULT_FAULT_HANDLER_RETURN`, which will
call the normal `z_fatal_error` handler at the end of Memfault fault
processing instead of rebooting the system. This is useful when user code
needs to run within `k_sys_fatal_error_handler()` just prior to system
shutdown. Thanks to @JordanYates for the patch! Fixes
[#59](https://github.com/memfault/memfault-firmware-sdk/issues/59).

- Add a timeout to the initial `send()` socket operation in
`memfault_zephyr_port_http_upload_sdk_data()`, to abort the transfer if the
socket is blocking for too long. That function will execute repeated
`send()` calls to drain all the buffered Memfault data; this update only
changes the initial call to check for a timeout, but otherwise will keep
trying until the process completes, or a watchdog triggers. This is to
balance the existing behavior, where a badly performing socket will still
eventually push data through, but improves the case where the socket fails
on the initial send (more common failure mode).

- Remove a nuisance build warning generated when configured with
`CONFIG_LOG_PRINTK=y && CONFIG_LOG_MODE_DEFERRED=y`. This impacts the
usability of exporting base64-encoded chunks on the shell for testing
(`mflt export` command), but is otherwise harmless.

- ESP-IDF:

- Multiple changes to the
[`examples/esp32`](examples/esp32/apps/memfault_demo_app) sample project:

- Disable WiFi SoftAP by setting `CONFIG_ESP_WIFI_SOFTAP_SUPPORT=n`, since
it's unused in the sample app. This saves about 40kB flash.
- Permit setting the Memfault Project Key at runtime, with a new cli command
`project_key`. The key is saved in Non-Volatile Storage on the ESP32
board.

- General:

- Enable using compact logs with the IAR build tools, by adding the needed
`__no_alloc` attribute to the compact log symbols, to have the IAR linker
set the `NO_LOAD` attribute correctly on the compact log output section.

#### :boom: Breaking Changes

- ESP-IDF:

- The [ESP-IDF port](ports/esp_idf/) now implements a default
`memfault_get_device_info()` function, which uses the device MAC address for
the Memfault Device Serial. When updating the Memfault SDK in an existing
project, this implementation will cause a **linker error** due to duplicate
definition. To disable the built-in definition, set
`CONFIG_MEMFAULT_DEFAULT_GET_DEVICE_INFO=n`.

## 1.3.2 - Sept 26, 2023

### :chart_with_upwards_trend: Improvements

- Zephyr:

- use `<cmsis_core.h>` instead of `<nmi.h>`. Thanks @kmeihar for this change!
- use `<cmsis_core.h>` instead of `<nmi.h>`. Thanks @kmeinhar for this change!
(see [#64](https://github.com/memfault/memfault-firmware-sdk/pull/64))

- nRF Connect SDK:
Expand All @@ -21,8 +77,8 @@
- Add support for Memfault Compact Logs for C++ source files (previously only
supported in C source files). Compact logging can be enabled by setting
`MEMFAULT_LOG_COMPACT_ENABLE=1` in `memfault_platform_config.h`. See
[the docs](https://docs.memfault.com/docs/mcu/debugging/compact-logs) for
more details.
[the docs](https://docs.memfault.com/docs/mcu/compact-logs/) for more
details.
- Fix a missing include of `<intrinsics.h>` required by the IAR compiler

## 1.3.1 - Sept 21, 2023
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: 3642
GIT COMMIT: 5eb9f7b6a
VERSION: 1.3.2
BUILD ID: 3838
GIT COMMIT: 86077d06f
VERSION: 1.3.3
1 change: 1 addition & 0 deletions components/core/src/memfault_compact_log_serializer.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ extern uint32_t __start_log_fmt;
//! Note: We don't read this in the firmware but it is used during the decode
//! process to sanity check the section is being laid out as we would expect.
MEMFAULT_PUT_IN_SECTION(".log_fmt_hdr")
MEMFAULT_NO_ALLOC
const sMemfaultLogFmtElfSectionHeader g_memfault_log_fmt_elf_section_hdr = {
.magic = 0x66474f4c, /* LOGf */
.version = 1,
Expand Down
4 changes: 3 additions & 1 deletion components/include/memfault/core/compact_log_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ extern "C" {
//! The metadata we track in the ELF for each compact log in the code.
//! This is used to recover the original information
#define MEMFAULT_LOG_FMT_ELF_SECTION_ENTRY(format, ...) \
MEMFAULT_LOG_FMT_ELF_SECTION static const char _memfault_log_fmt_ptr[] = \
MEMFAULT_LOG_FMT_ELF_SECTION \
MEMFAULT_NO_ALLOC \
static const char _memfault_log_fmt_ptr[] = \
MEMFAULT_EXPAND_AND_QUOTE(MEMFAULT_ARG_COUNT_UP_TO_32(__VA_ARGS__))";" \
__FILE__ ";" MEMFAULT_EXPAND_AND_QUOTE(__LINE__) ";" format
Expand Down
2 changes: 2 additions & 0 deletions components/include/memfault/core/compiler_armcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ extern "C" {
#define MEMFAULT_WEAK __attribute__((weak))
#define MEMFAULT_PRINTF_LIKE_FUNC(a, b)
#define MEMFAULT_CLZ(a) __clz(a)
//! Non-loaded symbols are specified by linker section, not compiler attribute
#define MEMFAULT_NO_ALLOC


#define MEMFAULT_GET_LR(_a) _a = ((void *)__return_address())
Expand Down
3 changes: 3 additions & 0 deletions components/include/memfault/core/compiler_gcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ extern "C" {
//! If x is 0, the result is undefined.
#define MEMFAULT_CLZ(a) ((a == 0) ? 32UL : (uint32_t)__builtin_clz(a))

//! Non-loaded symbols are specified by linker section, not compiler attribute
#define MEMFAULT_NO_ALLOC

#if defined(__arm__)
# define MEMFAULT_GET_LR(_a) _a = __builtin_return_address(0)
# define MEMFAULT_GET_PC(_a) __asm volatile ("mov %0, pc" : "=r" (_a))
Expand Down
1 change: 1 addition & 0 deletions components/include/memfault/core/compiler_iar.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ extern "C" {
#define MEMFAULT_WEAK __weak
#define MEMFAULT_PRINTF_LIKE_FUNC(a, b)
#define MEMFAULT_CLZ(a) __iar_builtin_CLZ(a)
#define MEMFAULT_NO_ALLOC __no_alloc


#define MEMFAULT_GET_LR(_a) __asm volatile ("mov %0, lr" : "=r" (_a))
Expand Down
3 changes: 3 additions & 0 deletions components/include/memfault/core/compiler_ti_arm.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ extern "C" {

#define MEMFAULT_CLZ(a) ((a == 0) ? 32UL : (uint32_t)__clz(a))

//! Non-loaded symbols are specified by linker section, not compiler attribute
#define MEMFAULT_NO_ALLOC

// Compiler incorrectly thinks return value is missing for pure asm function
// disable the check for them
#pragma diag_push
Expand Down
6 changes: 6 additions & 0 deletions components/include/memfault/default_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,12 @@ extern "C" {
#define MEMFAULT_PLATFORM_FAULT_HANDLER_CUSTOM 0
#endif

// If enabled, memfault_fault_handler will return back to OS
// exception handling code instead of rebooting the device.
#ifndef MEMFAULT_FAULT_HANDLER_RETURN
#define MEMFAULT_FAULT_HANDLER_RETURN 0
#endif

//
// Http Configuration Options
//
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 = 3, .patch = 2 }
#define MEMFAULT_SDK_VERSION_STR "1.3.2"
#define MEMFAULT_SDK_VERSION { .major = 1, .minor = 3, .patch = 3 }
#define MEMFAULT_SDK_VERSION_STR "1.3.3"

#ifdef __cplusplus
}
Expand Down
2 changes: 2 additions & 0 deletions components/panics/src/memfault_fault_handling_arm.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,10 @@ void memfault_fault_handler(const sMfltRegState *regs, eMemfaultRebootReason rea
memfault_reboot_tracking_mark_coredump_saved();
}

#if !MEMFAULT_FAULT_HANDLER_RETURN
memfault_platform_reboot();
MEMFAULT_UNREACHABLE;
#endif
}


Expand Down
2 changes: 1 addition & 1 deletion examples/esp32/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ The following steps can be used to exercise OTA functionality:
```

3. Use `idf.py menuconfig` to change the value of
`MEMFAULT_ESP32_MAIN_FIRMWARE_VERSION` config variable to `"1.0.1"`, and
`MEMFAULT_DEVICE_INFO_SOFTWARE_VERSION` config variable to `"1.0.1"`, and
rebuild (`idf.py build`), but don't load it to the device. We'll use this
build as our OTA payload!

Expand Down
1 change: 0 additions & 1 deletion examples/esp32/apps/memfault_demo_app/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ list(APPEND
cmd_system.c
console_example_main.c
led.c
memfault/memfault_platform_device_info.c
)

if (CONFIG_APP_MEMFAULT_TRANSPORT_HTTP)
Expand Down
16 changes: 5 additions & 11 deletions examples/esp32/apps/memfault_demo_app/main/Kconfig.projbuild
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ config STORE_HISTORY
command history. If this option is enabled, initalizes a FAT filesystem
and uses it to store command history.

config MEMFAULT_ESP32_MAIN_FIRMWARE_VERSION
string "Main firmware version"
default "1.0.0-dev"
help
The version of the main firmware. Used when the device reports in as
well as for OTA checks.

config MEMFAULT_APP_OTA
bool "Enable automatic periodic check+update for OTA"
default y
Expand All @@ -39,10 +32,11 @@ choice APP_MEMFAULT_TRANSPORT
select MQTT_PROTOCOL_5
endchoice

config MEMFAULT_APP_SOFTWARE_TYPE
string "Software version for the application"
default "esp32-main-mqtt" if APP_MEMFAULT_TRANSPORT_MQTT
default "esp32-main"
if APP_MEMFAULT_TRANSPORT_MQTT
config MEMFAULT_DEVICE_INFO_SOFTWARE_TYPE
string "Override default software version for the application"
default "esp32-main-mqtt"
endif

# These LED settings are taken from ESP-IDF:
# examples/get-started/blink/main/blink_example_main.c
Expand Down
4 changes: 4 additions & 0 deletions examples/esp32/apps/memfault_demo_app/main/cmd_decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ void register_wifi(void);
bool wifi_join(const char* ssid, const char* pass);
void wifi_load_creds(char** ssid, char** password);

#define MEMFAULT_PROJECT_KEY_LEN 32
__attribute__((access(write_only, 1, 2))) int wifi_get_project_key(char* project_key,
size_t project_key_len);

// Register app-specific console commands
void register_app(void);

Expand Down
Loading

0 comments on commit c374e92

Please sign in to comment.