From: Luke Kenneth Casson Leighton Date: Fri, 8 Apr 2022 20:34:08 +0000 (+0100) Subject: add DRAM offset into SYSCON and jump to DRAM if flash successfully X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=35e980e56f0b58779c273051906f41a92e3ed746;p=ls2.git add DRAM offset into SYSCON and jump to DRAM if flash successfully returns an offset after copy --- diff --git a/coldboot/coldboot.c b/coldboot/coldboot.c index a86d7fc..0970930 100644 --- a/coldboot/coldboot.c +++ b/coldboot/coldboot.c @@ -427,8 +427,12 @@ for (i=0;i<1000;i++) { (ftr & SYS_REG_INFO_HAS_DRAM) && (failcnt == 0)) { - copy_flash(spi_offs); - return DRAM_BASE; + // identify ELF, copy if present, and get the offset/addr + unsigned long faddr = copy_flash(spi_offs); + if (faddr != -1ul) { + // jump to offset/addr relative to DRAM base + return DRAM_BASE + faddr; + } } return 0; diff --git a/src/ls2.py b/src/ls2.py index 28b96e6..94adc8b 100644 --- a/src/ls2.py +++ b/src/ls2.py @@ -318,6 +318,7 @@ class DDR3SoC(SoC, Elaboratable): # System Configuration info # offset executable ELF payload at 1 megabyte offset (1<<20) spi_offset = 1<<20 if (spi_0_pins is not None) else None + dram_offset = ddr_addr if (ddr_pins is not None) else None self.syscon = MicrowattSYSCON(sys_clk_freq=clk_freq, has_uart=(uart_pins is not None), spi_offset=spi_offset)