From dbdb26ae1fa45cec88f1b9ea0353b3d0a3c39f56 Mon Sep 17 00:00:00 2001 From: JF Date: Sun, 7 Jun 2020 14:10:17 +0200 Subject: [PATCH] DfuService : fix Magic number : incorrect values were written in memory. --- src/Components/Ble/DfuService.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Components/Ble/DfuService.cpp b/src/Components/Ble/DfuService.cpp index e4dcdf38..ff899e6f 100644 --- a/src/Components/Ble/DfuService.cpp +++ b/src/Components/Ble/DfuService.cpp @@ -372,13 +372,13 @@ void DfuService::DfuImage::Append(uint8_t *data, size_t size) { if(bufferWriteIndex > 0 && totalWriteIndex + bufferWriteIndex == totalSize) { spiNorFlash.Write(writeOffset + totalWriteIndex, tempBuffer, bufferWriteIndex); totalWriteIndex += bufferWriteIndex; - if (totalSize < maxSize); + if (totalSize < maxSize) 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, 0x7fefd260, 0x0f505235,