Skip to content

Commit 3b0fd7c

Browse files
author
Memfault Inc
committed
Memfault Firmware SDK 1.13.0 (Build 10617)
1 parent 47d69c5 commit 3b0fd7c

File tree

15 files changed

+196
-425
lines changed

15 files changed

+196
-425
lines changed

CHANGELOG.md

Lines changed: 60 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,55 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to
77
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
88

9+
## [1.13.0] - 2024-10-07
10+
11+
### 📈 Added
12+
13+
- FreeRTOS:
14+
15+
- The SDK now has a config to control whether to split CPU usage per core when
16+
building for a multi-core device. Enable this setting by adding
17+
`#define MEMFAULT_FREERTOS_RUNTIME_STATS_MULTI_CORE_SPLIT 1` to
18+
`memfault_platform_config.h`. This setting is disabled by default.
19+
20+
- ESP-IDF:
21+
- Added a Kconfig, `CONFIG_MEMFAULT_FREERTOS_RUNTIME_STATS_MULTI_CORE_SPLIT`,
22+
to control `MEMFAULT_FREERTOS_RUNTIME_STATS_MULTI_CORE_SPLIT`. This Kconfig
23+
is enabled by default for multi-core devices.
24+
25+
### 🛠️ Changed
26+
27+
- FreeRTOS:
28+
29+
- Changed previous idle task run time percent metrics to measure CPU usage
30+
(i.e. the complement of the idle task run time)
31+
- Renamed the following metrics:
32+
- Single-Core + Multi-Core Default:
33+
- `idle_task_run_time_percent` -> `cpu_usage_pct`
34+
- Multi-Core Split:
35+
- `idle0_task_run_time_percent` -> `cpu_usage_pct`
36+
- `idle1_task_run_time_percent` -> `cpu1_usage_pct`
37+
38+
- ESP-IDF:
39+
40+
- Unknown or unclassified reboot reason codes returned by `get_reset_reason()`
41+
are now correctly recorded as `kMfltRebootReason_Unknown` instead of
42+
`kMfltRebootReason_UnknownError` (`UnknownError` is reserved for an
43+
"unexpected" reboot path, where `Unknown` is used when the reboot reason
44+
cannot be determined).
45+
46+
### 🚩 Deprecated
47+
48+
Support for the following vendor platform versions is deprecated in this
49+
release, and will be removed in the following release:
50+
51+
- ESP-IDF < `v4.4` (Jan 26, 2022)
52+
- Zephyr < `v2.7.0` (Oct 16, 2021)
53+
- nRF-Connect SDK < `v1.9.2` (Jul 14, 2022)
54+
55+
Please [contact us]([email protected]) if you need support for earlier
56+
versions!
57+
958
## [1.12.0] - 2024-09-25
1059

1160
### 📈 Added
@@ -79,6 +128,17 @@ and this project adheres to
79128

80129
### 📈 Added
81130

131+
- General:
132+
133+
- Add two new core metrics, `MemfaultSdkMetric_os_name` and
134+
`MemfaultSdkMetric_os_version`. These are string metrics that map to the OS
135+
/ platform name and version string respectively, and are included in the the
136+
ELF at build time, and processed out-of-band by Memfault for NCS, Zephyr,
137+
and ESP-IDF. They **are not** ever transmitted over the air (no bandwidth
138+
impact). For example, for Zephyr these metric string values would be
139+
`zephyr` and `3.7.0` for a project on Zephyr v3.7.0. These metrics are
140+
attributes by default and will not be counted towards attribute quotas.
141+
82142
- Zephyr:
83143

84144
- Add the following built-in WiFi metrics for Zephyr devices, enabled by
@@ -162,17 +222,6 @@ and this project adheres to
162222

163223
### 📈 Improvements
164224

