|
|
- // -----------------------------------------------------------------------------
- // Save crash info
- // Taken from krzychb EspSaveCrash
- // https://github.com/krzychb/EspSaveCrash
- // -----------------------------------------------------------------------------
-
- #pragma once
-
- #define SAVE_CRASH_EEPROM_OFFSET 0x0100 // initial address for crash data
-
- /**
- * Structure of the single crash data set
- *
- * 1. Crash time
- * 2. Restart reason
- * 3. Exception cause
- * 4. epc1
- * 5. epc2
- * 6. epc3
- * 7. excvaddr
- * 8. depc
- * 9. adress of stack start
- * 10. adress of stack end
- * 11. stack trace size
- * 12. stack trace bytes
- * ...
- */
- #define SAVE_CRASH_CRASH_TIME 0x00 // 4 bytes
- #define SAVE_CRASH_RESTART_REASON 0x04 // 1 byte
- #define SAVE_CRASH_EXCEPTION_CAUSE 0x05 // 1 byte
- #define SAVE_CRASH_EPC1 0x06 // 4 bytes
- #define SAVE_CRASH_EPC2 0x0A // 4 bytes
- #define SAVE_CRASH_EPC3 0x0E // 4 bytes
- #define SAVE_CRASH_EXCVADDR 0x12 // 4 bytes
- #define SAVE_CRASH_DEPC 0x16 // 4 bytes
- #define SAVE_CRASH_STACK_START 0x1A // 4 bytes
- #define SAVE_CRASH_STACK_END 0x1E // 4 bytes
- #define SAVE_CRASH_STACK_SIZE 0x22 // 2 bytes
- #define SAVE_CRASH_STACK_TRACE 0x24 // variable
-
- constexpr size_t crashUsedSpace() {
- return (SAVE_CRASH_EEPROM_OFFSET + SAVE_CRASH_STACK_SIZE + 2);
- }
-
-
- void crashClear();
- void crashDump();
- void crashSetup();
|