In order to process uploaded data, such as coredumps, Memfault needs to be able to find the Symbol File (ELF) that corresponds to the software that produced the uploaded data. Without an exact match, Memfault will not be able to decode the uploaded data.
To that end, the SDK adds metadata to the uploaded data to identify the software that produced the data. Likewise, any Symbol File that is uploaded to Memfault, must have that same identifying metadata.
There are 3 types of identifiers:
|Memfault Build Id||GNU Build Id||Software Type & Version|
|Automatically generated hash||✅||✅|
|ID embedded inside ELF||✅||✅|
|ID passed manually upon Symbol File upload||✅|
|Requires running Python script to post-process ELF||✅|
|Minimum SDK version||0.20.0||0.20.0|
We recommend using either the Memfault Build Id or GNU Build Id option. The Build Ids are automatically generated based on the contents of the ELF file.
Software Type & Version identifiers are manually assigned and therefore error-prone.
When uploading a Symbol File (ELF) that has a Build Id embedded, it is possible to add a Software Type & Version based identifier, in addition to the embedded Build Id. This will link the Symbol File with the Software Version. That way, you can later look up and download the Symbol File by Software Version through the Software Versions UI in Memfault.
Note that for the purpose of finding a Symbol File to match uploaded data, the Build Id always takes precedence over Software Type & Version.
In order to use Build Ids for identification of Symbol Files & uploaded data, SDK version 0.20.0 or newer is required.
Memfault has two ways to add a Build ID to a target. Select the appropriate one below based on your toolchain setup.
GNU Build ID (Requires Use of GNU GCC Compiler)
-Wl,--build-idto flags passed to linker via GCC
#define MEMFAULT_USE_GNU_BUILD_ID 1to
- Add the following snippet to your projects linker script (
.ldfile) where "FLASH" below will match the name of the MEMORY section read-only data and text is placed in.
Be sure to update
\<YOUR_FLASH_SECTION\> to match the name of the section
.text is placed in!
Python Script Run on ELF (Compiler Agnostic)
Update your build system to invoke the
scripts/fw_build_id.py script on your
ELF as part of a post-build step.
For example, using CMake, this can be achieved by adding a custom command to the target:
The script depends on
pyelftools so make sure you have run
pip install pyelftools or added to your
Please follow the instructions to install the Memfault CLI tool first.
Because the Build Id is embedded inside the ELF file, the Build Id is
automatically recognized and extracted and does not need to be passed as an
argument to the
To associate a Software Type & Software Version with a Symbol File, the
--software-version arguments need to be passed to the
--revision (Git commit hash, SVN revision, etc) can be passed as
well to store the version control revision in the newly created Software