-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Core Dump support via CrashCatcher and heap storage #210
Conversation
The module does not implement any GPIO blink behavior anymore, since it's out-of-scope. |
1a539ee
to
47ae3ef
Compare
I added a HeapTable input iterator, which completely hides the fault storage from the heap initializations as well as deduplicated some code and makes it readable. |
The F469 example correctly allows heap usage after hardfault reboot and before reporting:
You can see the the first allocation, then a hardfault is triggered, the device reboots, allocates in a different spot, dumps the core, then reboots again, and can use the full heap again. Works for all allocators transparently: newlib
and block allocator:
|
80a34fc
to
64d885b
Compare
1641b04
to
29d541e
Compare
pass | ||
source = str(source[0]) | ||
binary = os.path.splitext(source)[0]+".bin" | ||
subprocess.call(env.subst("$OBJCOPY -O binary {} {}".format(source, binary)), shell=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dergraaf I need the binary to compute the firmware hash, but I couldn’t figure out how to depend on env.Bin(source)
properly. Any ideas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general that's what env.Depends()
is for. I can look into it in more detail tomorrow, at the moment I don't have my laptop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I got to env.Depends
too, but I just didn't understand SCons enough to know when to call this? I tried something like env.Depends(action, "path/to/artifact.bin")
in the store_artifact
function but I didn't get that to work. SCons is super undocumented.
29d541e
to
8e778fc
Compare
I've added SCons support for caching the uploaded firmware ELF and binary files in the build directory and allow you to retrieve it using the firmware CRC32 sum: Of course you still have to manually copy the coredump data into the I'm quite happy with this solution, it's also nicely documented I think. |
c44241e
to
54e879b
Compare
54e879b
to
dfb7e34
Compare
This uses the CrashCatcher to generate the core dump, store it in volatile memory and reboots so that the report is available for the application to use under normal operating conditions (ie. not in the HardFault handler).
This works as follows:
:platform:fault
module which stores the report in the memory sections designated for the heap as defined by the linkerscript's.table.heap
section, effectively overwriting the heap.This gives significantly more freedom to the application for responding to a non-recoverable fault event, even allowing the use of dynamic memory for more complex communication protocols like XPCC over CAN.
The
:platform:fault
module may be configured to output just the core, or the core and stack or the core, stack and static data memories (.data
and.bss
sections), depending on how much heap memory is available.The resulting report is to be used with the
CrashDebug
program that support post-mortem debugging.TODO:
postmortem
tool with artifact caching based on firmware hashThe current user facing reporting API is onlyFaultReporter::report(lambda)
which is a synchronous API forcing sequential reading and a reboot afterwards. This is a convenience API for synchronous UART reporting, but doesn't support sending the report in smaller chunks over an asynchronous channel like XPCC over CAN.Added an InputIterator for reading the data however you want it.
cc @rleh @dergraaf @chris-durand