Skip to content

Commit 7c3b112

Browse files
author
Memfault Inc
committed
Memfault Firmware SDK 0.28.1 (Build 378789)
1 parent ecfe318 commit 7c3b112

File tree

11 files changed

+852
-178
lines changed

11 files changed

+852
-178
lines changed

CHANGES.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
### Changes between Memfault SDK 0.28.1 and SDK 0.28.0 - Jan 20, 2022
2+
3+
#### :chart_with_upwards_trend: Improvements
4+
5+
- Add an optional override flag to control the name used for Zephyr data
6+
regions- see
7+
[`ports/zephyr/common/memfault_zephyr_ram_regions.c`](ports/zephyr/common/memfault_zephyr_ram_regions.c).
8+
Only needed for unusual Zephyr + Memfault configurations prior to Zephyr v2.7
9+
(for example, nRF Connect SDK v1.7.1 with Memfault SDK v0.27.3+)
10+
- Fix the STM32F7xx reboot reason port to correctly account for the internally
11+
wired Pin Reset
12+
- Fix a function prototype mismatch in the STM32L4 flash port (thanks to
13+
@schultetwin for reporting this in #22!)
14+
115
### Changes between Memfault SDK 0.28.0 and SDK 0.27.3 - Jan 4, 2022
216

317
#### :rocket: New Features

VERSION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
BUILD ID: 370105
2-
GIT COMMIT: 4641213bd
1+
BUILD ID: 378789
2+
GIT COMMIT: 9d890e8cc

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 = 28, .patch = 0 }
22+
#define MEMFAULT_SDK_VERSION { .major = 0, .minor = 28, .patch = 1 }
2323

2424
#ifdef __cplusplus
2525
}

