File syn_coredump.h¶
FileList > src > syntropic > system > syn_coredump.h
Go to the source code of this file
Persistent core dump — saves fault context to flash. More...
#include "../common/syn_defs.h"#include "syn_fault.h"#include <stdbool.h>#include <stdint.h>
Classes¶
| Type | Name |
|---|---|
| struct | SYN_CoreDump Persistent core dump — written to flash on fault. |
Public Functions¶
| Type | Name |
|---|---|
| void | syn_coredump_clear (void) Clear the core dump from flash. |
| bool | syn_coredump_read (SYN_CoreDump * out) Read a core dump from flash. |
| void | syn_coredump_save (const SYN_FaultContext * ctx) Save a core dump to flash. |
Macros¶
| Type | Name |
|---|---|
| define | SYN_COREDUMP_MAGIC 0x43444D50uMagic number identifying a valid core dump ("CDMP"). |
| define | SYN_COREDUMP_STACK_SIZE 128 |
Detailed Description¶
Captures CPU register state and a partial stack snapshot during a hard fault and persists them to a reserved flash sector. On the next boot, the dump can be read back for post-mortem diagnostics.
Requires: SYN_USE_FAULT, CRC module, flash port.
** **
Define these in syn_config.h:
* SYN_COREDUMP_FLASH_ADDR — Start address of the reserved flash sector.
* SYN_COREDUMP_STACK_SIZE — Bytes of stack to capture (default 128).
** **
// In your HardFault handler:
syn_coredump_save(&fault_context);
// At boot:
SYN_CoreDump dump;
if (syn_coredump_read(&dump)) {
printf("Previous crash at PC=0x%08x, uptime=%lu ms\n",
dump.regs.pc, dump.uptime_ms);
syn_coredump_clear();
}
Public Functions Documentation¶
function syn_coredump_clear¶
Clear the core dump from flash.
Erases the reserved sector so subsequent reads return false.
function syn_coredump_read¶
Read a core dump from flash.
Validates the magic number and CRC. If valid, copies the dump into the output buffer.
Parameters:
outOutput buffer for the core dump.
Returns:
true if a valid core dump was found.
function syn_coredump_save¶
Save a core dump to flash.
Safe to call from a hard fault handler: no heap, no locks. Erases the reserved sector and writes the dump.
Parameters:
ctxRegister context captured at fault time.
Macro Definition Documentation¶
define SYN_COREDUMP_MAGIC¶
Magic number identifying a valid core dump ("CDMP").
define SYN_COREDUMP_STACK_SIZE¶
Bytes of stack to capture
The documentation for this class was generated from the following file src/syntropic/system/syn_coredump.h