Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1340775
  • 博文数量: 198
  • 博客积分: 1629
  • 博客等级: 上尉
  • 技术积分: 2743
  • 用 户 组: 普通用户
  • 注册时间: 2011-08-01 15:41
文章分类
文章存档

2023年(6)

2022年(20)

2021年(8)

2020年(3)

2018年(17)

2017年(3)

2016年(3)

2015年(9)

2014年(13)

2013年(17)

2012年(77)

2011年(22)

分类: 嵌入式

2013-12-24 17:22:23

/*
 * uboot go test
 */

//typedef void (*pr)(const char *fmt, ...);
//void (*pr)(const char *fmt, ...)=0x778137b8;
void (*pr)(const char *fmt, ...)=0xa7f8aef4;
void (*pc)(char fmt) = 0xa7f8aeb0;  /*find in u-boot.map */
void (*puts)(const char *s)=0xa7f8aed8;
void (*udelay)(unsigned long usec)=0xa7f80ed4;
int add(int a, int b);
int rd8(int addr);
void wr8(int addr,char val);

//int g_val = 0;

int main(int argc, char **argv)
{
    int i = 0;
int g_val = 0;
    //pr print = (pr)0x0x778137b8; 
    /*pxa timer*/
    *(int*)(0x40A000C0) =  0x8c;
    *(int*)(0x40A00080) =  0x0AFFFFF;
    *(int*)(0x40A00040) =  0x0;

    pc('h');
    pc('e');
    pc('l');
    pc('l');
    pc('o');
    pc(',');
    pc('s');
    pc('b');
    pc('s');
    pc('!');

    for(i=10; i>0; i--)
    {
        puts("\nSBS");
         g_val += i;
         pr(" i(%d)+g_val(%d) = %d\n",i, g_val, add(i,g_val));
         udelay(1000*1000);
    }
    pr("hello wolrd----i=%d\n",i);
    pr("g_val addr is 0x%x\n", &g_val);
    g_val = *(int*)0x40A00040;
    pr("timer is %d\n", g_val);
    return 0;
}

int add(int a, int b)
{
    return a+b;
}
阅读(1943) | 评论(0) | 转发(0) |
0

上一篇:u-boot测试程序编译

下一篇:utest.lds文件

给主人留下些什么吧!~~