IAR的ILINK链接器icf配置文件(分析MKE18F512xxx16_flash.icf)

本篇介绍介绍IAR的icf配置文件,以MKE18F512xxx16_flash.icf为例子。
1.
我直接在.icf里进行注解。

MKE18F512xxx16_flash.icf

//define [ exported ] symbol name = expr;
//作用:指定某个符号的值。
define symbol __ram_vector_table_size__ =  isdefinedsymbol(__ram_vector_table__) ? 0x00000400 : 0;
define symbol __ram_vector_table_offset__ =  isdefinedsymbol(__ram_vector_table__) ? 0x000003FF : 0;

define symbol m_interrupts_start       = 0x00000000;
define symbol m_interrupts_end         = 0x000003FF;

define symbol m_flash_config_start     = 0x00000400;
define symbol m_flash_config_end       = 0x0000040F;

define symbol m_text_start             = 0x00000410;
define symbol m_text_end               = 0x0007FFFF;

define symbol m_interrupts_ram_start   = 0x1FFF8000;
define symbol m_interrupts_ram_end     = 0x1FFF8000 + __ram_vector_table_offset__;

define symbol m_data_start             = m_interrupts_ram_start + __ram_vector_table_size__;
define symbol m_data_end               = 0x1FFFFFFF;

define symbol m_data_2_start           = 0x20000000;
define symbol m_data_2_end             = 0x20007FFF;

/* Sizes */
if (isdefinedsymbol(__stack_size__)) {
  define symbol __size_cstack__        = __stack_size__;
} else {
  define symbol __size_cstack__        = 0x0400;
}

if (isdefinedsymbol(__heap_size__)) {
  define symbol __size_heap__          = __heap_size__;
} else {
  define symbol __size_heap__          = 0x0400;
}

define exported symbol __VECTOR_TABLE  = m_interrupts_start;
define exported symbol __VECTOR_RAM    = isdefinedsymbol(__ram_vector_table__) ? m_interrupts_ram_start : m_interrupts_start;
define exported symbol __RAM_VECTOR_TABLE_SIZE = __ram_vector_table_size__;

//define memory name with size = expr [, unit-size];
//作用:定义一个可编址的存储地址空间(memory)。
define memory mem with size = 4G;


//define region name = region-expr;
//作用:定义一个存储地址区域(region)。一个区域可由一个或多个范围组成,每个范围内地址必须连续,但几个范围之间不必是连续的。
define region m_flash_config_region = mem:[from m_flash_config_start to m_flash_config_end];
define region TEXT_region = mem:[from m_interrupts_start to m_interrupts_end]
                          | mem:[from m_text_start to m_text_end];
define region DATA_region = mem:[from m_data_start to m_data_end]
                          | mem:[from m_data_2_start to m_data_2_end-__size_cstack__];
define region CSTACK_region = mem:[from m_data_2_end-__size_cstack__+1 to m_data_2_end];
define region m_interrupts_ram_region = mem:[from m_interrupts_ram_start to m_interrupts_ram_end];

//define block name [ with param, param... ] 
{ 
extended-selectors 
}; 
//作用:     定义一个地址块(block);它可以是个只保留指定大小的地址空间的空块,比如栈、堆;也可以包含一系列的sections,由extended-selectors 选择。 
//alignment = expr   (最小对齐字节数) 
//size = expr       (块的大小)
define block CSTACK    with alignment = 8, size = __size_cstack__   { };
define block HEAP      with alignment = 8, size = __size_heap__     { };
define block RW        { readwrite };
define block ZI        { zi };

//initialize { by copy | manually } [ with param, param... ] 
{ 
section-selectors 
}; 
//作用: 初始化sections 
//by copy : 在程序启动时自动执行初始化 
initialize by copy { readwrite, section .textrw };

//do not initialize 
{ 
section-selectors 
}; 
//作用: 规定在程序启动时不需要初始化的sections;一般用于__no_init 声明的变量段(.noinit) 
do not initialize  { section .noinit };

//place at { address memory [:expr] | start of region_expr | end of region_expr } 
{ 
extended-selectors 
}; 
//作用: 把section 或 block 放置在某个具体的起始地址处,或者一个 region 的开始或结束处 
place at address mem: m_interrupts_start    { readonly section .intvec };


//place in region-expr 
{ 
extended-selectors 
}; 
//作用:把section 或 block  (按任意顺序)放置在某个region 中 
place in m_flash_config_region              { section FlashConfig };
place in TEXT_region                        { readonly };
place in DATA_region                        { block RW };
place in DATA_region                        { block ZI };
place in DATA_region                        { last block HEAP };
place in CSTACK_region                      { block CSTACK };
place in m_interrupts_ram_region            { section m_interrupts_ram };

2.
上文的readwrite,zi, section .intvec,section .textrw, section .noinit 等在哪儿定义呢?

其实这是系统预定义的这里写图片描述

3.

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值