Coredump Collection

This tutorial will cover integrating the coredump collection functionality of the Memfault Firmware SDK into your system.

With coredumps integrated, variable, register, & task state can all be collected at the time a fault, assert, or unexpected error takes place.

Prerequisite

This guide assumes you have already completed the minimal integration of the Memfault SDK. If you have not, check out the appropriate guide in the table below.

MCU ArchitectureGetting Started Guide
ARM Cortex-MARM Cortex-M Integration Guide
nRF Connect SDKnRF Connect SDK Integration Guide
ESP32 ESP-IDFESP32 ESP-IDF Integration Guide
ESP8266ESP8266 RTOS Integration Guide

Platform specific storage region for crash data#

When a crash takes place, a snapshot of the state needs to be stored in a storage area that persists across a device reboot.

We typically recommend starting with the RAM backed Coredump port from memfault_platform_ram_backed_coredump.c

By default this will only save the top of the stack at the time of crash but it lets you quickly get coredumps up and running and get a feel for how things work.

Coredump data can also be stored to any other backing storage (eMMC, external NOR flash, internal flash, etc). We have a number of ports available for different MCUs in the ports directory of the memfault-firmware-sdk or you can add your own port by implementing the required dependencies

Rebooting after a coredump#

At the very end of saving a coredump, the memfault_platform_reboot() function implemented as part of your initial port will be called. From here any final system cleanup can be performed before restarting the system