1)编写mac文件。mac文件无非就是初始化cpu,这个功能u-boot就可以实现,直接在nandflash里烧入u-boot,然后改为nandflash启动,当启动开发板时按下Enter键停留在u-boot界面(防止进入Linux系统),搞定~
/*###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新建工程了。