From ce2b4fcfb9c2b5f7d4c8fc81e9897f32ef6885d8 Mon Sep 17 00:00:00 2001 From: Ruslan Bukin Date: Fri, 22 Apr 2016 16:15:58 +0000 Subject: [PATCH] Clear the DDR memory. This should be done by bootloaders, but they have no such feature yet. This fixes operation on Rocket Core and lowRISC. --- sys/conf/options.riscv | 1 + sys/riscv/riscv/locore.S | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/sys/conf/options.riscv b/sys/conf/options.riscv index c263bd86087..04046541615 100644 --- a/sys/conf/options.riscv +++ b/sys/conf/options.riscv @@ -2,3 +2,4 @@ RISCV opt_global.h VFP opt_global.h +DDR_CLEAR_SIZE opt_global.h diff --git a/sys/riscv/riscv/locore.S b/sys/riscv/riscv/locore.S index ef81686e85f..1c2063ad730 100644 --- a/sys/riscv/riscv/locore.S +++ b/sys/riscv/riscv/locore.S @@ -126,6 +126,17 @@ _start: csrr a0, mhartid bnez a0, mpentry +#if defined(DDR_CLEAR_SIZE) + /* Clear DDR memory */ + la t0, _end + li t1, DDR_CLEAR_SIZE +1: + sd zero, 0(t0) + addi t0, t0, 8 + bltu t0, t1, 1b + /* End */ +#endif + /* Build event queue for current core */ build_ring