cmd: mem: fix range of bitflip test
The bitflip test uses two equal sized memory buffers. This is achieved
by splitting the range of memory into two pieces. The address of the
second buffer, as well as the length of each buffer, were not correctly
calculated. This caused bitflip test to access beyond the end of range.
This patch fixes the pointer arithmetic problem.
A second problem arises because u-boot "mtest" command expects the
ending address to be inclusive. When computing (end - start) this
results in missing 1 byte of the requested length. The bitflip test
expects a count rather than an "ending" address. Thus it fails to test
the last word of the requested range. Fixed by using (end - start + 1).
Added Kconfig option to optionally disable the bitflip test, since it
does add significantly to the time taken for "mtest".
Fixes: 8e434cb705d463bc8cff935160e4fb4c77cb99ab ("cmd: mem: Add bitflip
memory test to alternate mtest")
Signed-off-by: Ralph Siemsen <ralph.siemsen@linaro.org>
Reviewed-by: Stefan Roese <sr@denx.de>
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 0761dbb..0c984d7 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -777,6 +777,18 @@
help
Use a more complete alternative memory test.
+if SYS_ALT_MEMTEST
+
+config SYS_ALT_MEMTEST_BITFLIP
+ bool "Bitflip test"
+ default y
+ help
+ The alternative memory test includes bitflip test since 2020.07.
+ The bitflip test significantly increases the overall test time.
+ Bitflip test can optionally be disabled here.
+
+endif
+
config SYS_MEMTEST_START
hex "default start address for mtest"
default 0