Skip to content

Commit 2fe5ba1

Browse files
author
Memfault Inc
committed
Memfault Firmware SDK 0.28.2 (Build 384364)
1 parent 7c3b112 commit 2fe5ba1

File tree

9 files changed

+85
-57
lines changed

9 files changed

+85
-57
lines changed

.circleci/config.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ commands:
4949
- run:
5050
name: Install lcov 1.14
5151
command: |
52-
wget http://downloads.sourceforge.net/ltp/lcov-1.14.tar.gz -O ~/lcov.tar.gz
52+
LCOV_SHA256SUM=14995699187440e0ae4da57fe3a64adc0a3c5cf14feab971f8db38fb7d8f071a
53+
wget https://github.com/linux-test-project/lcov/releases/download/v1.14/lcov-1.14.tar.gz -O ~/lcov.tar.gz
54+
echo "${LCOV_SHA256SUM} ${HOME}/lcov.tar.gz" | shasum --algorithm=256 --check
5355
cd ~ && tar zvxf ~/lcov.tar.gz
5456
5557
prepare:

CHANGES.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
### Changes between Memfault SDK 0.28.2 and SDK 0.28.1 - Feb 1, 2022
2+
3+
#### :house: Internal
4+
5+
- Updated
6+
[nRF91 sample test app](examples/nrf-connect-sdk/nrf9160/memfault_demo_app) to
7+
be compatible with nRF Connect SDK 1.9 release
8+
- Updated python scripts to be compatible with new flake8 linter options
9+
- Updated where `lcov` is sourced from when running unit tests in CI
10+
111
### Changes between Memfault SDK 0.28.1 and SDK 0.28.0 - Jan 20, 2022
212

313
#### :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: 378789
2-
GIT COMMIT: 9d890e8cc
1+
BUILD ID: 384364
2+
GIT COMMIT: 73cde73c3

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

2424
#ifdef __cplusplus
2525
}

examples/nrf-connect-sdk/nrf9160/memfault_demo_app/CMakeLists.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,24 @@ if (NCS_VERSION_MAJOR)
3737

3838
set(CONFIG_NEWLIB_LIBC y CACHE INTERNAL "")
3939
endif()
40+
41+
# These were removed in NCS 1.9, but are needed prior to that.
42+
if (${NCS_VERSION_MAJOR} LESS_EQUAL 1 AND ${NCS_VERSION_MINOR} LESS 9 AND ${NCS_VERSION_PATCH} LESS 99)
43+
set(CONFIG_BSD_LIBRARY y CACHE INTERNAL "")
44+
set(CONFIG_BSD_LIBRARY_SYS_INIT n CACHE INTERNAL "")
45+
# ^ Note: CONFIG_BSD_ were renamed to _NRF_MODEM_ in
46+
# nRF Connect SDK v1.5. We use the legacy names for now
47+
# so this app can continue to compile on older targets
48+
#
49+
# CONFIG_NRF_MODEM_LIB
50+
# CONFIG_NRF_MODEM_LIB_SYS_INIT
51+
52+
# For nRF Connect SDK v1.5 default value changed here
53+
set(CONFIG_AT_CMD_SYS_INIT n CACHE INTERNAL "")
54+
else()
55+
# in v1.9+, use the modem_info library to get the IMEI for device_serial
56+
set(CONFIG_MODEM_INFO y CACHE INTERNAL "")
57+
endif()
4058
endif()
4159

4260
find_package(Zephyr HINTS $ENV{ZEPHYR_BASE})

examples/nrf-connect-sdk/nrf9160/memfault_demo_app/prj.conf

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,10 @@ CONFIG_FOTA_DOWNLOAD_PROGRESS_EVT=y
6767
CONFIG_MEMFAULT_HTTP_MAX_POST_SIZE=256
6868

6969
# Manually bring up LTE stack
70-
CONFIG_BSD_LIBRARY=y
71-
CONFIG_BSD_LIBRARY_SYS_INIT=n
72-
# ^ Note: CONFIG_BSD_ were renamed to _NRF_MODEM_ in
73-
# nRF Connect SDK v1.5. We use the legacy names for now
74-
# so this app can continue to compile on older targets
75-
#
76-
# CONFIG_NRF_MODEM_LIB
77-
# CONFIG_NRF_MODEM_LIB_SYS_INIT
78-
79-
# For nRF Connect SDK v1.5 default value changed here
8070
CONFIG_LTE_AUTO_INIT_AND_CONNECT=n
81-
CONFIG_AT_CMD_SYS_INIT=n
8271