165-
- General:
166-
167-
- Add two new core metrics, `MemfaultSdkMetric_os_name` and
168-
`MemfaultSdkMetric_os_version`. These are string metrics that map to the OS
169-
/ platform name and version string respectively, and are included in the the
170-
ELF at build time, and processed out-of-band by Memfault for NCS, Zephyr,
171-
and ESP-IDF. They **are not** ever transmitted over the air (no bandwidth
172-
impact). For example, for Zephyr these metric string values would be
173-
`zephyr` and `3.7.0` for a project on Zephyr v3.7.0. These metrics are
174-
attributes by default and will not be counted towards attribute quotas.
175-
176225
- ESP-IDF:
177226

178227
- Fix a minor issue where MEMFAULT_LOG_x() macros (MEMFAULT_LOG_ERROR() etc )

VERSION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
BUILD ID: 10351
2-
GIT COMMIT: 1d3c51cd48
3-
VERSION: 1.12.0
1+
BUILD ID: 10617
2+
GIT COMMIT: edc2beda42
3+
VERSION: 1.13.0

components/include/memfault/version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ typedef struct {
2020
} sMfltSdkVersion;
2121

2222
#define MEMFAULT_SDK_VERSION \
23-
{ .major = 1, .minor = 12, .patch = 0 }
24-
#define MEMFAULT_SDK_VERSION_STR "1.12.0"
23+
{ .major = 1, .minor = 13, .patch = 0 }
24+
#define MEMFAULT_SDK_VERSION_STR "1.13.0"
2525

2626
#ifdef __cplusplus
2727
}

examples/freertos/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ CFLAGS += \
130130
-Og \
131131
-MD \
132132
-fdebug-prefix-map="$(shell pwd)"=. \
133+
-DBOARD=\"$(BOARD)\" \
133134
$(ARCH_CFLAGS) \
134135

135136
# Enable the self test by default

examples/freertos/src/console.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
//! See LICENSE for details
55

66
#include <stdio.h>
7+
#include <stdlib.h>
78
#include <unistd.h>
89

910
#include "FreeRTOS.h"
@@ -108,6 +109,23 @@ static int prv_session(int argc, char *argv[]) {
108109
return 0;
109110
}
110111

