📄 app2.c
字号:
/*****************************************************************************
* app2.c: main C entry file for NXP LPC24xx Family Microprocessors
*
* 应用程序,将Flash上的内容读到SDRAM,然后用串口打印出来
*
* History
* 2007.12.13 ver 1.00 Prelimnary version, first Release
*
******************************************************************************/
#include "LPC2468.h" /* LPC23xx/24xx definitions */
#include "type.h"
#include "target.h"
#include "irq.h"
#include "uart.h"
#include "ex_sdram.h"
#include "ex_norflash.h"
#define BAUDRATE 9600
/*****************************************************************************
** Main Function main()
*****************************************************************************/
int main (void)
{
unsigned long length,address=0xa0000000;
volatile WORD i,*rp,*wp;
char *buf;
void (*fp)(void);
TargetResetInit();
SDRAMInit();
NORFLASHInit();
UARTInit(BAUDRATE);
printf("This is a Uart/Flash application.It'll read from Flash,write to SDRAM,then print by Uart.\n");
wp = (WORD *)address;
length = 2048; // 读2KB
/* Flash读 */
if ( NORFLASHCheckID() == FALSE )
{
printf("NOR Flash ID error!\r\n");
while ( 1 );
}
for ( i = 0; i < length/2; i++ )
{
rp = GET_ADDR(i);
*wp = *rp; // 读到SDRAM中
wp++;
}
/* 串口打印 */
// buf = (char *)address;
// puts(buf);
printf("\nThen run the downloaded program ... \n");
fp = (void (*)(void))0xa00002a8;
fp();
printf("\nThe application successed!\n");
while(1);
}
/*****************************************************************************
** End Of File
*****************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -