AR 开发环境下使用 .icf文件定义 MCU及其外扩资源的应用范围,这些在项目设计之前必须被确定下来。所以认识它非常重要。那么该文件是如何定义的呢? 下面通过一个.icf来认识其具体结构: 这是一个基于STM32芯片的.icf文件定义结构:
/*###ICF### Section handled by ICF editor, don't touch! ****/ /*-Editor annotation file-*/ /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ /********************************-Specials-************************************/ /*由于STM32内部flash的起始地址为 0x08000000, 所以如下语句定义程序的起始地址,但对于一个应用程序,其起始运行地址不一定是 芯片定义的初地址,其可根据实际需要修改,当修改后,必须特殊设计一段引导代码使其能跳到应用程序中来。 由于作者的系统的APP 起始地址为 0x08008000 ,所以我的应用程序app start addrress 定义如下:*/ define symbol __ICFEDIT_intvec_start__ = 0x08008000; /********************************-Memory Regions-******************************/ /* 定义内部FLASH地址 */ define symbol __ICFEDIT_region_ROM_start__ = 0x08008000; define symbol __ICFEDIT_region_ROM_end__ = 0x0807FFFF; /* 定义内部RAM地址 */ define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; define symbol __ICFEDIT_region_RAM_end__ = 0x2000FFFF;
/* 定义扩展RAM地址 */ define symbol __ICFEDIT_region_EXRAM_start__ = 0x68000000; define symbol __ICFEDIT_region_EXRAM_end__ = 0x68040000;
/*********************************-Sizes-***************************************/ /* 栈和堆大小,一般不需要修改 */ define symbol __ICFEDIT_size_cstack__ = 0x400; define symbol __ICFEDIT_size_heap__ = 0x200; /******************************* End of ICF editor section. ###ICF###***********/ define memory mem with size = 4G; define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
/*定义内部 RAM ROM, 以及外部RAM 地址范围 */ 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 region EXRAM_region = mem:[from __ICFEDIT_region_EXRAM_start__ to __ICFEDIT_region_EXRAM_end__];
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
place in ROM_region { readonly }; place in RAM_region { readwrite, block CSTACK, block HEAP }; /* 对外部RAM操作类型的声明 */ place in EXRAM_region {readwrite data section SDRAM }; /* EXTSRAM_region */ /* 定义一个标志位,代表扩展RAM的起始地址,可以再应用函数中直接调用SDRAM_BASE_ADDR 这个变量 */ define exported symbol SDRAM_BASE_ADDR = __ICFEDIT_region_EXRAM_start__;
/******************************* End of this file ******************************/