主题 : 帮忙找个错!google都搜不到! 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 42165
精华: 0
发帖: 18
金钱: 90 两
威望: 18 点
贡献值: 0 点
综合积分: 36 分
注册时间: 2011-04-05
最后登录: 2011-11-26
楼主  发表于: 2011-06-27 12:47

 帮忙找个错!google都搜不到!

图片:

这是赵春江老师博客上的程序,是定时器中断实验.我自己添加在工程上编译有问题. 去掉_irq编译才能通过,但是这显然不对.
错误类型见附件!


/*************************************************
Function name: 这是基础实验的一个模版
Parameter : 无
Description : 做基础实验,直接调用该模板即可
Return : 无
Argument : 无
Autor & date : Daniel
**************************************************/
#define GLOBAL_CLK 1
#define _ISR_STARTADDRESS 0x33ffff00
#define U32 unsigned int
//#define pISR_TIMER4 (*(unsigned *)(_ISR_STARTADDRESS_0x58))

#define rSRCPND (*(volatile unsigned *)0x4a000000)
#define rINTMSK (*(volatile unsigned *)0x4a000008)
#define rINTPND (*(volatile unsigned *)0x4a000010)

#define rGPBCON (*(volatile unsigned *)0x56000010)
#define rGPBDAT (*(volatile unsigned *)0x56000014)
#define rGPBUP (*(volatile unsigned *)0x56000018)

#define rTCFG0 (*(volatile unsigned *)0x51000000)
#define rTCFG1 (*(volatile unsigned *)0x51000004)
#define rTCON (*(volatile unsigned *)0x51000008)
#include <stdlib.h>
#include <string.h>
#include "def.h"
#include "option.h"
#include "2440addr.h"
#include "2440lib.h"
#include "2440slib.h"
#include "mmu.h"
#include "profile.h"
#include "memtest.h"


//#define rTCNTB4 (*(volatile unsigned *)0x5100003c)
static void _irq IRQ_Timer4_Handle(void);
void Main(void) //??????Main?
{
rGPBCON = 0x155555;
rGPBUP = 0x7ff;

rGPBDAT = 0x1e0;

rSRCPND=rSRCPND | (0x1<<14); //xie yi qing 0?
rINTPND = rINTPND |(0x1<<14);
rINTMSK = ~(0x1<<14);

rTCFG0 &=0xFFFF00FF;
rTCFG0 |=0xf900;
rTCFG1 &=~0xf0000;
rTCFG1 |=0x20000;
rTCNTB4=12500;

rTCON &=~0xF00000;
rTCON |=0x700000;
rTCON &=~0x200000; //???

pISR_TIMER4=(U32)IRQ_Timer4_Handle;

while(1)
{
;

}

}

static void _irq IRQ_Timer4_Handle(void)
{
static int count;
count++;
rSRCPND = rSRCPND | (0x1<<14);
rINTPND = rINTPND | (0x1<<14);
if(count %4==0)
rGPBDAT = ~0x1e0;
else if(count % 4==1)
rGPBDAT = 0x1e0;
}
[ 此帖被promise2013在2011-06-27 14:40重新编辑 ]
级别: 新手上路
UID: 42165
精华: 0
发帖: 18
金钱: 90 两
威望: 18 点
贡献值: 0 点
综合积分: 36 分
注册时间: 2011-04-05
最后登录: 2011-11-26
1楼  发表于: 2011-06-27 14:40
我靠!花了半天的时间找到错了,__irq前面是双下划线