diff options
author | David Crocker <dcrocker@eschertech.com> | 2020-09-07 17:51:44 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2020-09-07 17:51:44 +0300 |
commit | 78593ec1d7141949f7597590bd12bf12e12619ca (patch) | |
tree | 01988c1cbec7244641461671ec0441de84a7734b /src/Hardware/NonVolatileMemory.cpp | |
parent | 7b485e5189f943cbab6d8bf32339b03ee8ccc0ca (diff) |
Fixes, mostly for software resets
Reduced stack length in software reset data to 27 words because we can't
print more
Avoid some unaligned accesses to CAN data etc.
Add dwell time before M122 P100x operations that cause a reset, so allow
the HTTP response to be sent back to DWC, otherwise it will retry
Fixed issue with NVM not getting initialised after a firmware upgrade
Binary parser only pads arrays out if exactly one value was given
Diffstat (limited to 'src/Hardware/NonVolatileMemory.cpp')
-rw-r--r-- | src/Hardware/NonVolatileMemory.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Hardware/NonVolatileMemory.cpp b/src/Hardware/NonVolatileMemory.cpp index 08e63536..6a9232ae 100644 --- a/src/Hardware/NonVolatileMemory.cpp +++ b/src/Hardware/NonVolatileMemory.cpp @@ -54,6 +54,7 @@ void NonVolatileMemory::EnsureWritten() noexcept #if SAME5x if (state >= NvmState::writeNeeded) { + // No need to erase on the SAME5x because the EEPROM emulation manages it while (NVMCTRL->SEESTAT.bit.BUSY) { } memcpy(reinterpret_cast<uint8_t*>(SEEPROM_ADDR), &buffer, sizeof(buffer)); state = NvmState::clean; @@ -107,7 +108,10 @@ SoftwareResetData* NonVolatileMemory::AllocateResetDataSlot() noexcept { if (buffer.resetData[i].IsVacant()) { - state = NvmState::writeNeeded; // assume the caller will write to the allocated slot + if (state == NvmState::clean) // need this test because state may already be EraseAndWriteNeeded after EnsureRead + { + state = NvmState::writeNeeded; // assume the caller will write to the allocated slot + } return &buffer.resetData[i]; } } |