引用: 引用 2 楼 yashi 的回复:
把FLASH读出来,看指定的区域是否有数据写进去。
请教下yashi大侠 看指定区域是哪里??下面我把我读取nand的程序和调试信息给大家看看??
程序:
FlashID = NF_ReadID();
if (!FlashID)
{
Uart_SendString("This NandFlash Type is not supported!!\r\n Booting is failure \r\n");
while(1)
{
;
}
} ?
nBadBlocks = 0;
for (nPage = NAND_COPY_PAGE_OFFSET ; nPage < (LOAD_SIZE_PAGES + NAND_COPY_PAGE_OFFSET) ; nPage++)
{
nBlock = ((nPage / NAND_PAGES_PER_BLOCK) + nBadBlocks);
Uart_SendString("nBlock:");
Uart_SendDWORD((int)nBlock, TRUE);
Uart_SendString("nPage:");
Uart_SendDWORD((int)nPage, TRUE);
Uart_SendString("pCopyPtr:"); ? ???
Uart_SendDWORD((int)pCopyPtr, TRUE); ?? ??
if (!NF_ReadPage(nBlock, (nPage % NAND_PAGES_PER_BLOCK), pCopyPtr))
{
if ((nPage % NAND_PAGES_PER_BLOCK) != 0)
{
rGPFDAT = (rGPFDAT & 0xf) | ((0x0101 & 0xf) << 4);
// Spin forever...
while(1)
{
;
}
}
// ECC error on a block boundary is (likely) a bad block - retry the page 0 read on the next block.
nBadBlocks++;
nPage--;
continue;
}
Uart_SendString("pCopyPtr = ");
Uart_SendByte((int) pCopyPtr); - B 9
Uart_SendString("*"); 1
pCopyPtr += NAND_PAGE_SIZE_BYTES;
}
调试信息的一部分:
nBlock:0x0000000d
nPage:0x000001bd
pCopyPtr:0x00007a00
pCopyPtr = *nBlock:0x0000000d
nPage:0x000001be
pCopyPtr:0x00007c00
pCopyPtr = *nBlock:0x0000000d
nPage:0x000001bf
pCopyPtr:0x00007e00
pCopyPtr = *nBlock:0x0000000e
nPage:0x000001c0
pCopyPtr:0x00008000
pCopyPtr = *nBlock:0x0000000e
nPage:0x000001c1
pCopyPtr:0x00008200
pCopyPtr = *nBlock:0x0000000e
nPage:0x000001c2
pCopyPtr:0x00008400
pCopyPtr = *nBlock:0x0000000e
nPage:0x000001c3
pCopyPtr:0x00008600
pCopyPtr = *nBlock:0x0000000e
nPage:0x000001c4
pCopyPtr:0x00008800