Skip to content

Commit 8585f81

Browse files
author
Memfault Inc
committed
Memfault Firmware SDK 0.27.3 (Build 347225)
1 parent 06da39b commit 8585f81

File tree

9 files changed

+119
-46
lines changed

9 files changed

+119
-46
lines changed

CHANGES.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
### Changes between Memfault SDK 0.27.3 and SDK 0.27.2 - Nov 22, 2021
2+
3+
#### :chart_with_upwards_trend: Improvements
4+
5+
- Fix a build error for the Nordic Connect SDK v1.7.99 development version
6+
- Correct an error in header file include order in the Mynewt port
7+
- Update the esp32 and zephyr examples to use `1.0.0-dev` instead of
8+
`1.0.0+<6 digits of build id>` for the version specifier. Build id is no
9+
longer required for symbol file reconciliation and the `+` character is a
10+
reserved character for URI schemes; this impacted OTA release requests. See
11+
this document for
12+
[Memfault's recommended versioning strategy](https://docs.memfault.com/docs/platform/software-version-hardware-version/#software-version)
13+
- Add a reboot reason port for the STM32F7xx family.
14+
15+
#### :house: Internal
16+
17+
- Re-run python `black` and `isort` formatters on python code
18+
119
### Changes between Memfault SDK 0.27.2 and SDK 0.27.1 - Nov 5, 2021
220

321
#### :chart_with_upwards_trend: Improvements

VERSION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
BUILD ID: 338784
2-
GIT COMMIT: a8d871a22
1+
BUILD ID: 347225
2+
GIT COMMIT: 3f66c9c5e

components/include/memfault/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ typedef struct {
1919
uint8_t patch;
2020
} sMfltSdkVersion;
2121

22-
#define MEMFAULT_SDK_VERSION { .major = 0, .minor = 27, .patch = 2 }
22+
#define MEMFAULT_SDK_VERSION { .major = 0, .minor = 27, .patch = 3 }
2323

2424
#ifdef __cplusplus
2525
}

examples/esp32/apps/memfault_demo_app/main/memfault_platform_device_info.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88

99
#include <stdio.h>
1010

11-
#include "memfault/core/build_info.h"
12-
#include "memfault/core/math.h"
13-
#include "memfault/core/platform/device_info.h"
11+
#include "memfault/components.h"
1412

1513
#include "esp_system.h"
1614

@@ -29,7 +27,6 @@
2927
#endif
3028

3129
static char s_device_serial[32];
32-
static char s_fw_version[16] = MEMFAULT_ESP32_MAIN_FIRMWARE_VERSION "+";
3330

