DfuService : fix Magic number : incorrect values were written in memory.

This commit is contained in:
JF 2020-06-07 14:10:17 +02:00
parent 2170800d76
commit dbdb26ae1f

View File

@ -372,13 +372,13 @@ void DfuService::DfuImage::Append(uint8_t *data, size_t size) {
if(bufferWriteIndex > 0 && totalWriteIndex + bufferWriteIndex == totalSize) { if(bufferWriteIndex > 0 && totalWriteIndex + bufferWriteIndex == totalSize) {
spiNorFlash.Write(writeOffset + totalWriteIndex, tempBuffer, bufferWriteIndex); spiNorFlash.Write(writeOffset + totalWriteIndex, tempBuffer, bufferWriteIndex);
totalWriteIndex += bufferWriteIndex; totalWriteIndex += bufferWriteIndex;
if (totalSize < maxSize); if (totalSize < maxSize)
WriteMagicNumber(); WriteMagicNumber();
} }
} }
void DfuService::DfuImage::WriteMagicNumber() { void DfuService::DfuImage::WriteMagicNumber() {
static constexpr uint32_t magic[4] = { uint32_t magic[4] = { // TODO When this variable is a static constexpr, the values written to the memory are not correct. Why?
0xf395c277, 0xf395c277,
0x7fefd260, 0x7fefd260,
0x0f505235, 0x0f505235,