仍然以上一贴的硬件平台为例,在ADS中打开命令窗口,执行如下命令: >obey c:mymap.txt 此时,2MB的Flash存储器和16MB的SDRAM已分别映射到地址空间的0x0000,0000~(0x0020,0000-1)和0x0040,0000~(0x0140,0000-1)处。 编写一个Flash的烧写程序,由Init.s文件和Main.c文件构成。 Init.s文件的代码如下: IMPORT Main AREA Init,CODE,READONLY ENTRY BL Main B . END Main.c文件的代码如下:#define ULCON0 (*(volatile unsigned *)0x03FFD000) //UART channel0 line control register#define UCON0 (*(volatile unsigned *)0x03FFD004) //UART channel0 control register#define USTAT0 (*(volatile unsigned *)0x03FFD008) //UART channel0 status register#define UTXBUF0 (*(volatile unsigned *)0x03FFD00c) //UART channel0 transimit holding register#define URXBUF0 (*(volatile unsigned *)0x03FFD010) //UART channel0 recieve buffer register#define UBRDIV0 (*(volatile unsigned *)0x03FFD014) //Baud rate divisor register0#define AM_WORD_COUNT (64*1024)/2 //此处决定待烧写文件的大小,在此为64KB#define UINT16 unsigned short#define AM_START_ADDR 0x0000000 #define AM_ADDR_UNLOCK1 0x555#define AM_ADDR_UNLOCK2 0x2aa#define AM_DATA_UNLOCK1 0xaaaa#define AM_DATA_UNLOCK2 0x5555#define AM_SETUP_WRITE 0xa0a0#define AM_SETUP_ERASE 0x8080#define AM_CHIP_ERASE 0x1010#define AM_SECTOR_ERASE 0x3030#define AM_RESET 0xf0f0void Delay(unsigned int);void InitUART(int Port,int Baudrate);void PrintUART0(char *s);int Main(){ volatile UINT16 *from_add,*to_add;int i;InitUART(0,0x500);PrintUART0("ARM Starting...n");to_add= (UINT16 *)0x0;from_add=(UINT16 *)0x500000;for(i=0;i 猜你喜欢