3431
// NOTE: Some versions of the esp-idf use locking when reading mac info
3532
// so this isn't safe to call from an interrupt
@@ -52,23 +49,13 @@ static void prv_get_device_serial(char *buf, size_t buf_len) {
5249

5350
void memfault_platform_device_info_boot(void) {
5451
prv_get_device_serial(s_device_serial, sizeof(s_device_serial));
55-
56-
const size_t version_len = strlen(s_fw_version);
57-
58-
// We will use 6 characters of the build id to make our versions unique and
59-
// identifiable between releases
60-
const size_t build_id_chars = 6 + 1 /* '\0' */;
61-
const size_t build_id_num_chars =
62-
MEMFAULT_MIN(build_id_chars, sizeof(s_fw_version) - version_len - 1);
63-
64-
memfault_build_id_get_string(&s_fw_version[version_len], build_id_num_chars);
6552
}
6653

6754
void memfault_platform_get_device_info(struct MemfaultDeviceInfo *info) {
6855
*info = (struct MemfaultDeviceInfo) {
6956
.device_serial = s_device_serial,
7057
.hardware_version = MEMFAULT_ESP32_HW_REVISION,
71-
.software_version = s_fw_version,
58+
.software_version = MEMFAULT_ESP32_MAIN_FIRMWARE_VERSION "-dev",
7259
.software_type = MEMFAULT_ESP32_SOFTWARE_TYPE,
7360
};
7461
}

examples/zephyr/apps/memfault_demo_app/src/main.c

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,11 @@ sMfltHttpClientConfig g_mflt_http_client_config = {
1717
.api_key = "<YOUR PROJECT KEY HERE>",
1818
};
1919

20-
static char s_fw_version[16]="1.0.0+";
21-
2220
void memfault_platform_get_device_info(sMemfaultDeviceInfo *info) {
23-
static bool s_init = false;
24-
25-
if (!s_init) {
26-
const size_t version_len = strlen(s_fw_version);
27-
// We will use 6 characters of the build id to make our versions unique and
28-
// identifiable between releases
29-
const size_t build_id_chars = 6 + 1 /* '\0' */;
30-
31-
const size_t build_id_num_chars =
32-
MEMFAULT_MIN(build_id_chars, sizeof(s_fw_version) - version_len - 1);
33-
34-
memfault_build_id_get_string(&s_fw_version[version_len], build_id_num_chars);
35-
s_init = true;
36-
}
37-
3821
*info = (sMemfaultDeviceInfo) {
3922
.device_serial = "DEMOSERIAL",
4023
.software_type = "zephyr-app",
41-
.software_version = s_fw_version,
24+
.software_version = "1.0.0-dev",
4225
.hardware_version = CONFIG_BOARD,
4326
};
4427
}

ports/mynewt/src/memfault_platform_port.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@
66
//! A port of Memfault dependency functions to mynewt targets
77

88
#include <stdbool.h>
9+
#include <syscfg/syscfg.h>
10+
11+
//! Keep os.h above bsp.h; some bsp definitions require the MYNEWT_VAL definition
12+
#include "os/os.h"
913

1014
#include "bsp/bsp.h"
1115
#include "hal/hal_bsp.h"
1216
#include "hal/hal_system.h"
1317
#include "memfault/components.h"
1418
#include "memfault/ports/reboot_reason.h"
15-
#include "os/os.h"
1619
#include "sysinit/sysinit.h"
1720

1821
#if MYNEWT_VAL(MEMFAULT_ENABLE)
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
//! @file
2+
//!
3+
//! Copyright (c) Memfault, Inc.
4+
//! See License.txt for details
5+
//!
6+
//! A port for recovering reset reason information by reading the "Reset and
7+
//! Clock Control" (RCC)'s "Control & Status Register" (CSR).
8+
//!
9+
//! More details can be found in the "RCC clock control & status register
10+
//! (RCC_CSR)" section of the STM32F7 family reference manual.
11+
12+
#include "memfault/components.h"
13+
#include "stm32f769xx.h"
14+
#include "stm32f7xx_hal.h"
15+
16+
#if MEMFAULT_ENABLE_REBOOT_DIAG_DUMP
17+
#define MEMFAULT_PRINT_RESET_INFO(...) MEMFAULT_LOG_INFO(__VA_ARGS__)
18+
#else
19+
#define MEMFAULT_PRINT_RESET_INFO(...)
20+
#endif
21+
22+
//! Mappings come from "5.3.21 RCC clock control & status register (RCC_CSR)" of
23+
//! the ST "RM0410" Reference Manual for (STM32F76xxx and STM32F77xxx).
24+
typedef enum ResetSource {
25+
kResetSource_PwrPor = (RCC_CSR_PORRSTF_Msk),
26+
kResetSource_Pin = (RCC_CSR_PINRSTF_Msk),
27+
kResetSource_PwrBor = (RCC_CSR_BORRSTF_Msk),
28+
kResetSource_Software = (RCC_CSR_SFTRSTF_Msk),
29+
kResetSource_Wwdg = (RCC_CSR_WWDGRSTF_Msk),
30+
kResetSource_Iwdg = (RCC_CSR_IWDGRSTF_Msk),
31+
kResetSource_LowPwr = (RCC_CSR_LPWRRSTF_Msk),
32+
} eResetSource;
33+
34+
void memfault_reboot_reason_get(sResetBootupInfo *info) {
35+
const uint32_t reset_cause = RCC->CSR;
36+
37+
eMemfaultRebootReason reset_reason = kMfltRebootReason_Unknown;
38+
39+
MEMFAULT_PRINT_RESET_INFO("Reset Reason, RCC_CSR=0x%" PRIx32, reset_cause);
40+
MEMFAULT_PRINT_RESET_INFO("Reset Causes: ");
41+
42+
const uint32_t reset_mask_all =
43+
(RCC_CSR_BORRSTF_Msk | RCC_CSR_PINRSTF_Msk | RCC_CSR_PORRSTF_Msk | RCC_CSR_SFTRSTF_Msk |
44+
RCC_CSR_IWDGRSTF_Msk | RCC_CSR_WWDGRSTF_Msk | RCC_CSR_LPWRRSTF_Msk);
45+
46+
switch (reset_cause & reset_mask_all) {
47+
case kResetSource_PwrPor:
48+
MEMFAULT_PRINT_RESET_INFO(" Power on Reset");
49+
reset_reason = kMfltRebootReason_PowerOnReset;
50+
break;
51+
case kResetSource_Pin:
52+
MEMFAULT_PRINT_RESET_INFO(" Pin Reset");
53+
reset_reason = kMfltRebootReason_PinReset;
54+
break;
55+
case kResetSource_PwrBor:
56+
MEMFAULT_PRINT_RESET_INFO(" Brown out");
57+
reset_reason = kMfltRebootReason_BrownOutReset;
58+
break;
59+
case kResetSource_Software:
60+
MEMFAULT_PRINT_RESET_INFO(" Software");
61+
reset_reason = kMfltRebootReason_SoftwareReset;
62+
break;
63+
case kResetSource_Wwdg:
64+
MEMFAULT_PRINT_RESET_INFO(" Window Watchdog");
65+
reset_reason = kMfltRebootReason_HardwareWatchdog;
66+
break;
67+
case kResetSource_Iwdg:
68+
MEMFAULT_PRINT_RESET_INFO(" Independent Watchdog");
69+
reset_reason = kMfltRebootReason_HardwareWatchdog;
70+
break;
71+
case kResetSource_LowPwr:
72+
MEMFAULT_PRINT_RESET_INFO(" Low power management");
73+
reset_reason = kMfltRebootReason_LowPower;
74+
break;
75+
default:
76+
MEMFAULT_PRINT_RESET_INFO(" Unknown");
77+
break;
78+
}
79+
80+
#if MEMFAULT_REBOOT_REASON_CLEAR
81+
// we have read the reset information so clear the bits (since they are sticky across reboots)
82+
__HAL_RCC_CLEAR_RESET_FLAGS();
83+
#endif
84+
85+
*info = (sResetBootupInfo){
86+
.reset_reason_reg = reset_cause,
87+
.reset_reason = reset_reason,
88+
};
89+
}

ports/zephyr/common/memfault_zephyr_ram_regions.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,7 @@ size_t memfault_zephyr_get_data_regions(sMfltCoredumpRegion *regions, size_t num
143143

144144
// Linker variables defined in linker.ld in Zephyr RTOS
145145
// Data region name changed in v2.7 of the kernel
146-
//
147-
// Note: the nrf-connect fork of zephyr did not pick up this change in either
148-
// the 2.6.99 or the later version selected in the nrf-connect v1.8 release,
149-
// so we'll use the old naming scheme there. This may break in the future if
150-
// Nordic picks up the change!
151-
// https://github.com/zephyrproject-rtos/zephyr/commit/65a2de84a9d5c535167951bf1cf610c4f7967ea5
152-
// https://github.com/zephyrproject-rtos/zephyr/pull/37938
153-
#if MEMFAULT_ZEPHYR_VERSION_GT(2, 6) && !CONFIG_MEMFAULT_NRF_CONNECT_SDK
146+
#if MEMFAULT_ZEPHYR_VERSION_GT(2, 6)
154147
#define ZEPHYR_DATA_REGION_START __data_region_start
155148
#define ZEPHYR_DATA_REGION_END __data_region_end
156149
#else

tasks/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def fw_sdk_unit_test(ctx, coverage=False, rule="", test_filter=None, test_dir=SD
6262
]
6363
)
6464
def build_all_demos(ctx):
65-
""" Builds all demo apps (for CI purposes) """
65+
"""Builds all demo apps (for CI purposes)"""
6666
pass
6767

6868

0 commit comments

Comments
 (0)