From ba26fee1a6df549a94a603f584ccbd0d9f3e78f0 Mon Sep 17 00:00:00 2001 From: Jouni Ukkonen Date: Tue, 26 Nov 2024 13:15:38 +0200 Subject: [PATCH] arch/arm64/imx9: Replace memcpy by while loop libc memcpy cannot access fspi memory space correctly remove unnecessary debugassert Signed-off-by: Jouni Ukkonen --- arch/arm64/src/imx9/imx9_flexspi_nor.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/arm64/src/imx9/imx9_flexspi_nor.c b/arch/arm64/src/imx9/imx9_flexspi_nor.c index f117207d612b2..bc4ac01afe78b 100644 --- a/arch/arm64/src/imx9/imx9_flexspi_nor.c +++ b/arch/arm64/src/imx9/imx9_flexspi_nor.c @@ -790,12 +790,15 @@ static ssize_t imx9_flexspi_nor_read(struct mtd_dev_s *dev, } src = priv->ahb_base + offset; - DEBUGASSERT(((uintptr_t)src & ALIGN_MASK) == 0); up_invalidate_dcache((uintptr_t)buffer, (uintptr_t)buffer + ALIGN_UP(nbytes)); + int n = nbytes; - memcpy(buffer, src, nbytes); + while (n-- > 0) + { + *buffer++ = *src++; + } up_clean_dcache((uintptr_t)buffer, (uintptr_t)buffer + ALIGN_UP(nbytes));