Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2020-09-05 13:08:54 +0300
committerDavid Crocker <dcrocker@eschertech.com>2020-09-05 13:08:54 +0300
commita3081c5866a3bfb5dd837bf4103a8476c5bb6ec3 (patch)
tree79c1a1e51dd0c25f33a7a5183792a1f1ec87b825 /src/Hardware/ExceptionHandlers.cpp
parent6d7486602f47d18d8ff3c887f6253d470cf9711e (diff)
Improved the software reset data amd fixed displayed last reset time
Also fixed by with random initial H and L values on Duet Maestro and Duet 3 Mini5+
Diffstat (limited to 'src/Hardware/ExceptionHandlers.cpp')
-rw-r--r--src/Hardware/ExceptionHandlers.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/Hardware/ExceptionHandlers.cpp b/src/Hardware/ExceptionHandlers.cpp
index 02b5e29d..4eff7345 100644
--- a/src/Hardware/ExceptionHandlers.cpp
+++ b/src/Hardware/ExceptionHandlers.cpp
@@ -11,7 +11,7 @@
#include <Hardware/NonVolatileMemory.h>
#include <Cache.h>
-// Perform a software reset. 'stk' points to the program counter on the stack if the cause is an exception, otherwise it is nullptr.
+// Perform a software reset. 'stk' points to the exception stack (r0 r1 r2 r3 r12 lr pc xPSR) if the cause is an exception, otherwise it is nullptr.
void SoftwareReset(uint16_t reason, const uint32_t *stk) noexcept
{
cpu_irq_disable(); // disable interrupts before we call any flash functions. We don't enable them again.
@@ -65,12 +65,7 @@ void SoftwareReset(uint16_t reason, const uint32_t *stk) noexcept
// Record the reason for the software reset
NonVolatileMemory mem;
SoftwareResetData * const srd = mem.AllocateResetDataSlot();
-
-#if defined(__LPC17xx__)
- srd->Populate(reason, (uint32_t)realTime, stk);
-#else
- srd->Populate(reason, (uint32_t)reprap.GetPlatform().GetDateTime(), stk);
-#endif
+ srd->Populate(reason, stk);
mem.EnsureWritten();
}
@@ -88,7 +83,7 @@ void SoftwareReset(uint16_t reason, const uint32_t *stk) noexcept
// so they escalate to a Hard Fault and we don't need to provide separate exception handlers for them.
extern "C" [[noreturn]] void hardFaultDispatcher(const uint32_t *pulFaultStackAddress) noexcept
{
- SoftwareReset((uint16_t)SoftwareResetReason::hardFault, pulFaultStackAddress + 5);
+ SoftwareReset((uint16_t)SoftwareResetReason::hardFault, pulFaultStackAddress);
}
// The fault handler implementation calls a function called hardFaultDispatcher()
@@ -111,7 +106,7 @@ void HardFault_Handler() noexcept
extern "C" [[noreturn]] void memManageDispatcher(const uint32_t *pulFaultStackAddress) noexcept
{
- SoftwareReset((uint16_t)SoftwareResetReason::memFault, pulFaultStackAddress + 5);
+ SoftwareReset((uint16_t)SoftwareResetReason::memFault, pulFaultStackAddress);
}
// The fault handler implementation calls a function called memManageDispatcher()
@@ -134,7 +129,7 @@ void MemManage_Handler() noexcept
extern "C" [[noreturn]] void wdtFaultDispatcher(const uint32_t *pulFaultStackAddress) noexcept
{
- SoftwareReset((uint16_t)SoftwareResetReason::wdtFault, pulFaultStackAddress + 5);
+ SoftwareReset((uint16_t)SoftwareResetReason::wdtFault, pulFaultStackAddress);
}
#ifdef __LPC17xx__
@@ -161,7 +156,7 @@ void WDT_Handler() noexcept
extern "C" [[noreturn]] void otherFaultDispatcher(const uint32_t *pulFaultStackAddress) noexcept
{
- SoftwareReset((uint16_t)SoftwareResetReason::otherFault, pulFaultStackAddress + 5);
+ SoftwareReset((uint16_t)SoftwareResetReason::otherFault, pulFaultStackAddress);
}
// 2017-05-25: A user is getting 'otherFault' reports, so now we do a stack dump for those too.