现在的位置: 首页 > 综合 > 正文

IAR调试S3C6410的笔记(二)

2013年01月22日 ⁄ 综合 ⁄ 共 2536字 ⁄ 字号 评论关闭

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

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

    下面是飞凌6410核心板的IAR调试过程:
1)编写mac文件。mac文件无非就是初始化cpu,这个功能Wince的FIRSTBOOT就可以实现,直接在nandflash里烧入FIRSTBOOT(飞凌里叫什么steploader),然后改为nandflash启动,搞定~(飞凌给的资料里,用RVDS2.2调试S3C6410就是这么干的,友善的就不晓得了)
2)编写icf文件。icf文件大同小异,可以根据IAR的模板修改,路径为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 };

飞凌核心板使用的是DDRAM,起始地址为0x50000000
从文件可以看出程序段放在0x50000000~00x50FFFFFF,数据段放在0x51000000~00x51FFFFFF

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

抱歉!评论已关闭.