ports/include/memfault/ports/stm32cube/l4/flash.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ extern "C" {
2828
//!
2929
//! @return true if no error was detected or error was successfully cleared,
3030
//! false otherwise
31-
bool memfault_stm32cubel4_flash_clear_ecc_errors(
31+
bool memfault_stm32cubel4_flash_clear_ecc_error(
3232
uint32_t start_addr, uint32_t end_addr, uint32_t *corrupted_address);
3333

3434
#ifdef __cplusplus

ports/stm32cube/f7/rcc_reboot_tracking.c

Lines changed: 33 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
//! (RCC_CSR)" section of the STM32F7 family reference manual.
1111

1212
#include "memfault/components.h"
13-
#include "stm32f769xx.h"
1413
#include "stm32f7xx_hal.h"
1514

1615
#if MEMFAULT_ENABLE_REBOOT_DIAG_DUMP
@@ -19,18 +18,9 @@
1918
#define MEMFAULT_PRINT_RESET_INFO(...)
2019
#endif
2120

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-
21+
//! Reset reason codes come from "5.3.21 RCC clock control & status register
22+
//! (RCC_CSR)" of the ST "RM0410" Reference Manual for (STM32F76xxx and
23+
//! STM32F77xxx).
3424
void memfault_reboot_reason_get(sResetBootupInfo *info) {
3525
const uint32_t reset_cause = RCC->CSR;
3626

@@ -39,46 +29,39 @@ void memfault_reboot_reason_get(sResetBootupInfo *info) {
3929
MEMFAULT_PRINT_RESET_INFO("Reset Reason, RCC_CSR=0x%" PRIx32, reset_cause);
4030
MEMFAULT_PRINT_RESET_INFO("Reset Causes: ");
4131

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;
32+
// look for the first bit set in the reset cause register.
33+
//
34+
// pin reset is checked last; all other internally generated resets are wired
35+
// to the reset pin, see section 5.1.2 of the Reference Manual.
36+
if (reset_cause & RCC_CSR_SFTRSTF_Msk) {
37+
MEMFAULT_PRINT_RESET_INFO(" Software");
38+
reset_reason = kMfltRebootReason_SoftwareReset;
39+
} else if (reset_cause & RCC_CSR_PORRSTF_Msk) {
40+
MEMFAULT_PRINT_RESET_INFO(" Power on Reset");
41+
reset_reason = kMfltRebootReason_PowerOnReset;
42+
} else if (reset_cause & RCC_CSR_BORRSTF_Msk) {
43+
MEMFAULT_PRINT_RESET_INFO(" Brown out");
44+
reset_reason = kMfltRebootReason_BrownOutReset;
45+
} else if (reset_cause & RCC_CSR_WWDGRSTF_Msk) {
46+
MEMFAULT_PRINT_RESET_INFO(" Window Watchdog");
47+
reset_reason = kMfltRebootReason_HardwareWatchdog;
48+
} else if (reset_cause & RCC_CSR_IWDGRSTF_Msk) {
49+
MEMFAULT_PRINT_RESET_INFO(" Independent Watchdog");
50+
reset_reason = kMfltRebootReason_HardwareWatchdog;
51+
} else if (reset_cause & RCC_CSR_LPWRRSTF_Msk) {
52+
MEMFAULT_PRINT_RESET_INFO(" Low Power");
53+
reset_reason = kMfltRebootReason_LowPower;
54+
} else if (reset_cause & RCC_CSR_PINRSTF_Msk) {
55+
MEMFAULT_PRINT_RESET_INFO(" Pin Reset");
56+
reset_reason = kMfltRebootReason_PinReset;
57+
} else {
58+
MEMFAULT_PRINT_RESET_INFO(" Unknown");
59+
reset_reason = kMfltRebootReason_Unknown;
7860
}
7961

8062
#if MEMFAULT_REBOOT_REASON_CLEAR
81-
// we have read the reset information so clear the bits (since they are sticky across reboots)
63+
// we have read the reset information so clear the bits (since they are sticky
64+
// across reboots)
8265
__HAL_RCC_CLEAR_RESET_FLAGS();
8366
#endif
8467

ports/zephyr/common/memfault_zephyr_ram_regions.c

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@
1313
#include <kernel_structs.h>
1414
#include <version.h>
1515

16-
#include "memfault/core/compiler.h"
17-
#include "memfault/core/math.h"
18-
#include "memfault/panics/platform/coredump.h"
16+
#include "memfault/components.h"
1917
#include "memfault/ports/zephyr/version.h"
2018

19+
// Use this config flag to manually select the old data region names
20+
#if !defined(MEMFAULT_ZEPHYR_USE_OLD_DATA_REGION_NAMES)
21+
#define MEMFAULT_ZEPHYR_USE_OLD_DATA_REGION_NAMES 0
22+
#endif
23+
2124
static struct k_thread *s_task_tcbs[CONFIG_MEMFAULT_COREDUMP_MAX_TRACKED_TASKS];
2225
#define EMPTY_SLOT 0
2326

@@ -141,12 +144,19 @@ size_t memfault_zephyr_get_data_regions(sMfltCoredumpRegion *regions, size_t num
141144
return 0;
142145
}
143146

144-
// Linker variables defined in linker.ld in Zephyr RTOS
145-
// Data region name changed in v2.7 of the kernel
146-
#if MEMFAULT_ZEPHYR_VERSION_GT(2, 6)
147+
// These linker variables are defined in linker.ld in Zephyr RTOS. Note that
148+
// the data region name changed in v2.7 of the kernel, so check the kernel
149+
// version and set the name appropriately.
150+
//
151+
// Also check for a user override; this is necessary if NCS v1.7.1 is used
152+
// with a Memfault SDK version >=0.27.3, because that NCS release used an
153+
// intermediate Zephyr release, so the version number checking is not
154+
// possible.
155+
#if !MEMFAULT_ZEPHYR_USE_OLD_DATA_REGION_NAMES && MEMFAULT_ZEPHYR_VERSION_GT(2, 6)
147156
#define ZEPHYR_DATA_REGION_START __data_region_start
148157
#define ZEPHYR_DATA_REGION_END __data_region_end
149158
#else
159+
// The old names are used in previous Zephyr versions (<=2.6)
150160
#define ZEPHYR_DATA_REGION_START __data_ram_start
151161
#define ZEPHYR_DATA_REGION_END __data_ram_end
152162
#endif

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
git+git://github.com/memfault/pyserial.git@master-memfault
1+
git+https://github.com/memfault/pyserial.git@master-memfault
22
invoke==1.2.0
33
mbed-cli==1.10.1
44
pyftdi==0.29.4

0 commit comments

Comments
 (0)