add DRAM offset into SYSCON and jump to DRAM if flash successfully
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 8 Apr 2022 20:34:08 +0000 (21:34 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 8 Apr 2022 20:34:08 +0000 (21:34 +0100)
returns an offset after copy

coldboot/coldboot.c
src/ls2.py

index a86d7fc2e449361de2c452a40bd320aa387481ff..097093078b083bf928078949f4eaccfa0ee75aec 100644 (file)
@@ -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;
index 28b96e67adaea25161ec5ba4defca214dd020458..94adc8b2171a9c634dfe286df8bc58cca6caa7ca 100644 (file)
@@ -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)