From: Jean THOMAS Date: Mon, 3 Aug 2020 11:02:07 +0000 (+0200) Subject: Add auto calibration result check, abort memtest if more than 10 fails X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4817609ec263894282c341c59f386a236ce92cee;p=gram.git Add auto calibration result check, abort memtest if more than 10 fails --- 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");