From e96cfbbc83cc9acde4b8fcc8d78e595818a9f613 Mon Sep 17 00:00:00 2001 From: Gabriel Somlo Date: Tue, 16 Jun 2020 20:19:46 -0400 Subject: [PATCH] cpu/mor1kx: fix .data initialization (follow-up to PR #567) --- litex/soc/cores/cpu/mor1kx/crt0.S | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/litex/soc/cores/cpu/mor1kx/crt0.S b/litex/soc/cores/cpu/mor1kx/crt0.S index ff77910dc..b8eeec071 100644 --- a/litex/soc/cores/cpu/mor1kx/crt0.S +++ b/litex/soc/cores/cpu/mor1kx/crt0.S @@ -153,6 +153,25 @@ _crt0: l.movhi r1, hi(_fstack) l.ori r1, r1, lo(_fstack) + /* Init DATA */ + l.movhi r14,hi(_fdata_rom) + l.ori r14,r14,lo(_fdata_rom) + l.movhi r18,hi(_fdata) + l.ori r18,r18,lo(_fdata) + l.movhi r20,hi(_edata) + l.ori r20,r20,lo(_edata) +.copyDATA: + l.sfeq r18,r20 + l.bf .doneDATA + l.nop + l.lwz r3,0(r14) + l.sw 0(r18),r3 + l.addi r14,r14,4 + l.addi r18,r18,4 + l.j .copyDATA + l.nop +.doneDATA: + /* Clear BSS */ l.movhi r21, hi(_fbss) l.ori r21, r21, lo(_fbss)