From 2ba1a053a54bc86a1c89da074d3e971dd2e8c85b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 19 Mar 2019 11:56:11 +0100 Subject: [PATCH] [ion] Flash: between data write operations or accesses to FLASH_CR, issue a DSB instruction to guarantee the completion of the operation --- ion/src/device/shared/drivers/flash.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ion/src/device/shared/drivers/flash.cpp b/ion/src/device/shared/drivers/flash.cpp index 03cceac2d..7a3a0db1d 100644 --- a/ion/src/device/shared/drivers/flash.cpp +++ b/ion/src/device/shared/drivers/flash.cpp @@ -1,4 +1,5 @@ #include "flash.h" +#include #include namespace Ion { @@ -8,6 +9,9 @@ namespace Flash { using namespace Regs; static inline void wait() { + /* Issue a DSB instruction to guarantee the completion of a previous access + * to FLASH_CR register or data write operation. (RM0431) */ + Cache::dsb(); // Wait for pending Flash operations to complete while (FLASH.SR()->getBSY()) { }