From 99b2b4f6afb85d5e4e9a8dded916ac0952286dfe Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 14 Apr 2022 13:13:23 +0100 Subject: [PATCH] flash read-and-dump --- coldboot/coldboot.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/coldboot/coldboot.c b/coldboot/coldboot.c index c9c0290..f2cbbf3 100644 --- a/coldboot/coldboot.c +++ b/coldboot/coldboot.c @@ -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"); } -- 2.30.2