From: Jean THOMAS Date: Wed, 29 Jul 2020 16:09:47 +0000 (+0200) Subject: Fix peripheral addresses, improve memory testing X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7e26291bb304c0a0594665e7b45a33a3fcdcac95;p=gram.git Fix peripheral addresses, improve memory testing --- diff --git a/examples/firmware/link.ld b/examples/firmware/link.ld index 1cc22fe..b8ef93b 100644 --- a/examples/firmware/link.ld +++ b/examples/firmware/link.ld @@ -3,8 +3,8 @@ ENTRY(_start) MEMORY { - rom : ORIGIN = 0x00007000, LENGTH = 0x1000 - ram : ORIGIN = 0x00004000, LENGTH = 0x1000 + rom : ORIGIN = 0x00000000, LENGTH = 0x1000 + ram : ORIGIN = 0x00001000, LENGTH = 0x1000 } SECTIONS diff --git a/examples/firmware/main.c b/examples/firmware/main.c index 79849de..85d59bc 100644 --- a/examples/firmware/main.c +++ b/examples/firmware/main.c @@ -28,7 +28,7 @@ struct uart_regs { void uart_write(char c) { - struct uart_regs *regs = 0x5000; + struct uart_regs *regs = 0x2000; while (!read32(®s->tx_rdy)); write32(®s->tx_data, c); } @@ -78,11 +78,11 @@ int main(void) { uart_writestr("Writing to 0x"); uart_writeuint32(&ram[i]); uart_write('\n'); - ram[i] = 0xDEADBEEF; + ram[i] = 0xDEAF0000 | i*4; } for (size_t i = 0; i < 1000; i++) { - if (ram[i] != 0xDEADBEEF) { + if (ram[i] != (0xDEAF0000 | i*4)) { uart_writestr("fail : *(0x"); uart_writeuint32(&ram[i]); uart_writestr(") = ");