From b3849d341e81903245b9f851da98c031e7dbd32f Mon Sep 17 00:00:00 2001 From: Jean THOMAS Date: Thu, 11 Jun 2020 12:58:34 +0200 Subject: [PATCH] Make memory test code more verbose --- examples/firmware/main.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) 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"); -- 2.30.2