IAR調(diào)試S3C6410的筆記(二)
簡單地說,IAR調(diào)試S3C6410可以分成以下3個步驟:
1)編寫mac文件,初始化S3C6410的看門狗、時鐘、DDRAM控制器等,為下載代碼做準備。
2)編寫icf文件對S3C6410的內(nèi)存空間進行分配,配置堆棧段、數(shù)據(jù)段、程序段的起始地址和大小。
3)編寫S3C6410的啟動代碼,跳至main函數(shù)運行。
下面是飛凌6410核心板的IAR調(diào)試過程:
1)編寫mac文件。mac文件無非就是初始化cpu,這個功能Wince的FIRSTBOOT就可以實現(xiàn),直接在nandflash里燒入FIRSTBOOT(飛凌里叫什么steploader),然后改為nandflash啟動,搞定~(飛凌給的資料里,用RVDS2.2調(diào)試S3C6410就是這么干的,友善的就不曉得了)
2)編寫icf文件。icf文件大同小異,可以根據(jù)IAR的模板修改,路徑為IAR SystemsEmbedded Workbench 6.0armconfiggeneric.icf,只需修改地址映射和段位置即可,以下為我的icf文件
/*###ICF### Section handled by ICF editor, don't touch! ****/
/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$configideIcfEditora_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,數(shù)據(jù)段放在0x51000000~00x51FFFFFF
3)編寫啟動代碼。其實啟動代碼可短可長,完成關(guān)鍵部分就行,這里把IAR SystemsEmbedded Workbench 6.0armsrclibarmcstartup.s復(fù)制過去就行,現(xiàn)在萬事具備,只差用IAR新建工程了。