Skip to content

Commit e4d6dd8

Browse files
labrickmysterywolf
authored andcommitted
[libcpu][arm] fix rt_hw_cpu_dcache_ops clean invalid bug
clean_invalid must be set at the same time, and call clean_invalid, or call clean/invalid
1 parent 5c76556 commit e4d6dd8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

libcpu/arm/cortex-m7/cpu_cache.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,9 @@ void rt_hw_cpu_dcache_ops(int ops, void* addr, int size)
6969
{
7070
rt_uint32_t startAddr = (rt_uint32_t)addr & (rt_uint32_t)~(L1CACHE_LINESIZE_BYTE - 1);
7171
rt_uint32_t size_byte = size + (rt_uint32_t)addr - startAddr;
72+
rt_uint32_t clean_invalid = RT_HW_CACHE_FLUSH | RT_HW_CACHE_INVALIDATE;
7273

73-
if (ops & (RT_HW_CACHE_FLUSH | RT_HW_CACHE_INVALIDATE))
74+
if ((ops & clean_invalid) == clean_invalid)
7475
{
7576
SCB_CleanInvalidateDCache_by_Addr((uint32_t *)startAddr, size_byte);
7677
}

0 commit comments

Comments
 (0)