Skip to content

Commit edbfc2c

Browse files
committed
Follow the basic Memfault SDK integration steps
1 parent 6671fbf commit edbfc2c

8 files changed

Lines changed: 52 additions & 0 deletions

File tree

‎.gitmodules‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "src/components/memfault_port/memfault-firmware-sdk"]
2+
path = src/components/memfault_port/memfault-firmware-sdk
3+
url = https://github.com/memfault/memfault-firmware-sdk.git

‎src/Makefile‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@ PROJECT_NAME := toastboard
22

33
EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_common
44

5+
EXTRA_COMPONENT_DIRS += \
6+
components/memfault_port/memfault-firmware-sdk/ports/esp8266_sdk/memfault \
7+
components/memfault_port/memfault-firmware-sdk/ports/esp8266_sdk/memfault_freertos
8+
59
include $(IDF_PATH)/make/project.mk
610

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
config MEMFAULT_API_KEY
2+
string "Your Memfault project API key"
3+
default "YOUR_PROJECT_API_KEY"
4+
help
5+
Get it from https://app.memfault.com/organizations/memfault/projects/toastboard/settings
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
COMPONENT_ADD_INCLUDEDIRS := config
2+

‎src/components/memfault_port/config/memfault_metrics_heartbeat_config.def‎

Whitespace-only changes.

‎src/components/memfault_port/config/memfault_trace_reason_user_config.def‎

Whitespace-only changes.
Submodule memfault-firmware-sdk added at 1afdc3d
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//! @file components/memfault_port/memfault_port.c
2+
3+
#include "memfault/components.h"
4+
5+
#include <stdio.h>
6+
7+
#include "memfault/esp8266_port/core.h"
8+
9+
sMfltHttpClientConfig g_mflt_http_client_config = {
10+
.api_key = "YOUR_PROJECT_API_KEY",
11+
};
12+
13+
static char s_fw_version[32];
14+
15+
void memfault_platform_get_device_info(sMemfaultDeviceInfo *info) {
16+
if (s_fw_version[0] == 0) {
17+
// initialize version
18+
char build_id[7];
19+
memfault_build_id_get_string(build_id, sizeof(build_id));
20+
snprintf(s_fw_version, sizeof(s_fw_version), "1.0.0+%s", build_id);
21+
}
22+
23+
// platform specific version information. For more details
24+
// see https://mflt.io/version-nomenclature
25+
*info = (sMemfaultDeviceInfo) {
26+
.device_serial = "DEMOSERIAL",
27+
.software_type = "app-fw",
28+
.software_version = s_fw_version,
29+
.hardware_version = "dvt",
30+
};
31+
}
32+
33+
int memfault_platform_boot(void) {
34+
memfault_esp_port_boot();
35+
return 0;
36+
}
37+

0 commit comments

Comments
 (0)