From: Jean THOMAS Date: Thu, 11 Jun 2020 10:58:34 +0000 (+0200) Subject: Make memory test code more verbose X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b3849d341e81903245b9f851da98c031e7dbd32f;p=gram.git Make memory test code more verbose --- diff --git a/examples/firmware/main.c b/examples/firmware/main.c index 6c12a4e..4ede195 100644 --- a/examples/firmware/main.c +++ b/examples/firmware/main.c @@ -40,6 +40,26 @@ void uart_writestr(const char *c) { } } +void memcpy(void *dest, void *src, size_t n) { + int i; + //cast src and dest to char* + char *src_char = (char *)src; + char *dest_char = (char *)dest; + for (i=0; i> 4) & 0xF]); + uart_write(lut[val_arr[3-i] & 0xF]); + } +} + void isr(void) { } @@ -52,15 +72,22 @@ int main(void) { gram_init(&ctx, (void*)0x10000000, (void*)0x00009000, (void*)0x00008000); uart_writestr("done\n"); - uart_writestr("DRAM test... "); + uart_writestr("DRAM test... \n"); volatile uint32_t *ram = 0x10000000; for (size_t i = 0; i < 1000; i++) { - ram[i] = 0xdeadbeef << (i%32); + uart_writestr("Writing to 0x"); + uart_writeuint32(&ram[i]); + uart_write('\n'); + ram[i] = 0xaaaaaaaa; } for (size_t i = 0; i < 1000; i++) { - if (ram[i] != 0xdeadbeef << (i%32)) { - uart_writestr("fail\n"); + if (ram[i] != 0xdeadbeef) { + uart_writestr("fail : *(0x"); + uart_writeuint32(&ram[i]); + uart_writestr(") = "); + uart_writeuint32(ram[i]); + uart_write('\n'); } } uart_writestr("done\n");