diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-05-23 21:39:55 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-05-23 21:39:55 +0300 |
commit | 214d486c4c9fe3639f2f861605c89d1b0dc56a8f (patch) | |
tree | be75195ae98c77698a5951af7df71e386a342d92 /src/Hardware | |
parent | f055e129c4047bdba729db1c6ace6eb0a0a76698 (diff) |
Bug fix to crash handler (still 3.3RC3 candidate)
Tyhe crash handler was allocating the buffer for reading/writing flash
memory on the stack. When the crash handler was called in-process (e.g.
due to an assertion failure or a memory allocation failure), this
typically corrupted the task details.
Diffstat (limited to 'src/Hardware')
-rw-r--r-- | src/Hardware/ExceptionHandlers.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Hardware/ExceptionHandlers.cpp b/src/Hardware/ExceptionHandlers.cpp index 7253f5cf..640c0a41 100644 --- a/src/Hardware/ExceptionHandlers.cpp +++ b/src/Hardware/ExceptionHandlers.cpp @@ -8,6 +8,7 @@ #include "ExceptionHandlers.h" #include <Platform/RepRap.h> #include <Platform/Platform.h> +#include <Platform/Tasks.h> #include <Hardware/NonVolatileMemory.h> #include <Cache.h> #if SAME70 || SAM4S || SAM4E @@ -62,10 +63,10 @@ } // Record the reason for the software reset - NonVolatileMemory mem; - SoftwareResetData * const srd = mem.AllocateResetDataSlot(); + NonVolatileMemory * const mem = new(Tasks::GetNVMBuffer(stk)) NonVolatileMemory; + SoftwareResetData * const srd = mem->AllocateResetDataSlot(); srd->Populate(fullReason, stk); - mem.EnsureWritten(); + mem->EnsureWritten(); } #if defined(__LPC17xx__) |