EWARM调试S3C6410的笔记(二)

原始出处:http://blog.csdn.net/believe_yx/article/details/6680061


  简单地说,EWARM调试S3C6410可以分成以下3个步骤:

1) 编写mac文件,初始化S3C6410的看门狗、时钟、DDRAM控制器等,为下载代码做准备。
2) 编写icf文件对S3C6410的内存空间进行分配,配置堆栈段、数据段、程序段的起始地址和大小。
3) 编写S3C6410的启动代码,跳至main函数运行。

    下面是Tiny6410的EWARM调试过程:
1)编写mac文件。mac文件无非就是初始化cpu,这个功能u-boot就可以实现,直接在nandflash里烧入u-boot,然后改为nandflash启动,当启动开发板时按下Enter键停留在u-boot界面(防止进入Linux系统),搞定~
2)编写icf文件。icf文件大同小异,可以根据EWARM的模板修改,路径为IAR Systems\Embedded Workbench 6.0\arm\config\generic.icf, 只需修改地址映射和段位置即可 ,以下为我的icf文件

/*###ICF### Section handled by ICF editor, don't touch! ****/
/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */
/*
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0xc000000;
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x50000000;
define symbol __ICFEDIT_region_ROM_end__   = 0x50FFFFFF;
define symbol __ICFEDIT_region_RAM_start__ = 0x51000000;
define symbol __ICFEDIT_region_RAM_end__   = 0x51FFFFFF;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__   = 0x1000;
define symbol __ICFEDIT_size_svcstack__ = 0x800;
define symbol __ICFEDIT_size_irqstack__ = 0x800;
define symbol __ICFEDIT_size_fiqstack__ = 0x800;
define symbol __ICFEDIT_size_undstack__ = 0x800;
define symbol __ICFEDIT_size_abtstack__ = 0x800;
define symbol __ICFEDIT_size_heap__     = 0x800;
/**** End of ICF editor section. ###ICF###*/


define memory mem with size = 4G;
define region ROM_region   = mem:[from __ICFEDIT_region_ROM_start__   to __ICFEDIT_region_ROM_end__];
define region RAM_region   = mem:[from __ICFEDIT_region_RAM_start__   to __ICFEDIT_region_RAM_end__];

define block CSTACK    with alignment = 8, size = __ICFEDIT_size_cstack__   { };
define block SVC_STACK with alignment = 8, size = __ICFEDIT_size_svcstack__ { };
define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { };
define block FIQ_STACK with alignment = 8, size = __ICFEDIT_size_fiqstack__ { };
define block UND_STACK with alignment = 8, size = __ICFEDIT_size_undstack__ { };
define block ABT_STACK with alignment = 8, size = __ICFEDIT_size_abtstack__ { };
define block HEAP      with alignment = 8, size = __ICFEDIT_size_heap__     { };

initialize by copy { section .intvec };
do not initialize  { section .noinit };

place in ROM_region { section .intvec };
place in ROM_region { section .intvec_init };
place in ROM_region { section .iar.init_table };
place in ROM_region { section .text };
place in RAM_region { section .data };
place in RAM_region { section .bss };
place in RAM_region   { block CSTACK, block SVC_STACK, block IRQ_STACK, block FIQ_STACK,
                        block UND_STACK, block ABT_STACK, block HEAP };

Tiny6410使用的是SDRAM,起始地址为0x50000000(具体参考芯片用户手册)
从文件可以看出程序段放在0x50000000~00x50FFFFFF,数据段放在0x51000000~00x51FFFFFF

3)编写启动代码。其实启动代码可短可长,完成关键部分就行,这里把IAR Systems\Embedded Workbench 6.0\arm\src\lib\arm\cstartup.s复制过去就行,现在万事具备,只差用EWARM新建工程了。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值