feat(Telemetry): backtrace, abort reason and pre-crash snapshot in crash reports (F-070)

Crash reports only carried the coredump's PC/cause/vaddr, which for every
abort() is panic_abort()'s own write to 0x0 - so all aborts looked the same.

- Read the coredump backtrace (up to 16 PCs) and crashing ELF SHA prefix
- Wrap esp_system_abort (-Wl,--wrap) to keep the abort/assert/stack-overflow
  message in RTC_NOINIT memory across the reboot
- TelemetryTask snapshots uptime/free heap/largest block/min free heap into
  the same RTC block every second
- Reported in MQTT boot_report and SD boot log as crash.backtrace,
  crash.elf_sha256 and a new pre_crash object (additive)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-30 16:08:34 +03:00
co-authored by Claude Opus 5.5
parent bf4a04d6f4
commit 09f562cf1d
8 changed files with 217 additions and 8 deletions
@@ -583,12 +583,9 @@ void CommunicationRouter::reportBootOnce() {
payload["free_heap"] = (uint32_t)ESP.getFreeHeap();
const CrashReport& crash = _telemetry->getCrashReport();
if (crash.available) {
JsonObject crashObj = payload["crash"].to<JsonObject>();
crashObj["task"] = crash.taskName;
crashObj["pc"] = crash.pc;
crashObj["exc_cause"] = crash.excCause;
crashObj["exc_vaddr"] = crash.excVaddr;
if (crash.available) _telemetry->writeCrashJson(payload["crash"].to<JsonObject>());
if (_telemetry->getPreCrashSnapshot().available) {
_telemetry->writePreCrashJson(payload["pre_crash"].to<JsonObject>());
}
publishInfo("boot_report", payload);