wotyndal 发表于 2014-5-28 11:13:41

关于IAR for ARM的.icf文件

        用IAR EWARM开发S3C2440A裸机程序,程序下载到Nand Flash,想实现程序先在内部4KB RAM中运行初始化代码,将Nand Flash中的程序拷贝到外部SDRAM后,代码开始跳转到SDRAM中执行。
        据我研究,需要配置连接器配置文件(.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__ = 0x0000;
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x0000;
define symbol __ICFEDIT_region_ROM_end__   = 0x0FFFFFFF;
define symbol __ICFEDIT_region_RAM_start__ = 0x30000000;
define symbol __ICFEDIT_region_RAM_end__   = 0x33FFFFFF;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__   = 0x2000;
define symbol __ICFEDIT_size_svcstack__ = 0x100;
define symbol __ICFEDIT_size_irqstack__ = 0x100;
define symbol __ICFEDIT_size_fiqstack__ = 0x100;
define symbol __ICFEDIT_size_undstack__ = 0x100;
define symbol __ICFEDIT_size_abtstack__ = 0x100;
define symbol __ICFEDIT_size_heap__   = 0x8000;
/**** End of ICF editor section. ###ICF###*/


/* Internal RAM symbol define ------------------------------------------------*/
/* Internal RAM symbol define ------------------------------------------------*/
/*-Specials-*/
define symbol __IRAM_intvec_start__ = 0x0000;
/*-Memory Regions-*/
define symbol __IRAM_region_ROM_start__ = 0x0000;
define symbol __IRAM_region_ROM_end__   = 0x02000000;
define symbol __IRAM_region_RAM_start__ = 0x0000;
define symbol __IRAM_region_RAM_end__   = 0x1000;
/*-Sizes-*/
define symbol __IRAM_size_cstack__   = 0x10;
define symbol __IRAM_size_svcstack__ = 0x8;
define symbol __IRAM_size_irqstack__ = 0x8;
define symbol __IRAM_size_fiqstack__ = 0x8;
define symbol __IRAM_size_undstack__ = 0x8;
define symbol __IRAM_size_abtstack__ = 0x8;
define symbol __IRAM_size_heap__   = 0x40;
/* Internal RAM symbol define --------------------END-------------------------*/
/* Internal RAM symbol define --------------------END-------------------------*/


define memory mem with size = 4G;

define region ROM_region   = mem:;
define region RAM_region   = mem:;

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__   { };

define region IRAM_RAM_region   = mem:;

define block IRAM_CSTACK    with alignment = 8, size = __IRAM_size_cstack__   { };
define block IRAM_SVC_STACK with alignment = 8, size = __IRAM_size_svcstack__ { };
define block IRAM_IRQ_STACK with alignment = 8, size = __IRAM_size_irqstack__ { };
define block IRAM_FIQ_STACK with alignment = 8, size = __IRAM_size_fiqstack__ { };
define block IRAM_UND_STACK with alignment = 8, size = __IRAM_size_undstack__ { };
define block IRAM_ABT_STACK with alignment = 8, size = __IRAM_size_abtstack__ { };
define block IRAM_HEAP      with alignment = 8, size = __IRAM_size_heap__   { };


initialize by copy { readwrite };
//initialize by copy with packing = none { section __DLIB_PERTHREAD }; // Required in a multi-threaded application
do not initialize{ section .noinit };

place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };

place at start of ROM_region { readonly section .cstart }; // Place Startup Code at start of ROM
place in          ROM_region { readonly };               // Place Other Code in ROM

place in IRAM_RAM_region   { readwrite section .cstart,// Place Startup readwrite section in Internal RAM
                               block IRAM_CSTACK, block IRAM_SVC_STACK, block IRAM_IRQ_STACK, block IRAM_FIQ_STACK,
                               block IRAM_UND_STACK, block IRAM_ABT_STACK, block IRAM_HEAP };
place in      RAM_region   { readwrite,                  // Place Other readwrite section in External SDRAM
                               block CSTACK, block SVC_STACK, block IRQ_STACK, block FIQ_STACK,
                               block UND_STACK, block ABT_STACK, block HEAP };

wotyndal 发表于 2014-5-28 11:19:25

补充:我通过位于NOR Flash中的U-Boot启动,把代码下载到Nand Flash,2440没能达到预期的效果(LED亮);通过J-Link调试发现PC一直没能跳转到SDRAM(0x30000000)中,虽然能够达到预期效果(LED亮)。
页: [1]
查看完整版本: 关于IAR for ARM的.icf文件