Skip to content

Commit

Permalink
Memfault Firmware SDK 0.31.4 (Build 478452)
Browse files Browse the repository at this point in the history
  • Loading branch information
Memfault Inc committed Jul 19, 2022
1 parent ae5b690 commit 6f3f1c2
Show file tree
Hide file tree
Showing 21 changed files with 131 additions and 481 deletions.
34 changes: 34 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,37 @@
### Changes between Memfault SDK 0.31.4 and SDK 0.31.3 - July 19, 2022

#### :chart_with_upwards_trend: Improvements

- ESP32 port: add new Kconfig option, `CONFIG_MEMFAULT_AUTOMATIC_INIT`, that can
be explicitly set to `n` to skip automatically initializing the Memfault SDK
on boot. This can be useful if Memfault SDK initialization needs to be
deferred to application start.

- Zephyr port: add Kconfig options,
`CONFIG_MEMFAULT_INIT_PRIORITY`/`CONFIG_MEMFAULT_INIT_LEVEL_POST_KERNEL` for
controlling the Memfault SDK initialization level and priority. This can be
useful when needing Memfault to initialize earlier in the system startup
sequence, for example for diagnosing crashes in an early driver
initialization.

- Partial support, still in progress, for NRF Connect SDK + Zephyr v3.1:
- Remove reference to the now-removed Kconfig symbol,
`NET_SOCKETS_OFFLOAD_TLS` to enable building without warnings. **NOTE:** if
mbedtls is enabled (`CONFIG_MBEDTLS=y`), but is _not_ being used for HTTP
transfers (eg, mbedtls is used for security functions, but the device does
not use HTTP for transferring data), it may be necessary to explicitly set
`CONFIG_MEMFAULT_HTTP_USES_MBEDTLS=n`.

#### :house: Internal

- Zephyr port: remove an unused header file,
`ports/zephyr/common/memfault_zephyr_http.h`

- Remove `memfault_demo_cli_cmd_print_chunk()` demo function.
`memfault_data_export_dump_chunks()` can be used instead, which is intended to
be used with the "Chunks Debug" UI in the Memfault web application- see
[here](https://mflt.io/chunk-data-export) for more details

### Changes between Memfault SDK 0.31.3 and SDK 0.31.2 - July 8, 2022

#### :chart_with_upwards_trend: Improvements
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: 474047
GIT COMMIT: 74c12c38c
BUILD ID: 478452
GIT COMMIT: 56592ceef
149 changes: 0 additions & 149 deletions components/demo/src/memfault_demo_cli_print_chunk.c

This file was deleted.

6 changes: 0 additions & 6 deletions components/include/memfault/demo/cli.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,6 @@ int memfault_demo_cli_cmd_get_core(int argc, char *argv[]);
//! It takes no arguments.
int memfault_demo_cli_cmd_post_core(int argc, char *argv[]);

//! Command to print out the next Memfault data to send and print as a curl command.
//! It takes zero or one string argument, which can be:
//! - curl : (default) prints a shell command to post the next data chunk to Memfault's API (using echo, xxd and curl)
//! - hex : hexdumps the data
int memfault_demo_cli_cmd_print_chunk(int argc, char *argv[]);

//! Command to clear a coredump.
//! It takes no arguments.
int memfault_demo_cli_cmd_clear_core(int argc, char *argv[]);
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 = 31, .patch = 3 }
#define MEMFAULT_SDK_VERSION { .major = 0, .minor = 31, .patch = 4 }

