diff --git a/litex/soc/software/libbase/memtest.c b/litex/soc/software/libbase/memtest.c index a5c9ef89d..a7d01c6a2 100644 --- a/litex/soc/software/libbase/memtest.c +++ b/litex/soc/software/libbase/memtest.c @@ -15,6 +15,10 @@ #ifndef MEMTEST_DEBUG_MAX_ERRORS #define MEMTEST_DEBUG_MAX_ERRORS 400 #endif +// Retry reading when an error occurs. Allows to spot if errors happen during read or write. +#ifndef MEMTEST_DATA_RETRIES +#define MEMTEST_DATA_RETRIES 0 +#endif #define KIB 1024 #define MIB (KIB*1024) @@ -184,6 +188,7 @@ int memtest_data(unsigned int *addr, unsigned long size, int random, struct memt { volatile unsigned int *array = addr; int i, errors; + int j, ok_at; int progress; unsigned int seed_32; unsigned int rdata; @@ -212,7 +217,18 @@ int memtest_data(unsigned int *addr, unsigned long size, int random, struct memt seed_32 = 1; for(i=0; i 0) + printf("@%p: Redeemed at %d. attempt\n", addr + i, ok_at + 1); + if(rdata != seed_32) { errors++; if (config != NULL && config->on_error != NULL) {