From 4817609ec263894282c341c59f386a236ce92cee Mon Sep 17 00:00:00 2001 From: Jean THOMAS Date: Mon, 3 Aug 2020 13:02:07 +0200 Subject: [PATCH] Add auto calibration result check, abort memtest if more than 10 fails --- examples/firmware/main.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/examples/firmware/main.c b/examples/firmware/main.c index 32a53ca..0067dff 100644 --- a/examples/firmware/main.c +++ b/examples/firmware/main.c @@ -66,6 +66,7 @@ void isr(void) { int main(void) { const int kNumIterations = 65536; + int res, failcnt = 0; uart_writestr("Firmware launched...\n"); uart_writestr("DRAM init... "); @@ -81,7 +82,11 @@ int main(void) { uart_writestr("done\n"); uart_writestr("Auto calibrating... "); - gram_generate_calibration(&ctx, &profile); + res = gram_generate_calibration(&ctx, &profile); + if (res != GRAM_ERR_NONE) { + uart_writestr("failed\n"); + while (1); + } gram_load_calibration(&ctx, &profile); uart_writestr("done\n"); @@ -105,6 +110,11 @@ int main(void) { uart_writestr(") = "); uart_writeuint32(ram[i]); uart_write('\n'); + failcnt++; + + if (failcnt > 10) { + uart_writestr("Test canceled (more than 10 errors)\n"); + } } } uart_writestr("done\n"); -- 2.30.2