#ifdef __cplusplus
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ static void prv_initialize_task_watchdog(void) {

// This task started by cpu_start.c::start_cpu0_default().
void app_main() {
#if !CONFIG_MEMFAULT_AUTOMATIC_INIT
memfault_boot();
#endif
extern void memfault_platform_device_info_boot(void);
memfault_platform_device_info_boot();
g_unaligned_buffer = &s_my_buf[1];
Expand Down
1 change: 0 additions & 1 deletion examples/wiced/apps/memfault_demo_app/memfault_demo_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ static const command_t commands[] = {
{"get_core", memfault_demo_cli_cmd_get_core, 0, NULL, NULL, NULL, "Get coredump info"},
{"clear_core", memfault_demo_cli_cmd_clear_core, 0, NULL, NULL, NULL, "Clear an existing coredump"},
{"post_core", memfault_demo_cli_cmd_post_core, 0, NULL, NULL, NULL, "Post coredump to Memfault"},
{"print_chunk", memfault_demo_cli_cmd_print_chunk, 0, NULL, NULL, "[curl|hex]", "Get next Memfault data chunk to send and print as a curl command"},
{"crash", memfault_demo_cli_cmd_crash, 1, NULL, NULL, "<type>"ESCAPE_SPACE_PROMPT, "Trigger a crash"},

{"get_core_region", prv_get_core_region, 0, NULL, NULL, NULL, "Get coredump SPI region info"},
Expand Down
1 change: 0 additions & 1 deletion examples/wiced/libraries/memfault/demo/demo.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ NAME := MemfaultDemo

$(NAME)_SOURCES := \
src/http/memfault_demo_http.c \
src/memfault_demo_cli_print_chunk.c \
src/memfault_demo_core.c \
src/panics/memfault_demo_cli_aux.c \
src/panics/memfault_demo_panics.c
Expand Down
8 changes: 8 additions & 0 deletions ports/esp_idf/memfault/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,12 @@ menu "Memfault"
defined in a partitions*.csv file. If the device has already
been shipped and the partition table cannot be modified, an
OTA slot can be used instead.

config MEMFAULT_AUTOMATIC_INIT
bool "Automatically initialize the SDK when the system is booted"
default y
help
By default, Memfault will automatically initialize the SDK
when the system is booted. This can be disabled if the user
wants to initialize the SDK manually.
endmenu
10 changes: 8 additions & 2 deletions ports/esp_idf/memfault/common/memfault_platform_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,7 @@ static int prv_memfault_log_wrapper(const char *fmt, va_list args) {
return vprintf(fmt, args);
}

// register an initialization routine that will be run from do_global_ctors()
static void __attribute__((constructor)) prv_memfault_boot(void) {
void memfault_boot(void) {
s_memfault_lock = xSemaphoreCreateRecursiveMutex();

// set up log collection so recent logs can be viewed in coredump
Expand All @@ -172,3 +171,10 @@ static void __attribute__((constructor)) prv_memfault_boot(void) {
memfault_register_cli();
#endif
}

#if CONFIG_MEMFAULT_AUTOMATIC_INIT
// register an initialization routine that will be run from do_global_ctors()
static void __attribute__((constructor)) prv_memfault_boot(void) {
memfault_boot();
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,6 @@ void memfault_register_cli(void) {
.func = memfault_demo_cli_cmd_get_device_info,
}));

ESP_ERROR_CHECK( esp_console_cmd_register(&(esp_console_cmd_t) {
.command = "print_chunk",
.help = "Get next Memfault data chunk to send and print as a curl command",
.hint = "curl | hex",
.func = memfault_demo_cli_cmd_print_chunk,
}));
ESP_ERROR_CHECK( esp_console_cmd_register(&(esp_console_cmd_t) {
.command = "export",
.help = "Can be used to dump chunks to console or post via GDB",
Expand Down
9 changes: 9 additions & 0 deletions ports/esp_idf/memfault/include/memfault/esp_port/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ bool memfault_esp_port_data_available(void);
//! @return true if the buffer was filled, false otherwise
bool memfault_esp_port_get_chunk(void *buf, size_t *buf_len);

//! Intializes the Memfault system, and should be called one time at boot.
//!
//! Note: by default this is called from the system initialization sequence-
//! it's placed into the global constructor table during compilation, and
//! executed by the esp-idf initialization code. Optionally it can instead be
//! explictly called during application startup by setting
//! 'CONFIG_MEMFAULT_AUTOMATIC_INIT=n' in the project Kconfig options.
void memfault_boot(void);

#ifdef __cplusplus
}
#endif
19 changes: 17 additions & 2 deletions ports/zephyr/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,13 @@ config MEMFAULT_HTTP_PERIODIC_UPLOAD_INTERVAL_SECS

config MEMFAULT_HTTP_USES_MBEDTLS
bool "Use mbedTLS for HTTP transport"
default y if !NET_SOCKETS_OFFLOAD_TLS && MBEDTLS
default y if MBEDTLS
help
Configure Memfault HTTP for using mbedTLS- perform some sanity checks
at compile time that it is configured correctly.
at compile time that it is configured correctly. Note that if MbedTLS
is used for purposes other than securing the TCP/IP sockets, i.e. if
TLS is offloaded to the underlying socket, this check is invalid, and
should be explicitly set to 'n'.

endif # MEMFAULT_HTTP_ENABLE

Expand Down Expand Up @@ -274,6 +277,18 @@ config MEMFAULT_SOFTWARE_WATCHDOG_TIMEOUT_SECS
int "The time, in seconds, to configure the software watchdog expiration for"
default 15

config MEMFAULT_INIT_PRIORITY
int "The priority of Memfault initialization on system start"
default KERNEL_INIT_PRIORITY_DEFAULT
help
The SYS_INIT relative priority for Memfault initialization.

config MEMFAULT_INIT_LEVEL_POST_KERNEL
bool "Use POST_KERNEL init level for Memfault initialization"
default n
help
Set the Memfault initialization SYS_INIT priority level to
"POST_KERNEL". Default is "APPLICATION".

rsource "ncs/Kconfig"

Expand Down
8 changes: 7 additions & 1 deletion ports/zephyr/common/memfault_platform_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,10 @@ static int prv_init_and_log_reboot() {
return 0;
}

SYS_INIT(prv_init_and_log_reboot, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
SYS_INIT(prv_init_and_log_reboot,
#if CONFIG_MEMFAULT_INIT_LEVEL_POST_KERNEL
POST_KERNEL,
#else
APPLICATION,
#endif
CONFIG_MEMFAULT_INIT_PRIORITY);
Loading

0 comments on commit 6f3f1c2

Please sign in to comment.