⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 app2.c

📁 IARSOURCECODE是基于LPC2478嵌入式软件IAR EWARM V4.42的应用实例代码
💻 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 + -