只是测试程序,编译出来有警告不管,反正只是测试NAND,NOR,RAM对不对,就知道整个核心板对不对了.微雪只能提供不能直接升级到Keil UV5的UV4工程,所以...
LPC4357微雪核心板UV5工程
另外程序中不涉及任何调优!只是为了验证板子好使不好使,所以别问为什么性能不好.放主函数代码看看,完整工程请自己下载.
int32_t main() { uint32_t *ramdata; uint32_t i; uint32_t FlashID; SystemInit(); SDRAM_Init(); while(1) { /* 测试sdram,任何错误都会死在while(1) */ ramdata = (uint32_t *)SDRAM_ADDR_BASE; for(i = 0; i < SDRAM_SIZE / 2; i++) { *ramdata = i; ramdata++; } //_DBG("Check RAM... "); ramdata = (uint32_t *)SDRAM_ADDR_BASE; for(i = 0; i < SDRAM_SIZE / 2; i++) { if(*ramdata != i) { while(1); } ramdata++; } //_DBG("RAM Check Finish... "); //_DBG("Clear RAM content... "); ramdata = (uint32_t *)SDRAM_ADDR_BASE; for(i = 0; i < SDRAM_SIZE / 2; i++) { *ramdata = 0; ramdata++; } /*ram test ok*/ /* 测试nor,要自己检查 */ EraseSector(0x1C000000 + 0x20000); ProgramPage(0x1C000000 + 0x20000, sizeof(testnor_data) + 1, testnor_data); /* (0x1C000000 + 0x20000) 随时随地看这个地方的数值 */ /* 试试NAND */ NandFlash_Reset(); FlashID = NandFlash_ReadId(); if ( NandFlash_ValidBlockCheck() == 0 ) { while ( 1 ); // Fatal error /* for(i = 0; i < NANDFLASH_NUMOF_BLOCK; i++) { if (InvalidBlockTable[i] == FALSE) { } } */ } for ( i = 0; i < NANDFLASH_NUMOF_BLOCK; i++ ) { if ( NandFlash_BlockErase(i) == 0 ) { // printf("Erase NAND Flash fail at block: 0X%X",i); while(1); } } for ( i = 0; i < NANDFLASH_RW_PAGE_SIZE; i++ ) { ReadBuf[i] = 0; WriteBuf[i] = i; } if ( InvalidBlockTable[0] == 0 ) { if ( NandFlash_PageProgram( 0, 0, &WriteBuf[0] ) == 0 ) { // printf("Writing fail, testing terminated! "); while ( 1 ); /* Fatal error */ } if ( NandFlash_PageRead( 0, 0, &ReadBuf[0] ) == 0 ) { while ( 1 ); /* Fatal error */ } for ( i = 0; i < NANDFLASH_RW_PAGE_SIZE; i++ ) { ReadBuf[i] = i; // printf(" 0x%x",i); } /* Comparison read and write buffer */ for ( i = 0; i < NANDFLASH_RW_PAGE_SIZE; i++ ) { if ( ReadBuf[i] != WriteBuf[i] ) { while ( 1 ); /* Fatal error */ } } } /* 反正不成功卡死,直接断点到这里,就知道整个程序好使不好使. */ while(1); } }