Skip to content

Commit 0ca1a2a

Browse files
author
Memfault Inc
committed
Memfault Firmware SDK 1.6.2 (Build 5836)
1 parent 912f34d commit 0ca1a2a

File tree

364 files changed

+9895
-10825
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

364 files changed

+9895
-10825
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Memfault Firmware SDK Changelog
22

3+
## [1.6.2] - 2024-01-29
4+
5+
### :chart_with_upwards_trend: Improvements
6+
7+
- General:
8+
9+
- Apply `clang-format` to the entire codebase, to ensure consistent code
10+
formatting. The formatting rules are defined in
11+
[`.clang-format`](.clang-format). No other changes are included in this
12+
release. A
13+
[`.git-blame-ignore-revs`](https://git-scm.com/docs/git-config#Documentation/git-config.txt-blameignoreRevsFile)
14+
entry will be added in the next release, to enable ignoring this commit when
15+
running `git blame`. Use this ignore file in your local repo with
16+
`git config blame.ignoreRevsFile=.git-blame-ignore-revs`.
17+
318
## [1.6.1] - 2024-01-29
419

520
### :chart_with_upwards_trend: Improvements

VERSION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
BUILD ID: 5829
2-
GIT COMMIT: 3f3b1b0ae
3-
VERSION: 1.6.1
1+
BUILD ID: 5836
2+
GIT COMMIT: ed83a4f3c
3+
VERSION: 1.6.2

components/core/src/arch_arm_cortex_m.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@ void memfault_arch_disable_configurable_faults(void) {
2323
// Clear MEMFAULTENA, BUSFAULTENA, USGFAULTENA, SECUREFAULTENA
2424
//
2525
// This will force all faults to be routed through the HardFault Handler
26-
volatile uint32_t *SHCSR = (uint32_t*)0xE000ED24;
26+
volatile uint32_t *SHCSR = (uint32_t *)0xE000ED24;
2727
*SHCSR &= ~((uint32_t)0x000F0000);
2828
}
2929

30-
MEMFAULT_WEAK
31-
void memfault_platform_halt_if_debugging(void) {
30+
MEMFAULT_WEAK void memfault_platform_halt_if_debugging(void) {
3231
volatile uint32_t *dhcsr = (volatile uint32_t *)0xE000EDF0;
3332
const uint32_t c_debugen_mask = 0x1;
3433

components/core/src/memfault_batched_events.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@
44
//! See License.txt for details
55
//!
66

7-
#include "memfault/core/batched_events.h"
8-
97
#include <string.h>
108

9+
#include "memfault/core/batched_events.h"
1110
#include "memfault/core/sdk_assert.h"
1211
#include "memfault/util/cbor.h"
1312

14-
void memfault_batched_events_build_header(
15-
size_t num_events, sMemfaultBatchedEventsHeader *header_out) {
13+
void memfault_batched_events_build_header(size_t num_events,
14+
sMemfaultBatchedEventsHeader *header_out) {
1615
MEMFAULT_SDK_ASSERT(header_out != NULL);
1716

1817
if (num_events <= 1) {

components/core/src/memfault_build_id.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@
66
//! @brief
77
//! See header for more details
88

9-
#include "memfault/core/build_info.h"
10-
#include "memfault_build_id_private.h"
11-
129
#include <stdint.h>
1310
#include <string.h>
1411

1512
#include "memfault/config.h"
13+
#include "memfault/core/build_info.h"
14+
#include "memfault_build_id_private.h"
1615

1716
#if MEMFAULT_USE_GNU_BUILD_ID
1817

@@ -29,7 +28,9 @@ MEMFAULT_BUILD_ID_QUALIFIER sMemfaultBuildIdStorage g_memfault_build_id = {
2928
#else
3029

3130
// NOTE: We start the array with a 0x1, so the compiler will never place the variable in bss
32-
MEMFAULT_BUILD_ID_QUALIFIER uint8_t g_memfault_sdk_derived_build_id[MEMFAULT_BUILD_ID_LEN] = { 0x1, };
31+
MEMFAULT_BUILD_ID_QUALIFIER uint8_t g_memfault_sdk_derived_build_id[MEMFAULT_BUILD_ID_LEN] = {
32+
0x1,
33+
};
3334

3435
MEMFAULT_BUILD_ID_QUALIFIER sMemfaultBuildIdStorage g_memfault_build_id = {
3536
.type = kMemfaultBuildIdType_None,

components/core/src/memfault_build_id_private.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ typedef enum {
3434
} eMemfaultBuildIdType;
3535

3636
typedef struct {
37-
uint8_t type; // eMemfaultBuildIdType
37+
uint8_t type; // eMemfaultBuildIdType
3838
uint8_t len;
3939
// the length, in bytes, of the build id used when reporting data
4040
uint8_t short_len;
@@ -48,11 +48,11 @@ MEMFAULT_STATIC_ASSERT(((offsetof(sMemfaultBuildIdStorage, type) == 0) &&
4848
"be sure to update fw_build_id.py!");
4949

5050
#if defined(MEMFAULT_UNITTEST)
51-
//! NB: For unit tests we want to be able to instrument the data in the test
52-
//! so we drop the `const` qualifier
53-
#define MEMFAULT_BUILD_ID_QUALIFIER
51+
//! NB: For unit tests we want to be able to instrument the data in the test
52+
//! so we drop the `const` qualifier
53+
#define MEMFAULT_BUILD_ID_QUALIFIER
5454
#else
55-
#define MEMFAULT_BUILD_ID_QUALIFIER const
55+
#define MEMFAULT_BUILD_ID_QUALIFIER const
5656
#endif
5757

5858
extern MEMFAULT_BUILD_ID_QUALIFIER sMemfaultBuildIdStorage g_memfault_build_id;
@@ -64,8 +64,9 @@ typedef MEMFAULT_PACKED_STRUCT {
6464
uint32_t namesz;
6565
uint32_t descsz;
6666
uint32_t type;
67-
char namedata[];
68-
} sMemfaultElfNoteSection;
67+
char namedata[];
68+
}
69+
sMemfaultElfNoteSection;
6970

7071
#ifdef __cplusplus
7172
}

components/core/src/memfault_compact_log_serializer.c

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212
#if MEMFAULT_COMPACT_LOG_ENABLE
1313

14-
#include "memfault/core/compiler.h"
15-
#include "memfault/core/debug_log.h"
16-
#include "memfault/core/compact_log_helpers.h"
17-
#include "memfault/core/compact_log_serializer.h"
18-
#include "memfault/util/cbor.h"
14+
#include "memfault/core/compact_log_helpers.h"
15+
#include "memfault/core/compact_log_serializer.h"
16+
#include "memfault/core/compiler.h"
17+
#include "memfault/core/debug_log.h"
18+
#include "memfault/util/cbor.h"
1919

2020
//! Compact logs are placed in a linker section named "log_fmt". This is a symbol exposed by the
2121
//! linker which points to the start of the section
@@ -24,16 +24,15 @@ extern uint32_t __start_log_fmt;
2424
//! Note: We don't read this in the firmware but it is used during the decode
2525
//! process to sanity check the section is being laid out as we would expect.
2626
MEMFAULT_PUT_IN_SECTION(".log_fmt_hdr")
27-
MEMFAULT_NO_ALLOC
28-
const sMemfaultLogFmtElfSectionHeader g_memfault_log_fmt_elf_section_hdr = {
27+
MEMFAULT_NO_ALLOC const sMemfaultLogFmtElfSectionHeader g_memfault_log_fmt_elf_section_hdr = {
2928
.magic = 0x66474f4c, /* LOGf */
3029
.version = 1,
3130
};
3231

3332
bool memfault_vlog_compact_serialize(sMemfaultCborEncoder *encoder, uint32_t log_id,
3433
uint32_t compressed_fmt, va_list args) {
3534
const uint32_t bits_per_arg = 2;
36-
const uint32_t bits_per_arg_mask = (1 << bits_per_arg) - 1;
35+
const uint32_t bits_per_arg_mask = (1 << bits_per_arg) - 1;
3736

3837
const size_t num_args = (31UL - MEMFAULT_CLZ(compressed_fmt)) / bits_per_arg;
3938

@@ -54,11 +53,10 @@ bool memfault_vlog_compact_serialize(sMemfaultCborEncoder *encoder, uint32_t log
5453
// the promotion type of a given va_arg is encoded within two bits of the
5554
// compressed_fmt field.
5655
const uint32_t type =
57-
(compressed_fmt >> ((num_args - i - 1) * bits_per_arg)) & bits_per_arg_mask;
56+
(compressed_fmt >> ((num_args - i - 1) * bits_per_arg)) & bits_per_arg_mask;
5857

5958
bool success = false;
6059
switch (type) {
61-
6260
case MEMFAULT_LOG_ARG_PROMOTED_TO_INT32: {
6361
int32_t val = va_arg(args, int32_t);
6462
success = memfault_cbor_encode_signed_integer(encoder, val);
@@ -70,7 +68,7 @@ bool memfault_vlog_compact_serialize(sMemfaultCborEncoder *encoder, uint32_t log
7068
// by packing the cbor encoded int in an array.
7169
uint64_t val = va_arg(args, uint64_t);
7270
success = memfault_cbor_encode_array_begin(encoder, 1) &&
73-
memfault_cbor_encode_long_signed_integer(encoder, (int64_t)val);
71+
memfault_cbor_encode_long_signed_integer(encoder, (int64_t)val);
7472
break;
7573
}
7674

@@ -91,7 +89,8 @@ bool memfault_vlog_compact_serialize(sMemfaultCborEncoder *encoder, uint32_t log
9189
//
9290
// But parsing as a double is more portable and get's optimized away by compilers
9391
// like GCC anyway: https://godbolt.org/z/mVAS7D
94-
MEMFAULT_STATIC_ASSERT(sizeof(uint64_t) == sizeof(double), "double does not fit in uint64_t");
92+
MEMFAULT_STATIC_ASSERT(sizeof(uint64_t) == sizeof(double),
93+
"double does not fit in uint64_t");
9594

9695
// Note: We use memcpy to properly type-pun / avoid strict-aliasing violation:
9796
// https://mflt.io/strict-aliasing-type-punning
@@ -103,14 +102,13 @@ bool memfault_vlog_compact_serialize(sMemfaultCborEncoder *encoder, uint32_t log
103102
}
104103

105104
case MEMFAULT_LOG_ARG_PROMOTED_TO_STR: {
106-
const char *str = va_arg(args, const char*);
105+
const char *str = va_arg(args, const char *);
107106
success = memfault_cbor_encode_string(encoder, str != NULL ? str : "(null)");
108107
break;
109108
}
110109

111110
default:
112111
break;
113-
114112
}
115113

116114
if (!success) {
@@ -122,7 +120,7 @@ bool memfault_vlog_compact_serialize(sMemfaultCborEncoder *encoder, uint32_t log
122120
}
123121

124122
bool memfault_log_compact_serialize(sMemfaultCborEncoder *encoder, uint32_t log_id,
125-
uint32_t compressed_fmt, ...) {
123+
uint32_t compressed_fmt, ...) {
126124
va_list args;
127125
va_start(args, compressed_fmt);
128126
const bool success = memfault_vlog_compact_serialize(encoder, log_id, compressed_fmt, args);

components/core/src/memfault_core_utils.c

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,25 @@
55
//!
66
//! @brief
77

8-
#include "memfault/core/build_info.h"
9-
#include "memfault/core/device_info.h"
10-
#include "memfault/core/platform/device_info.h"
11-
#include "memfault_build_id_private.h"
12-
13-
#include <string.h>
148
#include <stdio.h>
9+
#include <string.h>
1510

11+
#include "memfault/core/build_info.h"
1612
#include "memfault/core/compiler.h"
1713
#include "memfault/core/debug_log.h"
14+
#include "memfault/core/device_info.h"
1815
#include "memfault/core/math.h"
16+
#include "memfault/core/platform/device_info.h"
17+
#include "memfault_build_id_private.h"
1918

2019
static const void *prv_get_build_id_start_pointer(void) {
2120
switch (g_memfault_build_id.type) {
2221
case kMemfaultBuildIdType_MemfaultBuildIdSha1:
2322
return g_memfault_build_id.storage;
2423
case kMemfaultBuildIdType_GnuBuildIdSha1: {
2524
const sMemfaultElfNoteSection *elf =
26-
(const sMemfaultElfNoteSection *)g_memfault_build_id.storage;
27-
return &elf->namedata[elf->namesz]; // Skip over { 'G', 'N', 'U', '\0' }
25+
(const sMemfaultElfNoteSection *)g_memfault_build_id.storage;
26+
return &elf->namedata[elf->namesz]; // Skip over { 'G', 'N', 'U', '\0' }
2827
}
2928
case kMemfaultBuildIdType_None:
3029
default:
@@ -69,8 +68,8 @@ bool memfault_build_id_get_string(char *out_buf, size_t buf_len) {
6968
return true;
7069
}
7170

72-
const char *memfault_create_unique_version_string(const char * const version) {
73-
static char s_version[MEMFAULT_UNIQUE_VERSION_MAX_LEN] = {0};
71+
const char *memfault_create_unique_version_string(const char *const version) {
72+
static char s_version[MEMFAULT_UNIQUE_VERSION_MAX_LEN] = { 0 };
7473

7574
// Immutable once created.
7675
if (s_version[0]) {
@@ -89,7 +88,7 @@ const char *memfault_create_unique_version_string(const char * const version) {
8988
s_version[version_len - 1] = '+';
9089

9190
const size_t build_id_num_chars =
92-
MEMFAULT_MIN(build_id_chars, sizeof(s_version) - version_len - 1);
91+
MEMFAULT_MIN(build_id_chars, sizeof(s_version) - version_len - 1);
9392

9493
if (!memfault_build_id_get_string(&s_version[version_len], build_id_num_chars)) {
9594
// Tack on something obvious to aid with debug but don't fail.
@@ -117,8 +116,7 @@ void memfault_build_info_dump(void) {
117116
return;
118117
}
119118

120-
const bool is_gnu =
121-
(g_memfault_build_id.type == kMemfaultBuildIdType_GnuBuildIdSha1);
119+
const bool is_gnu = (g_memfault_build_id.type == kMemfaultBuildIdType_GnuBuildIdSha1);
122120

123121
char build_id_sha[41] = { 0 };
124122
for (size_t i = 0; i < sizeof(info.build_id); i++) {
@@ -132,7 +130,7 @@ void memfault_build_info_dump(void) {
132130
}
133131

134132
void memfault_device_info_dump(void) {
135-
struct MemfaultDeviceInfo info = {0};
133+
struct MemfaultDeviceInfo info = { 0 };
136134
memfault_platform_get_device_info(&info);
137135
MEMFAULT_LOG_INFO("S/N: %s", info.device_serial ? info.device_serial : "<NULL>");
138136
MEMFAULT_LOG_INFO("SW type: %s", info.software_type ? info.software_type : "<NULL>");

0 commit comments

Comments
 (0)