flash read-and-dump
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 14 Apr 2022 12:13:23 +0000 (13:13 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 14 Apr 2022 12:13:23 +0000 (13:13 +0100)
coldboot/coldboot.c

index c9c029087a8ab3e0b643746e50201a8587cec479..f2cbbf311604111ef57c4f397fd05752ebed717f 100644 (file)
@@ -271,7 +271,7 @@ int main(void) {
         puts("\n");
     }
 #endif
-       volatile uint32_t *qspi = (uint32_t*)SPI_FLASH_BASE;
+       volatile uint32_t *qspi = (uint32_t*)SPI_FLASH_BASE+0x600000;
     //volatile uint8_t *qspi_bytes = (uint8_t*)spi_offs;
      // let's not, eh? writel(0xDEAF0123, (unsigned long)&(qspi[0]));
      // tmp = readl((unsigned long)&(qspi[0]));
@@ -525,8 +525,17 @@ int main(void) {
         // another terrible hack: copy from flash at offset 0x600000
         // a block of size 0x600000 into mem address 0x600000, then
         // jump to it.  this allows a dtb image to be executed
-        uint32_t *mem = (uint32_t*)0x600000;
-        fl_read(mem, 0x600000, 0x600000);
+        puts("copy QSPI\n");
+        volatile uint32_t *mem = (uint32_t*)0x600000;
+        fl_read(mem, 0x600000, 0x600000); // shorter (testing) 0x8000); 
+        puts("dump mem\n");
+        for (int i=0;i<256;i++) {
+          tmp = readl((unsigned long)&(mem[i]));
+          uart_writeuint32(tmp);
+          puts(" ");
+          if ((i & 0x7) == 0x7) puts("\r\n");
+        }
+        puts("\r\n");
         mtspr(8, 0x600000); // move address to LR
         __asm__ volatile("blr");
     }