112+
static int prv_spin_cpu(int argc, char *argv[]) {
113+
uint32_t cycle_count = UINT32_MAX;
114+
if (argc > 1) {
115+
char *end = NULL;
116+
cycle_count = strtoul(argv[1], &end, 10);
117+
if (end == argv[1]) {
118+
MEMFAULT_LOG_RAW("Invalid cycle count");
119+
cycle_count = UINT32_MAX;
120+
}
121+
}
122+
123+
MEMFAULT_LOG_RAW("Spinning CPU for %lu cycles", cycle_count);
124+
for (uint32_t i = 0; i < cycle_count; i++) { }
125+
MEMFAULT_LOG_RAW("Spinning completed, check cpu_usage_pct");
126+
return 0;
127+
}
128+
111129
static const sMemfaultShellCommand s_freertos_example_shell_extension_list[] = {
112130
{
113131
.command = "freertos_vassert",
@@ -129,6 +147,11 @@ static const sMemfaultShellCommand s_freertos_example_shell_extension_list[] = {
129147
.handler = prv_session,
130148
.help = "Execute a test metrics session named 'cli'",
131149
},
150+
{
151+
.command = "spin_cpu",
152+
.handler = prv_spin_cpu,
153+
.help = "Spin CPU to increase cpu_usage_pct metric",
154+
},
132155
};
133156
#endif
134157

examples/freertos/src/memfault/memfault_platform_port.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static const char *s_log_prefix = "MFLT";
2626
void memfault_platform_get_device_info(sMemfaultDeviceInfo *info) {
2727
*info = (sMemfaultDeviceInfo){
2828
.device_serial = "freertos-example",
29-
.hardware_version = "qemu-mps2-an385",
29+
.hardware_version = BOARD,
3030
.software_type = "qemu-app",
3131
.software_version = "1.0.0",
3232
};

ports/esp_idf/memfault/Kconfig

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,20 @@ endif
175175
default y
176176
select FREERTOS_GENERATE_RUN_TIME_STATS
177177
help
178-
Collects the idle thread runtime metric as a percentage of total runtime.
178+
Collects the CPU usage as a percentage of total runtime.
179179
This metric is only available when using esp_timer for runtime stats to
180180
avoid issues with counter overflow. Note for FreeRTOS versions < 10.2.0
181181
this will be a no-op.
182182

183+
config MEMFAULT_FREERTOS_RUNTIME_STATS_MULTI_CORE_SPLIT
184+
bool "Enables per-core cpu_usage_pct metrics for multi-core targets"
185+
default y
186+
depends on MEMFAULT_FREERTOS_TASK_RUNTIME_STATS
187+
depends on SOC_CPU_CORES_NUM > 1
188+
help
189+
When enabled, collects a separate measure of each CPU core usage as
190+
cpu_usage_pct for cpu0 and cpu1_usage_pct for cpu1
191+
183192
config MEMFAULT_MBEDTLS_METRICS
184193
bool "Collect metrics from mbedTLS"
185194
default y

ports/esp_idf/memfault/common/memfault_platform_core.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,12 @@ static void prv_record_reboot_reason(void) {
100100
reboot_reason = kMfltRebootReason_BrownOutReset;
101101
break;
102102
case ESP_RST_PANIC:
103-
default:
104103
reboot_reason = kMfltRebootReason_UnknownError;
105104
break;
105+
case ESP_RST_UNKNOWN:
106+
default:
107+
reboot_reason = kMfltRebootReason_Unknown;
108+
break;
106109
}
107110
#endif
108111
#endif

ports/esp_idf/memfault/config/memfault_esp_idf_port_config.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@ extern "C" {
7272
// so it's redundant to save them in the Memfault SDK as well.
7373
#define MEMFAULT_SDK_LOG_SAVE_DISABLE 1
7474

75+
// Kconfiglib will set this symbol to y even if SOC_CPU_CORES_NUM is not defined in older esp-idf
76+
// versions. Instead, use the FreeRTOS-SMP configNUM_CORES to determine support
77+
#if defined(CONFIG_MEMFAULT_FREERTOS_RUNTIME_STATS_MULTI_CORE_SPLIT)
78+
#if defined(configNUM_CORES) && configNUM_CORES > 1
79+
#define MEMFAULT_FREERTOS_RUNTIME_STATS_MULTI_CORE_SPLIT 1
80+
#endif
81+
#endif
82+
7583
// Pick up any user configuration overrides. This should be kept at the bottom
7684
// of this file
7785
#if CONFIG_MEMFAULT_USER_CONFIG_SILENT_FAIL

ports/freertos/config/memfault_metrics_heartbeat_freertos_config.def

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
// This definition is used to track if this file has been included yet
44
#define MEMFAULT_METRICS_HEARTBEAT_FREERTOS_CONFIG_DEF 1
55

6-
#if MEMFAULT_FREERTOS_RUN_TIME_STATS_MULTI_CORE
7-
MEMFAULT_METRICS_KEY_DEFINE(idle0_task_run_time_percent, kMemfaultMetricType_Unsigned)
8-
MEMFAULT_METRICS_KEY_DEFINE(idle1_task_run_time_percent, kMemfaultMetricType_Unsigned)
9-
#elif MEMFAULT_FREERTOS_RUN_TIME_STATS_SINGLE_CORE
10-
MEMFAULT_METRICS_KEY_DEFINE(idle_task_run_time_percent, kMemfaultMetricType_Unsigned)
6+
#define CPU_USAGE_PCT_SCALE_VALUE (100)
7+
8+
MEMFAULT_METRICS_KEY_DEFINE_WITH_SCALE_VALUE(cpu_usage_pct, kMemfaultMetricType_Unsigned,
9+
CPU_USAGE_PCT_SCALE_VALUE)
10+
#if MEMFAULT_FREERTOS_RUNTIME_STATS_MULTI_CORE_SPLIT
11+
MEMFAULT_METRICS_KEY_DEFINE_WITH_SCALE_VALUE(cpu1_usage_pct, kMemfaultMetricType_Unsigned,
12+
CPU_USAGE_PCT_SCALE_VALUE)
1113
#endif
1214

1315
#if MEMFAULT_FREERTOS_COLLECT_TIMER_STACK_FREE_BYTES

0 commit comments

Comments
 (0)