Upon completion of the integration, the following subcomponents will be added to your system!
This tutorial assumes you have a working ESP8266 RTOS SDK environment and are able to flash a board supported by the SDK.
You will first need to add the memfault-firmware-sdk to your projects.
When done, you should see the following directory structure:
EXTRA_COMPONENT_DIRS to Project Makefile#
First, update the
Makefile for your project to pick up the Memfault ESP8266
There are two small updates to make to the ESP8266 RTOS SDK. These can be added using git apply:
The patch does two things:
- Installs a facility to capture RTOS task creation
- Adds a unique identifier to image so Memfault can perform accurate stack unwinds
Create a Project and get a Project Key
Go to app.memfault.com and from the "Select A Project" dropdown, click on "Create Project" to setup your first project such as "smart-sink-dev".
Once you've created your project, you'll be automatically taken to an integration guide which includes your project key. Copy it to follow the rest of the guide.
In order to save traces, you will need to implement a dependency function that
tells memfault version information. You can copy the following template into the
memfault_port.c file created in the first step:
Be sure to fill in the appropriate.
Initialize the Memfault platform from
Add a call to
memfault_platform_boot() from your
From a background task, periodically try sending data to Memfault when the
device is connected to WiFi by calling
#include "memfault/esp8266_port/http_client.h". This routine will issue an
HTTPS request if and only if there is new Memfault data to send.
For testing, you can also force a post immediately by using the
mflt post_chunks CLI command
Example crashes can be generated using the
Data can also also be dumped out over the CLI using the
mflt export_data CLI
The CLI output can then be saved to a file and the "chunk" data can be posted to the Memfault Cloud using the Memfault CLI tool:
At this point you should be able to generate a test trace event and push it to the Memfault UI. You can confirm the issue has arrived succesfully by navigating to the "Issues" page. Follow the link pointed to below and upload a symbol file.
After this step you will see the trace in the list of issues!
You can programatically upload symbol files with the Memfault CLI tool.
If you run into any issues with your data transfer implementation, we have tools to help!
- A UI you can use to view the raw "Chunk" data payloads that have arrived for your project.
- Precanned Data Payloads you can
pass through your
user_transport_send_chunk_data()implementation to test data transfer in isolation.
- A GDB Script which can be installed to send chunks programatically every time a breakpoint is hit.