HAL_ChibiOS: fetch crash_dump stored in flash
This commit is contained in:
parent
f9f47cbeeb
commit
29568a23ae
@ -698,3 +698,22 @@ void Util::log_stack_info(void)
|
||||
last_tp = tp;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(HAL_CRASH_DUMP_FLASHPAGE)
|
||||
void Util::last_crash_dump(ExpandingString &str) const
|
||||
{
|
||||
// get dump size
|
||||
uint32_t size = stm32_crash_dump_size();
|
||||
char* dump_start = (char*)stm32_flash_getpageaddr(HAL_CRASH_DUMP_FLASHPAGE);
|
||||
if (!(dump_start[0] == 0x63 && dump_start[1] == 0x43)) {
|
||||
// there's no valid Crash Dump
|
||||
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "No Crash Detected!");
|
||||
return;
|
||||
}
|
||||
if (size == 0xFFFFFFFF) {
|
||||
GCS_SEND_TEXT(MAV_SEVERITY_ERROR, "Crash Dump incomplete, dumping what we got!");
|
||||
size = stm32_flash_getpagesize(HAL_CRASH_DUMP_FLASHPAGE);
|
||||
}
|
||||
str.append(dump_start, size);
|
||||
}
|
||||
#endif
|
||||
|
@ -135,4 +135,10 @@ private:
|
||||
|
||||
// log info on stack usage
|
||||
void log_stack_info(void) override;
|
||||
|
||||
#if defined(HAL_CRASH_DUMP_FLASHPAGE)
|
||||
// get last crash dump
|
||||
void last_crash_dump(ExpandingString &str) const override;
|
||||
#endif
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user