认识IAR 开发环境下的.icf 文件

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__];

/*
********************************************************************************
                    Define Bootloader address
********************************************************************************
*/
/* 这段语句相当于一个标志位,使的以 ILOADER  声明的代码放在如下空间内,具体声明方式如下:
#pragma location = "ILOADER"
__root const unsigned char RBL_Code[] = {
  0x00, 0x04, 0x00, 0x20, 0x85, 0x2C, 0x00, 0x08, 0x9D, 0x2C, 0x00, 0x08, 0x9F, 0x2C, 0x00, 0x08,
  0xA1, 0x2C, 0x00, 0x08, 0xA3, 0x2C, 0x00, 0x08, 0xA5, 0x2C, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA7, 0x2C, 0x00, 0x08,
};
*/
define region ILOADER_region         = mem:[from 0x08000000 to 0x08003FFF];      
place in ILOADER_region         { readonly section ILOADER };
/*******************************************************************************/
/* 下列语句定义所定义地址空间内可完成的操作类型*/
initialize by copy { readwrite };
do not initialize  { section .noinit };

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 ******************************/

  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值