Prusa-Firmware/Firmware/xflash_dump.h
Yuri D'Elia 928c7211ad emergency handlers: always save SP _at_ the crash location
Save SP which is closest to the crash location, which simplifies
debugging. For serial_dump, write SP just before the dump.
For xfdump, save SP in the dump header.

This makes xfdump_dump and xfdump_full_dump_and_reset() equivalent for
stack debugging.
2021-06-15 11:47:27 +02:00

24 lines
616 B
C

// XFLASH dumper
#pragma once
#include "xflash_layout.h"
enum class dump_crash_reason : uint8_t
{
manual = 0,
stack_error,
watchdog,
bad_isr,
};
#ifdef XFLASH_DUMP
void xfdump_reset(); // reset XFLASH dump state
void xfdump_dump(uint16_t sp); // create a new SRAM memory dump
// return true if a dump is present, save type in "reason" if provided
bool xfdump_check_state(dump_crash_reason* reason = NULL);
// create a new dump containing registers and SRAM, then reset
void xfdump_full_dump_and_reset(
uint16_t sp, dump_crash_reason crash = dump_crash_reason::manual);
#endif