diff options
author | David Crocker <dcrocker@eschertech.com> | 2020-12-08 18:00:16 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2020-12-08 18:00:16 +0300 |
commit | 18e0c36b8f8a2181e6ca9122a6a138fd1b047466 (patch) | |
tree | bd0adb3badaba152fcf82ba7d3230bae6742cb6b | |
parent | 6cd02ea698d62e030c214cde9868743454632d7a (diff) |
Changed flash_write_user_signature to avoid using a static 512b buffer
-rw-r--r-- | src/Hardware/NonVolatileMemory.cpp | 2 | ||||
-rw-r--r-- | src/Movement/Move.cpp | 3 | ||||
-rw-r--r-- | src/RepRapFirmware.cpp | 24 | ||||
-rw-r--r-- | src/RepRapFirmware.h | 24 |
4 files changed, 4 insertions, 49 deletions
diff --git a/src/Hardware/NonVolatileMemory.cpp b/src/Hardware/NonVolatileMemory.cpp index f5753d2a..72b91bd5 100644 --- a/src/Hardware/NonVolatileMemory.cpp +++ b/src/Hardware/NonVolatileMemory.cpp @@ -75,7 +75,7 @@ void NonVolatileMemory::EnsureWritten() noexcept if (state == NvmState::writeNeeded) { # if SAM4E || SAM4S || SAME70 - flash_write_user_signature(&buffer, sizeof(buffer)/sizeof(uint32_t)); + flash_write_user_signature(reinterpret_cast<const uint32_t*>(&buffer)); # elif defined(__LPC17xx__) LPC_WriteSoftwareResetData(slot, buffer, sizeof(buffer)); # else diff --git a/src/Movement/Move.cpp b/src/Movement/Move.cpp index 8a17f934..49b9ec0b 100644 --- a/src/Movement/Move.cpp +++ b/src/Movement/Move.cpp @@ -207,6 +207,9 @@ void Move::Exit() noexcept { StepTimer::DisableTimerInterrupt(); mainDDARing.Exit(); +#if SUPPORT_ASYNC_MOVES + auxDDARing.Exit(); +#endif #if SUPPORT_LASER || SUPPORT_IOBITS delete laserTask; laserTask = nullptr; diff --git a/src/RepRapFirmware.cpp b/src/RepRapFirmware.cpp index 48827206..7f1638cf 100644 --- a/src/RepRapFirmware.cpp +++ b/src/RepRapFirmware.cpp @@ -261,30 +261,6 @@ void delay(uint32_t ms) noexcept vTaskDelay(ms); } -// Optimised version of memcpy for when we know that the source and destination are 32-bit aligned and a whole number of 32-bit words are to be copied -void __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns"))) memcpyu32(uint32_t *dst, const uint32_t *src, size_t numWords) noexcept -{ - while (numWords >= 4) - { - *dst++ = *src++; - *dst++ = *src++; - *dst++ = *src++; - *dst++ = *src++; - numWords -= 4; - } - - if ((numWords & 2) != 0) - { - *dst++ = *src++; - *dst++ = *src++; - } - - if ((numWords & 1) != 0) - { - *dst++ = *src++; - } -} - #endif // Convert a float to double for passing to printf etc. If it is a NaN or infinity, convert it to 9999.9 to avoid getting JSON parse errors. diff --git a/src/RepRapFirmware.h b/src/RepRapFirmware.h index c54e5fb0..c325fc8d 100644 --- a/src/RepRapFirmware.h +++ b/src/RepRapFirmware.h @@ -72,30 +72,6 @@ const char *SafeStrptime(const char *buf, const char *format, struct tm *timeptr // Functions needed for builds that use CoreNG. Not needed when using CoreN2G. void delay(uint32_t ms) noexcept; -static inline void WatchdogReset() noexcept -{ - WDT->WDT_CR = WDT_CR_KEY_PASSWD | WDT_CR_WDRSTT; -} - -// Optimised version of memcpy for use when the source and destination are known to be 32-bit aligned and a whole number of 32-bit words is to be copied -void memcpyu32(uint32_t *dst, const uint32_t *src, size_t numWords) noexcept; - -// memcpy for int32_t arrays -inline void memcpyi32(int32_t *dst, const int32_t *src, size_t numWords) noexcept -{ - static_assert(sizeof(int32_t) == sizeof(uint32_t)); - static_assert(alignof(int32_t) == alignof(uint32_t)); - memcpyu32(reinterpret_cast<uint32_t*>(dst), reinterpret_cast<const uint32_t*>(src), numWords); -} - -// memcpy for float arrays -inline void memcpyf(float *dst, const float *src, size_t numFloats) noexcept -{ - static_assert(sizeof(float) == sizeof(uint32_t)); - static_assert(alignof(float) == alignof(uint32_t)); - memcpyu32(reinterpret_cast<uint32_t*>(dst), reinterpret_cast<const uint32_t*>(src), numFloats); -} - #endif #define SPEED_CRITICAL __attribute__((optimize("O2"))) |