diff options
author | Christian Hammacher <bmasterc@gmail.com> | 2021-07-29 20:04:19 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-07-31 09:51:52 +0300 |
commit | cef4926d6e6d004550e2dec20904de75886452ed (patch) | |
tree | 866dac9271f0dfbf5fb66e33bc880e0e5ed3422c /src/Hardware/ExceptionHandlers.cpp | |
parent | 2779dc5e86bed31e94b04aa3668c83ffca9f06db (diff) |
Further improvements
Added support for expression lists (untested in standalone mode)
M23/M32 are invoked again by DSF in SBC mode
Increased SBC task priority
Bug fix: CAN diagnostics output extra NL
Bug fix: M999 P"ERASE" was not working on the Mini5+ series
Diffstat (limited to 'src/Hardware/ExceptionHandlers.cpp')
-rw-r--r-- | src/Hardware/ExceptionHandlers.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Hardware/ExceptionHandlers.cpp b/src/Hardware/ExceptionHandlers.cpp index 640c0a41..1413108d 100644 --- a/src/Hardware/ExceptionHandlers.cpp +++ b/src/Hardware/ExceptionHandlers.cpp @@ -15,6 +15,12 @@ # include <Reset.h> #endif +#if SAME5x +// Magic address and value to launch the uf2 bootloader on failure, see inc/uf2.h in uf2-samdx1 repository +# define DBL_TAP_PTR ((volatile uint32_t *)(HSRAM_ADDR + HSRAM_SIZE - 4)) +# define DBL_TAP_MAGIC 0xf01669ef // Randomly selected, adjusted to have first and last bit set +#endif + // 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. [[noreturn]] void SoftwareReset(SoftwareResetReason initialReason, const uint32_t *stk) noexcept { @@ -31,7 +37,8 @@ if (initialReason == SoftwareResetReason::erase) { #if SAME5x - //TODO invalidate flash so the USB bootloader runs + // Start from uf2 bootloader next time. This pretends the reset button has been pressed twice in short succession + *DBL_TAP_PTR = DBL_TAP_MAGIC; #else EraseAndReset(); #endif |