8372
CONFIG_WATCHDOG=y
8473

8574
# Note: See ./CMakeLists.txt for additional Kconfig variables settings as not all variables can be
8675
# set in a single prj.conf for backward compatibility with older versions of the nRF Connect SDK /
87-
# Zephyr
76+
# Zephyr

examples/nrf-connect-sdk/nrf9160/memfault_demo_app/src/main.c

Lines changed: 43 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,10 @@
2424
#include "memfault/core/platform/device_info.h"
2525
#include "memfault/http/http_client.h"
2626
#include "memfault/nrfconnect_port/http.h"
27+
#include "memfault/ports/ncs/version.h"
28+
#include <modem/modem_info.h>
2729

28-
// NCS Version was introduced in nRF SDK >= 1.4
29-
#if __has_include("ncs_version.h")
30-
31-
#include "ncs_version.h"
32-
33-
#elif __has_include("modem/bsdlib.h")
34-
35-
#define NCS_VERSION_MAJOR 1
36-
#define NCS_VERSION_MINOR 3
37-
38-
#else
39-
40-
// A nrf connect sdk version < 1.3
41-
#define NCS_VERSION_MAJOR 1
42-
#define NCS_VERSION_MINOR 0
43-
44-
#endif
45-
30+
// nRF Connect SDK < 1.3
4631
#if (NCS_VERSION_MAJOR == 1) && (NCS_VERSION_MINOR < 3)
4732

4833
#include <lte_lc.h>
@@ -51,13 +36,20 @@
5136
#include <modem_key_mgmt.h>
5237
#include <net/bsdlib.h>
5338

54-
#else /* nRF Connect SDK >= 1.3 */
39+
// nRF Connect SDK < 1.9
40+
#elif (NCS_VERSION_MAJOR == 1) && (NCS_VERSION_MINOR < 9) && (NCS_PATCHLEVEL < 99)
5541

5642
#include <modem/lte_lc.h>
5743
#include <modem/at_cmd.h>
5844
#include <modem/at_notif.h>
5945
#include <modem/modem_key_mgmt.h>
6046

47+
// nRF Connect SDK >= 1.9
48+
#else
49+
50+
#include <modem/lte_lc.h>
51+
#include <nrf_modem_at.h>
52+
6153
#endif
6254

6355
#if (NCS_VERSION_MAJOR == 1) && (NCS_VERSION_MINOR <= 2)
@@ -107,8 +99,6 @@ sMfltHttpClientConfig g_mflt_http_client_config = {
10799
};
108100

