arch/arm/samv7/sam_progmem: insert DMB instruction into data write loop

This change fix the regression that was introduced with
https://github.com/apache/incubator-nuttx/pull/4904

In case if D-Cache in configured in Write-Through mode there is
Cortex-M7 erata 1313001 that describes a situation when linefill
buffer or cache contains stale data. Even if progmem write loop
does not fully matches the description there is a possibility
to program stale data if there is no DMB instruction after each
write operation to progmem latch buffer.

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
Petro Karashchenko 2022-02-04 19:42:13 +02:00 committed by Xiang Xiao
parent 74a4394352
commit e545c440f4

View File

@ -582,6 +582,10 @@ ssize_t up_progmem_write(size_t address, const void *buffer, size_t buflen)
for (i = 0; i < SAMV7_PAGE_WORDS; i++)
{
*dest++ = *src++;
#ifdef CONFIG_ARMV7M_DCACHE_WRITETHROUGH
ARM_DMB();
#endif
}
/* Flush the data cache to memory */