109101
void memfault_platform_get_device_info(sMemfaultDeviceInfo *info) {
110-
static bool s_init = false;
111-
112102
// platform specific version information
113103
*info = (sMemfaultDeviceInfo) {
114104
.device_serial = s_device_serial,
@@ -125,30 +115,46 @@ static int memfault_ncs_device_id_set(const char *device_id, size_t len) {
125115

126116
#endif
127117

118+
#if !MEMFAULT_NCS_VERSION_GT(1, 8)
128119
static int query_modem(const char *cmd, char *buf, size_t buf_len) {
129120
enum at_cmd_state at_state;
130121
int ret = at_cmd_write(cmd, buf, buf_len, &at_state);
131-
132122
if (ret != 0) {
133-
printk("at_cmd_write [%s] error:%d, at_state: %d",
134-
cmd, ret, at_state);
123+
printk("at_cmd_write [%s] error: %d, at_state: %d\n", cmd, ret, at_state);
135124
}
136125

137126
return ret;
138127
}
128+
#endif
139129

140-
static void prv_init_device_info(void) {
141-
// we'll use the IMEI as the device serial
142-
char imei_buf[IMEI_LEN + 2 /* for \r\n */ + 1 /* \0 */];
143-
if (query_modem("AT+CGSN", imei_buf, sizeof(imei_buf)) != 0) {
144-
strcat(s_device_serial, "Unknown");
145-
return;
130+
static int prv_get_imei(char *buf, size_t buf_len) {
131+
#if MEMFAULT_NCS_VERSION_GT(1, 8)
132+
// use the cached modem info to fetch the IMEI
133+
int err = modem_info_init();
134+
if (err != 0) {
135+
printk("Modem info Init error: %d\n", err);
136+
} else {
137+
modem_info_string_get(MODEM_INFO_IMEI, buf, buf_len);
146138
}
139+
return err;
140+
#else
141+
// use an AT command to read IMEI
142+
return query_modem("AT+CGSN", buf, buf_len);
143+
#endif
144+
}
147145

148-
imei_buf[IMEI_LEN] = '\0';
149-
strcat(s_device_serial, imei_buf);
146+
static void prv_init_device_info(void) {
147+
// we'll use the IMEI as the device serial
148+
char modem_info[MODEM_INFO_MAX_RESPONSE_SIZE];
150149

151-
printk("Device Serial: %s\n", s_device_serial);
150+
int ret = prv_get_imei(modem_info, sizeof(modem_info));
151+
if (ret != 0) {
152+
printk("Failed to get IMEI\n\r");
153+
} else {
154+
modem_info[IMEI_LEN] = '\0';
155+
strcpy(s_device_serial, modem_info);
156+
printk("IMEI: %s\n", s_device_serial);
157+
}
152158

153159
// register the device id with memfault port so it is used for reporting
154160
memfault_ncs_device_id_set(s_device_serial, IMEI_LEN);
@@ -169,10 +175,12 @@ void main(void) {
169175

170176
int err = prv_init_modem_lib();
171177
if (err) {
172-
printk("Failed to initialize bsdlib!");
178+
printk("Failed to initialize modem!");
173179
return;
174180
}
175181

182+
// These libraries were removed in ncs 1.9
183+
#if !MEMFAULT_NCS_VERSION_GT(1, 8)
176184
err = at_cmd_init();
177185
if (err) {
178186
printk("Failed to initialize AT commands, err %d\n", err);
@@ -184,6 +192,7 @@ void main(void) {
184192
printk("Failed to initialize AT notifications, err %d\n", err);
185193
return;
186194
}
195+
#endif
187196

188197
// requires AT modem interface to be up
189198
prv_init_device_info();

scripts/eclipse_patch.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def get_file_element(file_name, virtual_dir, common_prefix, parent_dir, path_typ
6767

6868
# Note: We replace '\' with '/' because eclipse on windows expects '/' for paths
6969
path = os.path.join(parent_dir, relative_path).replace("\\", "/")
70-
logging.debug("Adding {}".format(name))
70+
logging.debug("Adding %s", name)
7171
return generate_link_element(name, path, path_type=path_type)
7272

7373

@@ -137,9 +137,9 @@ def patch_project(
137137
parent_dir = os.path.join(location_prefix[0], relative_path)
138138

139139
logging.debug("===Determined Path Information===")
140-
logging.debug("Project Path: {}".format(project_dir))
141-
logging.debug("Memfault Firmware SDK Path: {}".format(memfault_sdk_dir))
142-
logging.debug("Eclipse Memfault Root: {}".format(parent_dir))
140+
logging.debug("Project Path: %s", project_dir)
141+
logging.debug("Memfault Firmware SDK Path: %s", memfault_sdk_dir)
142+
logging.debug("Eclipse Memfault Root: %s", parent_dir)
143143

144144
tree = ET.parse(project_file)
145145
root = tree.getroot()
@@ -221,7 +221,7 @@ def patch_project(
221221
linked_resources.append(ele)
222222

223223
output_location = project_file if output_dir is None else os.path.join(output_dir, ".project")
224-
logging.info("Writing result to {}".format(output_location))
224+
logging.info("Writing result to %s", output_location)
225225
tree.write(output_location)
226226

227227

@@ -301,7 +301,7 @@ def _find_linker_flags(option):
301301
#
302302

303303
output_location = cproject_file if output_dir is None else os.path.join(output_dir, ".cproject")
304-
logging.info("Writing result to {}".format(output_location))
304+
logging.info("Writing result to %s", output_location)
305305
tree.write(output_location)
306306

307307
with open(output_location, "r") as out_f:

scripts/mflt-build-id/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ wasmer = "0.3.0"
2424

2525
[tool.black]
2626
line-length = 100
27-
target-version = ['py36']
27+
target-version = ['py38']
2828
include = '\.pyi?$'
2929

3030
[tool.isort]

0 commit comments

Comments
 (0)